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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 366113002: cc: Do not cleanup tiles with raster tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits updated. 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_perftest.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 64661c1a6981eb87541742fd56e69ae43b691ffc..68a0a936c1f91aef0a6ca6f29beff6531c8fdb33 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -57,6 +57,13 @@ class TileEvictionOrder {
private:
TreePriority tree_priority_;
};
+
+void ReleaseTile(Tile* tile, WhichTree tree) {
+ // Reset priority as tile is ref-counted and might still be used
+ // even though we no longer hold a reference to it here anymore.
+ tile->SetPriority(tree, TilePriority());
+}
+
} // namespace
scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
@@ -98,6 +105,8 @@ PictureLayerTiling::PictureLayerTiling(float contents_scale,
}
PictureLayerTiling::~PictureLayerTiling() {
+ for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
+ ReleaseTile(it->second.get(), client_->GetTree());
}
void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) {
@@ -218,6 +227,9 @@ void PictureLayerTiling::DoInvalidate(const Region& layer_region,
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);
}
@@ -613,8 +625,10 @@ void PictureLayerTiling::SetLiveTilesRect(
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())
+ if (found != tiles_.end()) {
+ ReleaseTile(found->second.get(), client_->GetTree());
tiles_.erase(found);
+ }
}
const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698