refactor: avoid copies of large objects in range based for loops (#47588)

* Avoid copies of large objects in range-based for-loops.

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6527689

* Avoid copies of large objects in range-based for-loops in Browser::ShowAboutPanel()
This commit is contained in:
Charles Kerr
2025-06-29 14:32:26 -05:00
committed by GitHub
parent 4af248f2b6
commit 7c55b24be2
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

@@ -309,7 +309,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 + " ";