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

Unified Diff: cc/tile_manager.cc

Issue 12194015: cc: Rasterize cheap tiles immediately (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 7 years, 10 months 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
« cc/tile_manager.h ('K') | « 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 9935de5d2e84e1a130b685ac8ef0864213a46ae0..6bf77891194720b556f794c2668388f02d6c840c 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -115,7 +115,8 @@ TileManager::TileManager(
TileManagerClient* client,
ResourceProvider* resource_provider,
size_t num_raster_threads,
- bool record_rendering_stats)
+ bool record_rendering_stats,
+ bool use_cheapness_estimator)
: client_(client),
resource_pool_(ResourcePool::Create(resource_provider)),
raster_worker_pool_(RasterWorkerPool::Create(num_raster_threads, record_rendering_stats)),
@@ -123,7 +124,8 @@ TileManager::TileManager(
manage_tiles_call_count_(0),
bytes_pending_set_pixels_(0),
ever_exceeded_memory_budget_(false),
- record_rendering_stats_(record_rendering_stats) {
+ record_rendering_stats_(record_rendering_stats),
+ use_cheapness_estimator_(use_cheapness_estimator) {
for (int i = 0; i < NUM_STATES; ++i) {
for (int j = 0; j < NUM_TREES; ++j) {
for (int k = 0; k < NUM_BINS; ++k)
@@ -647,6 +649,20 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) {
ResourceProvider::ResourceId resource_id = resource->id();
+ if (use_cheapness_estimator_ &&
+ tile->picture_pile()->IsCheapInRect(tile->content_rect_,
+ tile->contents_scale())) {
+ RunRasterTask(resource_pool_->resource_provider()->mapPixelBuffer(
Sami 2013/02/04 13:37:48 Just checking: do I need to clone the picture for
vangelis 2013/02/04 22:33:50 You're already on the impl thread here. It doesn't
reveman 2013/02/04 22:53:24 You shouldn't need that. All other threads possibl
+ resource_id),
+ tile->content_rect_,
+ tile->contents_scale(),
+ tile->picture_pile(),
+ &rendering_stats_);
+ TileManager::OnRasterTaskCompleted(tile, resource.Pass(),
reveman 2013/02/04 22:53:24 nit: TileManager:: is unnecessary.
Sami 2013/02/05 12:26:23 Done.
+ manage_tiles_call_count_);
+ return;
+ }
reveman 2013/02/04 22:53:24 I don't think all this belongs in DispatchOneRaste
Sami 2013/02/05 12:26:23 Agreed, it is a little misleading. I've now split
+
raster_worker_pool_->PostRasterTaskAndReply(
tile->picture_pile(),
base::Bind(&TileManager::RunRasterTask,
@@ -654,7 +670,7 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) {
resource_id),
tile->content_rect_,
tile->contents_scale()),
- base::Bind(&TileManager::OnRasterTaskCompleted,
+ base::Bind(&TileManager::OnRasterTaskCompletedByWorker,
base::Unretained(this),
tile,
base::Passed(&resource),
@@ -706,7 +722,14 @@ void TileManager::OnRasterTaskCompleted(
managed_tile_state.resource_is_being_initialized = false;
DidTileRasterStateChange(tile, IDLE_STATE);
}
+}
+void TileManager::OnRasterTaskCompletedByWorker(
+ scoped_refptr<Tile> tile,
+ scoped_ptr<ResourcePool::Resource> resource,
+ int manage_tiles_call_count_when_dispatched) {
+ OnRasterTaskCompleted(tile, resource.Pass(),
vangelis 2013/02/04 22:33:50 In the "cheap tile" case, don't you still need to
+ manage_tiles_call_count_when_dispatched);
DispatchMoreTasks();
}
« cc/tile_manager.h ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698