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

Side by Side Diff: tools/gn/scheduler.cc

Issue 819223002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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/ninja_build_writer.cc ('k') | tools/gn/setup.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/scheduler.h" 5 #include "tools/gn/scheduler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "tools/gn/standard_out.h" 10 #include "tools/gn/standard_out.h"
11 #include "tools/gn/switches.h" 11 #include "tools/gn/switches.h"
12 12
13 Scheduler* g_scheduler = NULL; 13 Scheduler* g_scheduler = NULL;
14 14
15 namespace { 15 namespace {
16 16
17 int GetThreadCount() { 17 int GetThreadCount() {
18 std::string thread_count = 18 std::string thread_count =
19 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kThreads); 19 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
20 switches::kThreads);
20 21
21 int result; 22 int result;
22 if (thread_count.empty() || !base::StringToInt(thread_count, &result)) 23 if (thread_count.empty() || !base::StringToInt(thread_count, &result))
23 return 32; 24 return 32;
24 return result; 25 return result;
25 } 26 }
26 27
27 } // namespace 28 } // namespace
28 29
29 Scheduler::Scheduler() 30 Scheduler::Scheduler()
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void Scheduler::DoWork(const base::Closure& closure) { 138 void Scheduler::DoWork(const base::Closure& closure) {
138 closure.Run(); 139 closure.Run();
139 DecrementWorkCount(); 140 DecrementWorkCount();
140 } 141 }
141 142
142 void Scheduler::OnComplete() { 143 void Scheduler::OnComplete() {
143 // Should be called on the main thread. 144 // Should be called on the main thread.
144 DCHECK(base::MessageLoop::current() == main_loop()); 145 DCHECK(base::MessageLoop::current() == main_loop());
145 runner_.Quit(); 146 runner_.Quit();
146 } 147 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_build_writer.cc ('k') | tools/gn/setup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698