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

Unified Diff: cc/tile_manager.cc

Issue 11316333: cc: Move --num-raster-threads setting to LayerTreeSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/tile_manager.h ('k') | no next file » | 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 5eface4e7d9bfc6fa4e6fdadcd503ed2f02d368e..65253c496f223e3976f260ec7323a68c8f6cec39 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -10,7 +10,6 @@
#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"
@@ -36,9 +35,6 @@ void RasterizeTile(cc::PicturePileImpl* picture_pile,
picture_pile->Raster(&canvas, rect, stats);
}
-const int kMaxRasterThreads = 64;
-const int kDefaultNumberOfRasterThreads = 1;
-
const char* kRasterThreadNamePrefix = "CompositorRaster";
// Allow two pending raster tasks per thread. This keeps resource usage
@@ -63,28 +59,17 @@ ManagedTileState::~ManagedTileState() {
}
TileManager::TileManager(
- TileManagerClient* client, ResourceProvider* resource_provider)
+ TileManagerClient* client,
+ ResourceProvider* resource_provider,
+ size_t num_raster_threads)
: client_(client),
resource_pool_(ResourcePool::Create(resource_provider,
Renderer::ImplPool)),
manage_tiles_pending_(false),
- pending_raster_tasks_(0) {
- size_t worker_threads = kDefaultNumberOfRasterThreads;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- 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);
+ pending_raster_tasks_(0),
+ num_raster_threads_(num_raster_threads),
+ worker_pool_(new base::SequencedWorkerPool(num_raster_threads,
+ kRasterThreadNamePrefix)) {
}
TileManager::~TileManager() {
@@ -302,7 +287,7 @@ void TileManager::FreeResourcesForTile(Tile* tile) {
void TileManager::DispatchMoreRasterTasks() {
while (!tiles_that_need_to_be_rasterized_.empty()) {
int max_pending_tasks = kNumPendingRasterTasksPerThread *
- kMaxRasterThreads;
+ num_raster_threads_;
// Stop dispatching raster tasks when too many are pending.
if (pending_raster_tasks_ >= max_pending_tasks)
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698