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

Side by Side Diff: tools/gn/setup.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, 2 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 unified diff | Download patch
« no previous file with comments | « tools/gn/scope.cc ('k') | tools/gn/standard_out.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/setup.h" 5 #include "tools/gn/setup.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <sstream> 10 #include <sstream>
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // Save the result of the command args. 344 // Save the result of the command args.
345 Scope::KeyValueMap overrides; 345 Scope::KeyValueMap overrides;
346 arg_scope.GetCurrentScopeValues(&overrides); 346 arg_scope.GetCurrentScopeValues(&overrides);
347 build_settings_.build_args().AddArgOverrides(overrides); 347 build_settings_.build_args().AddArgOverrides(overrides);
348 return true; 348 return true;
349 } 349 }
350 350
351 bool Setup::SaveArgsToFile() { 351 bool Setup::SaveArgsToFile() {
352 ScopedTrace setup_trace(TraceItem::TRACE_SETUP, "Save args file"); 352 ScopedTrace setup_trace(TraceItem::TRACE_SETUP, "Save args file");
353 353
354 Scope::KeyValueMap args = build_settings_.build_args().GetAllOverrides();
355
356 std::ostringstream stream; 354 std::ostringstream stream;
357 for (Scope::KeyValueMap::const_iterator i = args.begin(); 355 for (const auto& pair : build_settings_.build_args().GetAllOverrides()) {
358 i != args.end(); ++i) { 356 stream << pair.first.as_string() << " = " << pair.second.ToString(true);
359 stream << i->first.as_string() << " = " << i->second.ToString(true);
360 stream << std::endl; 357 stream << std::endl;
361 } 358 }
362 359
363 // For the first run, the build output dir might not be created yet, so do 360 // For the first run, the build output dir might not be created yet, so do
364 // that so we can write a file into it. Ignore errors, we'll catch the error 361 // that so we can write a file into it. Ignore errors, we'll catch the error
365 // when we try to write a file to it below. 362 // when we try to write a file to it below.
366 base::FilePath build_arg_file = 363 base::FilePath build_arg_file =
367 build_settings_.GetFullPath(GetBuildArgFile()); 364 build_settings_.GetFullPath(GetBuildArgFile());
368 base::CreateDirectory(build_arg_file.DirName()); 365 base::CreateDirectory(build_arg_file.DirName());
369 366
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 604 }
608 605
609 void DependentSetup::RunPreMessageLoop() { 606 void DependentSetup::RunPreMessageLoop() {
610 CommonSetup::RunPreMessageLoop(); 607 CommonSetup::RunPreMessageLoop();
611 } 608 }
612 609
613 bool DependentSetup::RunPostMessageLoop() { 610 bool DependentSetup::RunPostMessageLoop() {
614 return CommonSetup::RunPostMessageLoop(); 611 return CommonSetup::RunPostMessageLoop();
615 } 612 }
616 613
OLDNEW
« no previous file with comments | « tools/gn/scope.cc ('k') | tools/gn/standard_out.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698