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

Unified Diff: cc/tile_manager.cc

Issue 11421171: cc: Add experimental --num-raster-threads option. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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 | « cc/switches.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tile_manager.cc
diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
index cec7123e84451b2dfbd910ffd744b9edfc917828..5eface4e7d9bfc6fa4e6fdadcd503ed2f02d368e 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -7,12 +7,15 @@
#include <algorithm>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
+#include "base/string_number_conversions.h"
#include "base/threading/sequenced_worker_pool.h"
#include "cc/platform_color.h"
#include "cc/rendering_stats.h"
#include "cc/resource_pool.h"
+#include "cc/switches.h"
#include "cc/tile.h"
#include "third_party/skia/include/core/SkDevice.h"
@@ -33,7 +36,8 @@ void RasterizeTile(cc::PicturePileImpl* picture_pile,
picture_pile->Raster(&canvas, rect, stats);
}
-const int kMaxRasterThreads = 1;
+const int kMaxRasterThreads = 64;
+const int kDefaultNumberOfRasterThreads = 1;
const char* kRasterThreadNamePrefix = "CompositorRaster";
@@ -64,9 +68,23 @@ TileManager::TileManager(
resource_pool_(ResourcePool::Create(resource_provider,
Renderer::ImplPool)),
manage_tiles_pending_(false),
- pending_raster_tasks_(0),
- worker_pool_(new base::SequencedWorkerPool(kMaxRasterThreads,
- kRasterThreadNamePrefix)) {
+ pending_raster_tasks_(0) {
+ size_t worker_threads = kDefaultNumberOfRasterThreads;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
enne (OOO) 2012/12/03 17:47:42 Given that ubercompositor may want to set properti
+ cc::switches::kNumRasterThreads)) {
+ std::string num_raster_threads =
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ cc::switches::kNumRasterThreads);
+ int num_threads;
+ if (base::StringToInt(num_raster_threads, &num_threads) &&
+ num_threads > 0 && num_threads <= kMaxRasterThreads) {
+ worker_threads = num_threads;
+ } else {
+ LOG(WARNING) << "Bad number of raster threads: " << num_raster_threads;
+ }
+ }
+ worker_pool_ = new base::SequencedWorkerPool(worker_threads,
+ kRasterThreadNamePrefix);
}
TileManager::~TileManager() {
« no previous file with comments | « cc/switches.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698