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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 513903002: cc: Always remove tiles from the recycle tree also. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: recycle: pushprops Created 6 years, 4 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/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling.cc
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index b302873c1a33cf311ab4d0e027d32ed2ea4b8568..229d1cd5efdad7d2e902fabe9a829864ddce6f81 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -223,15 +223,12 @@ void PictureLayerTiling::DoInvalidate(const Region& layer_region,
&tiling_data_, content_rect, include_borders);
iter;
++iter) {
- TileMapKey key(iter.index());
- TileMap::iterator find = tiles_.find(key);
- if (find == tiles_.end())
- continue;
-
- ReleaseTile(find->second.get(), client_->GetTree());
-
- tiles_.erase(find);
- new_tile_keys.push_back(key);
+ // There is no recycled twin since this is run on the pending tiling.
+ PictureLayerTiling* recycled_twin = NULL;
+ DCHECK_EQ(recycled_twin, client_->GetRecycledTwinTiling(this));
+ DCHECK_EQ(PENDING_TREE, client_->GetTree());
+ if (RemoveTileAt(iter.index_x(), iter.index_y(), recycled_twin))
+ new_tile_keys.push_back(iter.index());
}
}
@@ -395,10 +392,29 @@ gfx::Size PictureLayerTiling::CoverageIterator::texture_size() const {
return tiling_->tiling_data_.max_texture_size();
}
+bool PictureLayerTiling::RemoveTileAt(int i,
+ int j,
+ PictureLayerTiling* recycled_twin) {
+ TileMap::iterator found = tiles_.find(TileMapKey(i, j));
+ if (found == tiles_.end())
+ return false;
+ ReleaseTile(found->second.get(), client_->GetTree());
+ tiles_.erase(found);
+ if (recycled_twin) {
+ // Recycled twin does not also have a recycled twin, so pass NULL.
+ recycled_twin->RemoveTileAt(i, j, NULL);
+ }
+ return true;
+}
+
void PictureLayerTiling::Reset() {
live_tiles_rect_ = gfx::Rect();
- for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
+ PictureLayerTiling* recycled_twin = client_->GetRecycledTwinTiling(this);
+ for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
ReleaseTile(it->second.get(), client_->GetTree());
+ if (recycled_twin)
+ recycled_twin->RemoveTileAt(it->first.first, it->first.second, NULL);
+ }
tiles_.clear();
}
@@ -607,15 +623,6 @@ void PictureLayerTiling::UpdateTilePriorities(
current_eventually_rect_ = eventually_rect;
}
-void PictureLayerTiling::RemoveTileAt(int i, int j) {
- TileMapKey key(i, j);
- TileMap::iterator found = tiles_.find(key);
- if (found == tiles_.end())
- return;
- ReleaseTile(found->second.get(), client_->GetTree());
- tiles_.erase(found);
-}
-
void PictureLayerTiling::SetLiveTilesRect(
const gfx::Rect& new_live_tiles_rect) {
DCHECK(new_live_tiles_rect.IsEmpty() ||
@@ -632,16 +639,7 @@ void PictureLayerTiling::SetLiveTilesRect(
new_live_tiles_rect);
iter;
++iter) {
- TileMapKey key(iter.index());
- TileMap::iterator found = tiles_.find(key);
- // If the tile was outside of the recorded region, it won't exist even
- // though it was in the live rect.
- if (found != tiles_.end()) {
- ReleaseTile(found->second.get(), client_->GetTree());
- tiles_.erase(found);
- if (recycled_twin)
- recycled_twin->RemoveTileAt(iter.index_x(), iter.index_y());
- }
+ RemoveTileAt(iter.index_x(), iter.index_y(), recycled_twin);
}
const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698