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

Side by Side Diff: cc/base/switches.cc

Issue 73923003: Shared Raster Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WIP - make API to retrieve number of raster threads consistent + nits Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "cc/base/switches.h" 5 #include "cc/base/switches.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h"
8 9
9 namespace cc { 10 namespace cc {
10 namespace switches { 11 namespace switches {
11 12
12 // On platforms where checkerboards are used, prefer background colors instead 13 // On platforms where checkerboards are used, prefer background colors instead
13 // of checkerboards. 14 // of checkerboards.
14 const char kBackgroundColorInsteadOfCheckerboard[] = 15 const char kBackgroundColorInsteadOfCheckerboard[] =
15 "background-color-instead-of-checkerboard"; 16 "background-color-instead-of-checkerboard";
16 17
17 // Disables LCD text. 18 // Disables LCD text.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 203 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
203 204
204 if (command_line.HasSwitch(switches::kDisableMapImage)) 205 if (command_line.HasSwitch(switches::kDisableMapImage))
205 return false; 206 return false;
206 else if (command_line.HasSwitch(switches::kEnableMapImage)) 207 else if (command_line.HasSwitch(switches::kEnableMapImage))
207 return true; 208 return true;
208 209
209 return false; 210 return false;
210 } 211 }
211 212
213 size_t CheckNumRasterThreads() {
reveman 2013/12/27 14:57:13 move this function to anonymous namespace.
sohanjg 2013/12/28 09:15:17 Done.
214 const int kMinRasterThreads = 1;
215 const int kMaxRasterThreads = 64;
216 const int kDefaultNumRasterThreads = 1;
217
218 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
219 int num_threads = kDefaultNumRasterThreads;
220 if (command_line.HasSwitch(switches::kNumRasterThreads)) {
221 std::string string_value =
222 command_line.GetSwitchValueASCII(switches::kNumRasterThreads);
223 if (!(base::StringToInt(string_value, &num_threads) &&
224 num_threads >= kMinRasterThreads && num_threads <= kMaxRasterThreads)) {
reveman 2013/12/27 14:57:13 This is wrong. You're checking the value of num_th
sohanjg 2013/12/28 09:15:17 Done.
225 LOG(WARNING) << "Failed to parse switch " <<
226 switches::kNumRasterThreads << ": " << string_value;
227 num_threads = kDefaultNumRasterThreads;
228 }
229 }
230 return num_threads;
231 }
232
233 size_t GetNumRasterThreads() {
234 static size_t num_raster_threads = CheckNumRasterThreads();
235 return num_raster_threads;
236 }
212 } // namespace switches 237 } // namespace switches
213 } // namespace cc 238 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/switches.h ('k') | cc/layers/picture_layer.cc » ('j') | cc/resources/picture_pile.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698