Index: cc/base/switches.cc |
diff --git a/cc/base/switches.cc b/cc/base/switches.cc |
old mode 100644 |
new mode 100755 |
index be4a2c55adfbcb22214a0a92439f59da8fd112e2..5b9beb87033e015a711528ca6d7ee2c69a547dab |
--- a/cc/base/switches.cc |
+++ b/cc/base/switches.cc |
@@ -5,6 +5,7 @@ |
#include "cc/base/switches.h" |
#include "base/command_line.h" |
+#include "base/strings/string_number_conversions.h" |
namespace cc { |
namespace switches { |
@@ -198,5 +199,23 @@ bool IsMapImageEnabled() { |
return false; |
} |
+size_t GetNumRasterThreads() { |
+ const int kMinRasterThreads = 1; |
+ const int kMaxRasterThreads = 64; |
+ const int kDefaultNumRasterThreads = 1; |
+ |
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ if (command_line.HasSwitch(cc::switches::kNumRasterThreads)) { |
+ std::string string_value = |
+ command_line.GetSwitchValueASCII(cc::switches::kNumRasterThreads); |
+ int num_threads; |
+ base::StringToInt(string_value, &num_threads); |
+ return std::max(kMinRasterThreads, |
+ std::min(num_threads, kMaxRasterThreads)); |
+ } else { |
+ return kDefaultNumRasterThreads; |
+ } |
+} |
+ |
} // namespace switches |
} // namespace cc |