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

Unified 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 - realigning code to get number of raster threads + nits Created 7 years 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 side-by-side diff with in-line comments
Download patch
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..38f1426b4c9ae684404b2d565418194e025278b1
--- 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 {
@@ -186,6 +187,25 @@ 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();
+ int num_threads = kDefaultNumRasterThreads;
reveman 2013/12/28 14:45:48 Please move this just above the "base::StringToInt
sohanjg 2013/12/30 06:49:36 Done.
+ if (command_line.HasSwitch(switches::kNumRasterThreads)) {
+ std::string string_value =
+ command_line.GetSwitchValueASCII(switches::kNumRasterThreads);
+ if ((base::StringToInt(string_value, &num_threads) &&
+ num_threads >= kMinRasterThreads && num_threads <= kMaxRasterThreads))
+ return num_threads;
reveman 2013/12/28 14:45:48 nit: this line should be indented 2 spaces, not 4
sohanjg 2013/12/30 06:49:36 Done.
+ LOG(WARNING) << "Failed to parse switch " <<
reveman 2013/12/28 14:45:48 nit: maybe add a blank line between this and the a
sohanjg 2013/12/30 06:49:36 Done.
+ switches::kNumRasterThreads << ": " << string_value;
+ }
+ return num_threads;
reveman 2013/12/28 14:45:48 nit: return kDefaultNumRasterThreads here instead
sohanjg 2013/12/30 06:49:36 Done.
+}
+
} // namespace
bool IsImplSidePaintingEnabled() {
@@ -209,5 +229,10 @@ bool IsMapImageEnabled() {
return false;
}
+size_t GetNumRasterThreads() {
+ static size_t num_raster_threads = CheckNumRasterThreads();
reveman 2013/12/28 14:45:48 FYI, you'll have to update this if https://coderev
sohanjg 2013/12/30 06:49:36 OK.will take care of it, if that happens.
+ return num_raster_threads;
+}
+
} // namespace switches
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698