mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
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:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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 + " ";
|
||||
|
||||
Reference in New Issue
Block a user