Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: tools/gn/loader.cc

Issue 610293003: Replace more for loops in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/input_file_manager.cc ('k') | tools/gn/loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/loader.cc
diff --git a/tools/gn/loader.cc b/tools/gn/loader.cc
index b49ebfda6da625bf63dc756e5f7129b3e8605d83..be5f5cc62ab4f0c46909c36bf48be9bffedf67fc 100644
--- a/tools/gn/loader.cc
+++ b/tools/gn/loader.cc
@@ -265,8 +265,8 @@ void LoaderImpl::BackgroundLoadFile(const Settings* settings,
g_scheduler->FailWithError(err);
// Pass all of the items that were defined off to the builder.
- for (size_t i = 0; i < collected_items.size(); i++)
- settings->build_settings()->ItemDefined(collected_items[i]->Pass());
+ for (const auto& item : collected_items)
+ settings->build_settings()->ItemDefined(item->Pass());
trace.Done();
@@ -371,14 +371,13 @@ void LoaderImpl::DidLoadBuildConfig(const Label& label) {
// is OK.
LoadIDSet old_loads;
invocations_.swap(old_loads);
- for (LoadIDSet::iterator i = old_loads.begin();
- i != old_loads.end(); ++i) {
- if (i->toolchain_name.is_null()) {
+ for (const auto& load : old_loads) {
+ if (load.toolchain_name.is_null()) {
// Fix up toolchain label
- invocations_.insert(LoadID(i->file, label));
+ invocations_.insert(LoadID(load.file, label));
} else {
// Can keep the old one.
- invocations_.insert(*i);
+ invocations_.insert(load);
}
}
} else {
@@ -390,10 +389,8 @@ void LoaderImpl::DidLoadBuildConfig(const Label& label) {
record->is_config_loaded = true;
// Schedule all waiting file loads.
- for (size_t i = 0; i < record->waiting_on_me.size(); i++) {
- ScheduleLoadFile(&record->settings, record->waiting_on_me[i].origin,
- record->waiting_on_me[i].file);
- }
+ for (const auto& waiting : record->waiting_on_me)
+ ScheduleLoadFile(&record->settings, waiting.origin, waiting.file);
record->waiting_on_me.clear();
DecrementPendingLoads();
« no previous file with comments | « tools/gn/input_file_manager.cc ('k') | tools/gn/loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698