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

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: Rebased. 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
« 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 16d82d46a8a885052d1549bf4749c73e9d1e50f9..37c25814a78e36fb3011077a5df71179ab020545 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -552,7 +552,7 @@ void TileManager::FreeResourcesForTile(Tile* tile) {
resource_pool_->ReleaseResource(managed_tile_state.resource.Pass());
}
-bool TileManager::CanDispatchRasterTask(Tile* tile) {
+bool TileManager::CanDispatchRasterTask(Tile* tile) const {
if (raster_worker_pool_->IsBusy())
return false;
size_t new_bytes_pending = bytes_pending_set_pixels_;
@@ -560,6 +560,19 @@ bool TileManager::CanDispatchRasterTask(Tile* tile) {
return new_bytes_pending <= kMaxPendingUploadBytes;
}
+bool TileManager::CanPerformCheapRaster(Tile* tile) const {
+ if (!use_cheapness_estimator_ || !client_->CanDoAnotherCheapRaster())
+ return false;
+ ManagedTileState& managed_state = tile->managed_state();
+ DCHECK(managed_state.pending_pixel_refs.empty());
+ size_t new_bytes_pending = bytes_pending_set_pixels_;
+ new_bytes_pending += tile->bytes_consumed_if_allocated();
+ if (new_bytes_pending > kMaxPendingUploadBytes)
+ return false;
+ return tile->picture_pile()->IsCheapInRect(tile->content_rect_,
+ tile->contents_scale());
+}
+
void TileManager::DispatchMoreTasks() {
// Because tiles in the image decoding list have higher priorities, we
// need to process those tiles first before we start to handle the tiles
@@ -569,9 +582,13 @@ void TileManager::DispatchMoreTasks() {
DispatchImageDecodeTasksForTile(*it);
ManagedTileState& managed_state = (*it)->managed_state();
if (managed_state.pending_pixel_refs.empty()) {
- if (!CanDispatchRasterTask(*it))
- return;
- DispatchOneRasterTask(*it);
+ if (CanPerformCheapRaster(*it)) {
+ PerformOneCheapRaster(*it);
+ } else {
+ if (!CanDispatchRasterTask(*it))
+ return;
+ DispatchOneRasterTask(*it);
+ }
tiles_with_image_decoding_tasks_.erase(it++);
} else {
++it;
@@ -586,6 +603,8 @@ void TileManager::DispatchMoreTasks() {
ManagedTileState& managed_state = tile->managed_state();
if (!managed_state.pending_pixel_refs.empty()) {
tiles_with_image_decoding_tasks_.push_back(tile);
+ } else if (CanPerformCheapRaster(tile)) {
+ PerformOneCheapRaster(tile);
nduca 2013/02/13 07:17:56 So how about doign this... you can save all the in
} else {
if (!CanDispatchRasterTask(tile))
return;
@@ -648,7 +667,7 @@ void TileManager::DispatchOneImageDecodeTask(
pending_decode_tasks_[pixel_ref_id] = pixel_ref;
raster_worker_pool_->PostTaskAndReply(
- base::Bind(&TileManager::RunImageDecodeTask, pixel_ref),
+ base::Bind(&TileManager::PerformImageDecode, pixel_ref),
base::Bind(&TileManager::OnImageDecodeTaskCompleted,
base::Unretained(this),
tile,
@@ -711,7 +730,8 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) {
manage_tiles_call_count_));
}
-void TileManager::PerformOneRaster(Tile* tile) {
+void TileManager::PerformOneCheapRaster(Tile* tile) {
+ DCHECK(use_cheapness_estimator_);
scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile);
ResourceProvider::ResourceId resource_id = resource->id();
@@ -722,8 +742,8 @@ void TileManager::PerformOneRaster(Tile* tile) {
use_cheapness_estimator_,
tile->picture_pile(),
&rendering_stats_);
-
OnRasterCompleted(tile, resource.Pass(), manage_tiles_call_count_);
+ client_->DidPerformCheapRaster();
}
void TileManager::OnRasterCompleted(
@@ -857,7 +877,7 @@ void TileManager::PerformRaster(uint8* buffer,
10);
if (use_cheapness_estimator) {
- bool is_predicted_cheap = picture_pile->IsCheapInRect (rect, contents_scale);
+ bool is_predicted_cheap = picture_pile->IsCheapInRect(rect, contents_scale);
bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f;
RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap);
}
@@ -877,9 +897,9 @@ void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap,
}
// static
-void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref,
+void TileManager::PerformImageDecode(skia::LazyPixelRef* pixel_ref,
RenderingStats* stats) {
- TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask");
+ TRACE_EVENT0("cc", "TileManager::PerformImageDecode");
base::TimeTicks decode_begin_time;
if (stats)
decode_begin_time = base::TimeTicks::Now();
« 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