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 <charles@charleskerr.com>

* Avoid copies of large objects in range-based for-loops in Browser::ShowAboutPanel()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot]
2025-06-30 10:28:53 +02:00
committed by GitHub
parent 3eabf175b8
commit 68c769de94
2 changed files with 2 additions and 2 deletions

View File

@@ -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");
}

View File

@@ -310,7 +310,7 @@ std::string RecursiveDumpAXPlatformNodeAsString(
std::string line = node->GetDelegate()->GetData().ToString();
std::vector<std::string> 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 + " ";