Index: content/browser/gpu/compositor_util.cc |
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc |
index a96cdeae4138e43adcfdccc3760e963dc2cce6a9..55bb0646ac5b4a52245807064263ed7623ed9a93 100644 |
--- a/content/browser/gpu/compositor_util.cc |
+++ b/content/browser/gpu/compositor_util.cc |
@@ -10,6 +10,7 @@ |
#include "base/strings/string_number_conversions.h" |
#include "base/sys_info.h" |
#include "build/build_config.h" |
+#include "cc/base/math_util.h" |
#include "cc/base/switches.h" |
#include "content/browser/gpu/gpu_data_manager_impl.h" |
#include "content/public/common/content_switches.h" |
@@ -210,14 +211,17 @@ bool IsImplSidePaintingEnabled() { |
} |
int NumberOfRendererRasterThreads() { |
- int num_raster_threads = 1; |
- |
- // Async uploads uses its own thread, so allow an extra thread when async |
- // uploads is not in use. |
- bool allow_extra_thread = |
+ int num_raster_threads = cc::MathUtil::ClampToRange( |
+ base::SysInfo::NumberOfProcessors() / 2, |
+ kMinRasterThreads, kMaxRasterThreads); |
danakj
2015/05/13 20:01:23
nit: how about do the computation for a number her
reveman
2015/05/13 20:24:35
I did that first but didn't like it as it's alread
|
+ |
+ // Async uploads is used when neither zero-copy nor one-copy is enabled and |
+ // it uses its own thread, so reduce the number of raster threads when async |
+ // uploads is in use. |
+ bool async_uploads_is_used = |
IsZeroCopyUploadEnabled() || IsOneCopyUploadEnabled(); |
- if (base::SysInfo::NumberOfProcessors() >= 4 && allow_extra_thread) |
- num_raster_threads = 2; |
+ if (async_uploads_is_used) |
+ num_raster_threads = std::max(kMinRasterThreads, num_raster_threads - 1); |
int force_num_raster_threads = ForceNumberOfRendererRasterThreads(); |
if (force_num_raster_threads) |