Chromium Code Reviews| Index: cc/base/switches.cc |
| diff --git a/cc/base/switches.cc b/cc/base/switches.cc |
| old mode 100644 |
| new mode 100755 |
| index ddba9cbd4449b52cb8edd870a77dccc45faafb35..05c0d812aefaf784dc1ea5349e76f4f16540d71a |
| --- a/cc/base/switches.cc |
| +++ b/cc/base/switches.cc |
| @@ -5,6 +5,8 @@ |
| #include "cc/base/switches.h" |
| #include "base/command_line.h" |
| +#include "base/logging.h" |
| +#include "base/strings/string_number_conversions.h" |
| namespace cc { |
| namespace switches { |
| @@ -186,6 +188,26 @@ bool CheckGPURasterizationStatus() { |
| return command_line.HasSwitch(switches::kEnableGPURasterization); |
| } |
| +size_t CheckNumRasterThreads() { |
| + const int kMinRasterThreads = 1; |
| + const int kMaxRasterThreads = 64; |
| + const int kDefaultNumRasterThreads = 1; |
| + |
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + if (command_line.HasSwitch(switches::kNumRasterThreads)) { |
| + std::string string_value = |
| + command_line.GetSwitchValueASCII(switches::kNumRasterThreads); |
| + int num_threads = kDefaultNumRasterThreads; |
| + if ((base::StringToInt(string_value, &num_threads) && |
|
reveman
2013/12/30 08:57:06
just "(" instead of "(("
sohanjg
2013/12/30 09:18:55
Done.
|
| + num_threads >= kMinRasterThreads && num_threads <= kMaxRasterThreads)) |
|
reveman
2013/12/30 08:57:06
just ")" instead of "))"
sohanjg
2013/12/30 09:18:55
Done.
|
| + return num_threads; |
| + |
| + LOG(WARNING) << "Failed to parse switch " << |
| + switches::kNumRasterThreads << ": " << string_value; |
| + } |
| + return kDefaultNumRasterThreads; |
| +} |
| + |
| } // namespace |
| bool IsImplSidePaintingEnabled() { |
| @@ -209,5 +231,10 @@ bool IsMapImageEnabled() { |
| return false; |
| } |
| +size_t GetNumRasterThreads() { |
| + static size_t num_raster_threads = CheckNumRasterThreads(); |
| + return num_raster_threads; |
| +} |
| + |
| } // namespace switches |
| } // namespace cc |