summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 00:52:21 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 00:52:21 +0000
commitec927b359384520cd79dc87d20483c6223e89557 (patch)
treed7708c3db71aa90180fbc49b3507605130dffc3b
parentb0470117cf90ec137a732704daa6b18addfd4c06 (diff)
downloadchromium_src-ec927b359384520cd79dc87d20483c6223e89557.zip
chromium_src-ec927b359384520cd79dc87d20483c6223e89557.tar.gz
chromium_src-ec927b359384520cd79dc87d20483c6223e89557.tar.bz2
cc: Remove invalidated recycle tree tiles on activation.
This patch is the first part of ensuring that recycle tree does not contain any unshared tiles. This is done by ensuring that we invalidate the soon to become recycled tiling while activating. BUG=393802 R=danakj Review URL: https://codereview.chromium.org/397303003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283951 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/layers/picture_layer_impl.cc18
-rw-r--r--cc/resources/picture_layer_tiling.cc18
-rw-r--r--cc/resources/picture_layer_tiling.h4
-rw-r--r--cc/resources/picture_layer_tiling_set.cc5
-rw-r--r--cc/resources/picture_layer_tiling_set.h2
5 files changed, 30 insertions, 17 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 02fb92f..4a7e0c0 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -108,6 +108,10 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) {
// Tilings would be expensive to push, so we swap.
layer_impl->tilings_.swap(tilings_);
+ // Remove invalidated tiles from what will become a recycle tree.
+ if (tilings_)
+ tilings_->RemoveTilesInRegion(invalidation_);
+
layer_impl->tilings_->SetClient(layer_impl);
if (tilings_)
tilings_->SetClient(this);
@@ -670,20 +674,10 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
raster_contents_scale_ = other->raster_contents_scale_;
low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_;
- // The tilings on this layer were swapped here from the active layer on
- // activation, so they have not seen the invalidation that was given to
- // the active layer. So union that invalidation in here, but don't save
- // it and pass it back to the active layer again.
- Region invalidation_from_pending_and_active =
- UnionRegions(invalidation_, other->invalidation_);
-
bool synced_high_res_tiling = false;
if (CanHaveTilings()) {
- synced_high_res_tiling =
- tilings_->SyncTilings(*other->tilings_,
- bounds(),
- invalidation_from_pending_and_active,
- MinimumContentsScale());
+ synced_high_res_tiling = tilings_->SyncTilings(
+ *other->tilings_, bounds(), invalidation_, MinimumContentsScale());
} else {
RemoveAllTilings();
}
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index a3b154b..fdfbad9 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -180,7 +180,18 @@ void PictureLayerTiling::UpdateTilesToCurrentPile(
it->second->set_picture_pile(pile);
}
+void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_region) {
+ bool recreate_invalidated_tiles = false;
+ DoInvalidate(layer_region, recreate_invalidated_tiles);
+}
+
void PictureLayerTiling::Invalidate(const Region& layer_region) {
+ bool recreate_invalidated_tiles = true;
+ DoInvalidate(layer_region, recreate_invalidated_tiles);
+}
+
+void PictureLayerTiling::DoInvalidate(const Region& layer_region,
+ bool recreate_invalidated_tiles) {
std::vector<TileMapKey> new_tile_keys;
gfx::Rect expanded_live_tiles_rect =
tiling_data_.ExpandRectIgnoringBordersToTileBoundsWithBorders(
@@ -208,14 +219,11 @@ void PictureLayerTiling::Invalidate(const Region& layer_region) {
}
}
- if (!new_tile_keys.empty()) {
- const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
+ if (recreate_invalidated_tiles && !new_tile_keys.empty()) {
for (size_t i = 0; i < new_tile_keys.size(); ++i) {
// Don't try to share a tile with the twin layer, it's been invalidated so
// we have to make our own tile here.
- // TODO(danakj): Because we have two frames of invalidation during sync
- // this isn't always true. When sync is gone we can do this again.
- // PictureLayerTiling* twin_tiling = NULL;
+ const PictureLayerTiling* twin_tiling = NULL;
CreateTile(new_tile_keys[i].first, new_tile_keys[i].second, twin_tiling);
}
}
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h
index 457632c..952c7af 100644
--- a/cc/resources/picture_layer_tiling.h
+++ b/cc/resources/picture_layer_tiling.h
@@ -130,6 +130,7 @@ class CC_EXPORT PictureLayerTiling {
void UpdateTilesToCurrentPile(const Region& layer_invalidation,
const gfx::Size& new_layer_bounds);
void CreateMissingTilesInLiveTilesRect();
+ void RemoveTilesInRegion(const Region& layer_region);
void SetClient(PictureLayerTilingClient* client);
void set_resolution(TileResolution resolution) { resolution_ = resolution; }
@@ -283,6 +284,9 @@ class CC_EXPORT PictureLayerTiling {
void UpdateEvictionCacheIfNeeded(TreePriority tree_priority);
void Invalidate(const Region& layer_region);
+ void DoInvalidate(const Region& layer_region,
+ bool recreate_invalidated_tiles);
+
// Given properties.
float contents_scale_;
gfx::Size layer_bounds_;
diff --git a/cc/resources/picture_layer_tiling_set.cc b/cc/resources/picture_layer_tiling_set.cc
index 3d295c5..bbe4070 100644
--- a/cc/resources/picture_layer_tiling_set.cc
+++ b/cc/resources/picture_layer_tiling_set.cc
@@ -36,6 +36,11 @@ void PictureLayerTilingSet::SetClient(PictureLayerTilingClient* client) {
tilings_[i]->SetClient(client_);
}
+void PictureLayerTilingSet::RemoveTilesInRegion(const Region& region) {
+ for (size_t i = 0; i < tilings_.size(); ++i)
+ tilings_[i]->RemoveTilesInRegion(region);
+}
+
bool PictureLayerTilingSet::SyncTilings(const PictureLayerTilingSet& other,
const gfx::Size& new_layer_bounds,
const Region& layer_invalidation,
diff --git a/cc/resources/picture_layer_tiling_set.h b/cc/resources/picture_layer_tiling_set.h
index e945752..6452dde 100644
--- a/cc/resources/picture_layer_tiling_set.h
+++ b/cc/resources/picture_layer_tiling_set.h
@@ -21,6 +21,8 @@ class CC_EXPORT PictureLayerTilingSet {
void SetClient(PictureLayerTilingClient* client);
const PictureLayerTilingClient* client() const { return client_; }
+ void RemoveTilesInRegion(const Region& region);
+
// Make this set of tilings match the same set of content scales from |other|.
// Delete any tilings that don't meet |minimum_contents_scale|. Recreate
// any tiles that intersect |layer_invalidation|. Update the size of all