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

Side by Side Diff: tools/gn/gn_main.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/function_write_file.cc ('k') | tools/gn/header_checker.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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "tools/gn/commands.h" 8 #include "tools/gn/commands.h"
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 #include "tools/gn/location.h" 10 #include "tools/gn/location.h"
11 #include "tools/gn/standard_out.h" 11 #include "tools/gn/standard_out.h"
12 12
13 // Only the GN-generated build makes this header for now. 13 // Only the GN-generated build makes this header for now.
14 // TODO(brettw) consider adding this if we need it in GYP. 14 // TODO(brettw) consider adding this if we need it in GYP.
15 #if defined(GN_BUILD) 15 #if defined(GN_BUILD)
16 #include "tools/gn/last_commit_position.h" 16 #include "tools/gn/last_commit_position.h"
17 #else 17 #else
18 #define LAST_COMMIT_POSITION "UNKNOWN" 18 #define LAST_COMMIT_POSITION "UNKNOWN"
19 #endif 19 #endif
20 20
21 namespace { 21 namespace {
22 22
23 std::vector<std::string> GetArgs(const CommandLine& cmdline) { 23 std::vector<std::string> GetArgs(const CommandLine& cmdline) {
24 CommandLine::StringVector in_args = cmdline.GetArgs(); 24 CommandLine::StringVector in_args = cmdline.GetArgs();
25 #if defined(OS_WIN) 25 #if defined(OS_WIN)
26 std::vector<std::string> out_args; 26 std::vector<std::string> out_args;
27 for (size_t i = 0; i < in_args.size(); i++) 27 for (const auto& arg : in_args)
28 out_args.push_back(base::WideToUTF8(in_args[i])); 28 out_args.push_back(base::WideToUTF8(arg));
29 return out_args; 29 return out_args;
30 #else 30 #else
31 return in_args; 31 return in_args;
32 #endif 32 #endif
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 int main(int argc, char** argv) { 37 int main(int argc, char** argv) {
38 base::AtExitManager at_exit; 38 base::AtExitManager at_exit;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 retval = found_command->second.runner(args); 72 retval = found_command->second.runner(args);
73 } else { 73 } else {
74 Err(Location(), 74 Err(Location(),
75 "Command \"" + command + "\" unknown.").PrintToStdout(); 75 "Command \"" + command + "\" unknown.").PrintToStdout();
76 commands::RunHelp(std::vector<std::string>()); 76 commands::RunHelp(std::vector<std::string>());
77 retval = 1; 77 retval = 1;
78 } 78 }
79 79
80 exit(retval); // Don't free memory, it can be really slow! 80 exit(retval); // Don't free memory, it can be really slow!
81 } 81 }
OLDNEW
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/header_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698