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

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: review comments addressed. Created 6 years, 5 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
Index: cc/resources/picture_layer_tiling.cc
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index fdfbad9f62e3e60bbd1949541123ef36c5713de1..86d435f3eba487112cbc9b184b09ffe1757855d0 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -57,6 +57,14 @@ class TileEvictionOrder {
private:
TreePriority tree_priority_;
};
+
+// Reset priority as tile is ref-counted and might still be used
+// even though we no longer hold a reference to it here anymore.
reveman 2014/07/28 15:50:53 Please move this comment just above "tile->SetPrio
sohanjg 2014/07/30 11:12:57 Done.
+void ResetPriority(Tile* tile, WhichTree tree) {
reveman 2014/07/28 15:50:53 I would prefer if you named this "ReleaseTile" and
sohanjg 2014/07/30 11:12:57 Done.
+ DCHECK(tile);
reveman 2014/07/28 15:50:53 Remove this. It's awkward to not be able to assume
sohanjg 2014/07/30 11:12:57 Acknowledged.
+ tile->SetPriority(tree, TilePriority());
+}
+
} // namespace
scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
@@ -94,6 +102,8 @@ PictureLayerTiling::PictureLayerTiling(float contents_scale,
}
PictureLayerTiling::~PictureLayerTiling() {
+ for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
+ ResetPriority(it->second.get(), client_->GetTree());
}
void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) {
@@ -214,6 +224,9 @@ void PictureLayerTiling::DoInvalidate(const Region& layer_region,
TileMap::iterator find = tiles_.find(key);
if (find == tiles_.end())
continue;
+
+ ResetPriority(find->second.get(), client_->GetTree());
+
tiles_.erase(find);
new_tile_keys.push_back(key);
}
@@ -598,8 +611,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()) {
+ ResetPriority(found->second.get(), client_->GetTree());
tiles_.erase(found);
+ }
}
const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);

Powered by Google App Engine
This is Rietveld 408576698