Commit 877f63ff authored by reveman@chromium.org's avatar reveman@chromium.org

cc: Add experimental --num-raster-threads option.

Makes it possible to specify the number of worker threads used to
rasterize content.
    
BUG=154637
TEST=manual
TBR=sky@chromium.org

Review URL: https://chromiumcodereview.appspot.com/11421171

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170655 0039d316-1c4b-4281-b951-d872f2087c98
parent a0d16786
......@@ -25,6 +25,9 @@ const char kEnablePerTilePainting[] = "enable-per-tile-painting";
// compositor.
const char kEnablePinchInCompositor[] = "enable-pinch-in-compositor";
// Number of worker threads used to rasterize content.
const char kNumRasterThreads[] = "num-raster-threads";
// Show rects in the HUD around layers whose properties have changed.
const char kShowPropertyChangedRects[] = "show-property-changed-rects";
......
......@@ -22,6 +22,7 @@ CC_EXPORT extern const char kEnablePartialSwap[];
CC_EXPORT extern const char kEnablePerTilePainting[];
CC_EXPORT extern const char kEnablePinchInCompositor[];
CC_EXPORT extern const char kJankInsteadOfCheckerboard[];
CC_EXPORT extern const char kNumRasterThreads[];
CC_EXPORT extern const char kShowPropertyChangedRects[];
CC_EXPORT extern const char kShowSurfaceDamageRects[];
CC_EXPORT extern const char kShowScreenSpaceRects[];
......
......@@ -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(
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() {
......
......@@ -837,6 +837,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
cc::switches::kBackgroundColorInsteadOfCheckerboard,
cc::switches::kEnableImplSidePainting,
cc::switches::kEnablePartialSwap,
cc::switches::kNumRasterThreads,
cc::switches::kShowPropertyChangedRects,
cc::switches::kShowSurfaceDamageRects,
cc::switches::kShowScreenSpaceRects,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment