mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
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:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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 + " ";
|
||||
|
||||
Reference in New Issue
Block a user