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

Unified Diff: cc/picture_layer_impl.cc

Issue 12335079: cc: Add synthetic invalidations for dropped recordings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_impl.cc
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index d950bec4a599da09c5e0abbba6dc197d9fbb7933..f0faf056b8b9e4bca5ae8b71106702c7e3891003 100644
--- a/cc/picture_layer_impl.cc
+++ b/cc/picture_layer_impl.cc
@@ -411,15 +411,33 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
raster_device_scale_ = other->raster_device_scale_;
raster_source_scale_ = other->raster_source_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).
+ //
+ // TODO(enne): Clean up this double loop.
+ 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);
+ }
+ }
+
+
tilings_->CloneAll(*other->tilings_, invalidation_);
DCHECK(bounds() == tilings_->LayerBounds());
// It's a sad but unfortunate fact that PicturePile tiling edges do not line
// up with PictureLayerTiling edges. Tiles can only be added if they are
// entirely covered by recordings (that may come from multiple PicturePile
- // tiles). This check happens in this class's CreateTile() call. Tiles
- // are not removed (even if they cannot be rerecorded) unless they are
- // invalidated.
+ // tiles). This check happens in this class's CreateTile() call.
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698