summaryrefslogtreecommitdiffstats
path: root/cc/resources/picture_layer_tiling.cc
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 12:50:18 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 12:50:18 +0000
commite7b86aaedb74d6322504963c35f9a6bb8f58b1f7 (patch)
tree1a7ff9af52d65c6465bf0db4a8ea3f44a96093c0 /cc/resources/picture_layer_tiling.cc
parent01fd0b25383e971d2f7e1e6ae242cea94b586711 (diff)
downloadchromium_src-e7b86aaedb74d6322504963c35f9a6bb8f58b1f7.zip
chromium_src-e7b86aaedb74d6322504963c35f9a6bb8f58b1f7.tar.gz
chromium_src-e7b86aaedb74d6322504963c35f9a6bb8f58b1f7.tar.bz2
cc: Invalidate newly recycled tilings upon swapping.
This patch changes the way we invalidate recycled tiles. Previously, we would keep unshared tiles on the recycle tree until we create a new pending tree. When we do that, we invalidate two frames worth of invalidation. However, this relies on the tile manager to release memory from these tiles and doesn't yield itself to changes. The new approach invalidates the current invalidation on the recycle tree as soon as the tilings are swapped, which ensures that in that frame the tiles that are not shared are already released. R=enne Review URL: https://codereview.chromium.org/227673013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources/picture_layer_tiling.cc')
-rw-r--r--cc/resources/picture_layer_tiling.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index 95f9546..5fa9d05 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -179,7 +179,16 @@ void PictureLayerTiling::SetLayerBounds(const gfx::Size& layer_bounds) {
Invalidate(layer_region);
}
+void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_region) {
+ DoInvalidate(layer_region, false /* recreate_tiles */);
+}
+
void PictureLayerTiling::Invalidate(const Region& layer_region) {
+ DoInvalidate(layer_region, true /* recreate_tiles */);
+}
+
+void PictureLayerTiling::DoInvalidate(const Region& layer_region,
+ bool recreate_tiles) {
std::vector<TileMapKey> new_tile_keys;
for (Region::Iterator iter(layer_region); iter.has_rect(); iter.next()) {
gfx::Rect layer_rect = iter.rect();
@@ -198,13 +207,16 @@ void PictureLayerTiling::Invalidate(const Region& layer_region) {
if (find == tiles_.end())
continue;
tiles_.erase(find);
- new_tile_keys.push_back(key);
+ if (recreate_tiles)
+ new_tile_keys.push_back(key);
}
}
- const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
- for (size_t i = 0; i < new_tile_keys.size(); ++i)
- CreateTile(new_tile_keys[i].first, new_tile_keys[i].second, twin_tiling);
+ if (recreate_tiles) {
+ const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
+ for (size_t i = 0; i < new_tile_keys.size(); ++i)
+ CreateTile(new_tile_keys[i].first, new_tile_keys[i].second, twin_tiling);
+ }
}
PictureLayerTiling::CoverageIterator::CoverageIterator()