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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 73923003: Shared Raster Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build Error for Mac, macro conflict, moving setter to WorkerPool. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 01fc0eff9c94d4493413d2be132e958cd2ec89b9..bf37dc2c1b3d28ea56d911a14cbd2cabe7add338 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -22,11 +22,13 @@
#include "base/path_service.h"
#include "base/strings/string16.h"
#include "base/strings/string_tokenizer.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_local.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "cc/base/switches.h"
+#include "cc/resources/worker_pool.h"
#include "content/child/appcache/appcache_dispatcher.h"
#include "content/child/appcache/appcache_frontend_impl.h"
#include "content/child/child_histogram_message_filter.h"
@@ -159,6 +161,8 @@ const int64 kInitialIdleHandlerDelayMs = 1000;
const int64 kShortIdleHandlerDelayMs = 1000;
const int64 kLongIdleHandlerDelayMs = 30*1000;
const int kIdleCPUUsageThresholdInPercents = 3;
+const int kMinRasterThreads = 1;
+const int kMaxRasterThreads = 64;
// Keep the global RenderThreadImpl in a TLS slot so it is impossible to access
// incorrectly from the wrong thread.
@@ -438,6 +442,20 @@ void RenderThreadImpl::Init() {
// it doesn't have to be the same thread RenderThreadImpl is created on.
allocate_gpu_memory_buffer_thread_checker_.DetachFromThread();
+ if (command_line.HasSwitch(cc::switches::kNumRasterThreads)) {
+ int num_raster_threads;
+ std::string string_value =
+ command_line.GetSwitchValueASCII(cc::switches::kNumRasterThreads);
+ if (base::StringToInt(string_value, &num_raster_threads) &&
+ num_raster_threads >= kMinRasterThreads &&
+ num_raster_threads <= kMaxRasterThreads) {
+ cc::WorkerPool::SetNumRasterThreads(num_raster_threads);
+ } else {
+ LOG(WARNING) << "Failed to parse switch " <<
+ cc::switches::kNumRasterThreads << ": " << string_value;
+ }
+ }
+
TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, "");
}
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698