 Chromium Code Reviews
 Chromium Code Reviews Issue 73923003:
  Shared Raster Worker Threads  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 73923003:
  Shared Raster Worker Threads  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: content/renderer/render_thread_impl.cc | 
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc | 
| old mode 100644 | 
| new mode 100755 | 
| index 93e41b706e71251c34aa2e60ccdcffe7ffa8699a..1941985b7d6f179f32b4baff39ff6cdf7a70cb04 | 
| --- a/content/renderer/render_thread_impl.cc | 
| +++ b/content/renderer/render_thread_impl.cc | 
| @@ -22,10 +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/raster_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" | 
| @@ -157,6 +160,9 @@ 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; | 
| +const int kDefaultNumRasterThreads = 1; | 
| // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access | 
| // incorrectly from the wrong thread. | 
| @@ -407,6 +413,20 @@ void RenderThreadImpl::Init() { | 
| // it doesn't have to be the same thread RenderThreadImpl is created on. | 
| allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); | 
| + int num_raster_threads = kDefaultNumRasterThreads; | 
| + if (command_line.HasSwitch(cc::switches::kNumRasterThreads)) { | 
| + int num_threads; | 
| + std::string string_value = | 
| + command_line.GetSwitchValueASCII(cc::switches::kNumRasterThreads); | 
| + if (base::StringToInt(string_value, &num_threads) && | 
| + num_threads >= kMinRasterThreads && num_threads <= kMaxRasterThreads) | 
| + num_raster_threads = num_threads; | 
| + else | 
| + LOG(WARNING) << "Failed to parse switch " << | 
| + cc::switches::kNumRasterThreads << ": " << string_value; | 
| 
reveman
2014/01/07 17:24:06
nit: multiple line "else". please use "{" "}" for
 
sohanjg
2014/01/08 05:55:43
Done.
 | 
| + } | 
| + cc::RasterWorkerPool::SetNumRasterThreads(num_raster_threads); | 
| + | 
| TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 
| } |