From 68c769de94797cb9a93428fb5b89f537f80249b5 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 10:28:53 +0200 Subject: [PATCH] refactor: avoid copies of large objects in range based for loops (#47606) * Avoid copies of large objects in range-based for-loops. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6527689 Co-authored-by: Charles Kerr * Avoid copies of large objects in range-based for-loops in Browser::ShowAboutPanel() Co-authored-by: Charles Kerr --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr --- shell/browser/browser_win.cc | 2 +- shell/browser/ui/webui/accessibility_ui.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index f8da302748..9adf9052cd 100644 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -748,7 +748,7 @@ void Browser::ShowAboutPanel() { "applicationName", "applicationVersion", "copyright", "credits"}; const std::string* str; - for (std::string opt : stringOptions) { + for (const std::string& opt : stringOptions) { if ((str = dict.FindString(opt))) { aboutMessage.append(*str).append("\r\n"); } diff --git a/shell/browser/ui/webui/accessibility_ui.cc b/shell/browser/ui/webui/accessibility_ui.cc index 0229ed3439..b85b2181a7 100644 --- a/shell/browser/ui/webui/accessibility_ui.cc +++ b/shell/browser/ui/webui/accessibility_ui.cc @@ -310,7 +310,7 @@ std::string RecursiveDumpAXPlatformNodeAsString( std::string line = node->GetDelegate()->GetData().ToString(); std::vector attributes = base::SplitString( line, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - for (std::string attribute : attributes) { + for (const std::string& attribute : attributes) { if (ui::AXTreeFormatter::MatchesPropertyFilters(property_filters, attribute, false)) { str += attribute + " ";