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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 294163009: cc: Expand invalidation to full tile when recording is missing for the tile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | cc/resources/picture_pile_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 250dafa34eac9f2ed6d7846e18f102e5797c3352..e3b18e0e06aed1a0792e5b019746c7cfe7c37f45 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -653,6 +653,7 @@ gfx::Size PictureLayerImpl::CalculateTileSize(
}
void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
+ TRACE_EVENT0("cc", "SyncFromActiveLayer");
DCHECK(!other->needs_post_commit_initialization_);
DCHECK(other->tilings_);
@@ -669,22 +670,25 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
raster_contents_scale_ = other->raster_contents_scale_;
low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_;
- // Add synthetic invalidations for any recordings that were dropped. As
- // tiles are updated to point to this new pile, this will force the dropping
- // of tiles that can no longer be rastered. This is not ideal, but is a
- // trade-off for memory (use the same pile as much as possible, by switching
- // during DidBecomeActive) and for time (don't bother checking every tile
- // during activation to see if the new pile can still raster it).
- for (int x = 0; x < pile_->num_tiles_x(); ++x) {
- for (int y = 0; y < pile_->num_tiles_y(); ++y) {
- bool previously_had = other->pile_->HasRecordingAt(x, y);
- bool now_has = pile_->HasRecordingAt(x, y);
- if (now_has || !previously_had)
- continue;
- gfx::Rect layer_rect = pile_->tile_bounds(x, y);
- invalidation_.Union(layer_rect);
- }
- }
+ // Add synthetic invalidations to drop tiles from the active twin's tiling
+ // that we may not have recordings for. As tiles are updated to point to this
+ // new pile, this will force the dropping of tiles that can no longer be
+ // rastered.
+ // This is not ideal, as our pile may be able to raster the tiles, but
+ // checking this is expensive.
+ // 1. To find all the recorded pile tiles and build a region is more costly
+ // (up to 5-6x more costly in some experiments).
+ // 2. To check every raster tile and verify that the pile can record it before
+ // we activate and drop the active pile is much more expensive.
+ // 3. But we want to use the same pile for all of the tilings to avoid having
+ // to keep around old piles of recordings.
+ // This causes tiles outside the recorded viewport to be always dropped, but
+ // we expect these to be far from the viewport, since they were outside of the
+ // recording interest rect, so re-rastering those tiles is the tradeoff for
+ // speed here.
+ Region outside_recorded_viewport = Region(pile_->tiling_rect());
+ outside_recorded_viewport.Subtract(pile_->recorded_viewport());
+ invalidation_.Union(outside_recorded_viewport);
enne (OOO) 2014/05/27 21:09:22 There's a performance bug here. As the comment on
// Union in the other newly exposed regions as invalid.
Region difference_region = Region(gfx::Rect(bounds()));
« no previous file with comments | « no previous file | cc/resources/picture_pile_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698