Chromium Code Reviews| 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..ac001dfc4f599b90ae99a3006ba0327aee714058 |
| --- 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" |
| @@ -139,6 +142,7 @@ |
| #include "content/renderer/npapi/plugin_channel_host.h" |
| #endif |
| + |
|
reveman
2014/01/06 20:01:35
we don't need this blank line
sohanjg
2014/01/07 08:35:23
Done.
|
| using base::ThreadRestrictions; |
| using blink::WebDocument; |
| using blink::WebFrame; |
| @@ -157,6 +161,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 +414,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; |
| + |
| + LOG(WARNING) << "Failed to parse switch " << |
| + cc::switches::kNumRasterThreads << ": " << string_value; |
|
reveman
2014/01/06 20:01:35
you're always printing this warning. even when the
sohanjg
2014/01/07 08:35:23
Done.
|
| + } |
| + cc::RasterWorkerPool::SetNumRasterThreads(num_raster_threads); |
| + |
| TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
| } |