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..5d29583f205254311b23201442177552d51e0373 100644 |
--- a/cc/resources/picture_layer_tiling.cc |
+++ b/cc/resources/picture_layer_tiling.cc |
@@ -94,6 +94,10 @@ PictureLayerTiling::PictureLayerTiling(float contents_scale, |
} |
PictureLayerTiling::~PictureLayerTiling() { |
+ // Reset priority as tile is ref-counted and might still be used |
+ // even though we no longer hold a reference to it here anymore. |
+ for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
+ it->second.get()->SetPriority(client_->GetTree(), TilePriority()); |
} |
void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { |
@@ -214,6 +218,11 @@ void PictureLayerTiling::DoInvalidate(const Region& layer_region, |
TileMap::iterator find = tiles_.find(key); |
if (find == tiles_.end()) |
continue; |
+ |
+ // Reset priority as tile is ref-counted and might still be used |
+ // even though we no longer hold a reference to it here anymore. |
+ find->second.get()->SetPriority(client_->GetTree(), TilePriority()); |
+ |
tiles_.erase(find); |
new_tile_keys.push_back(key); |
} |
@@ -598,8 +607,12 @@ 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()) { |
+ // Reset priority as tile is ref-counted and might still be used |
+ // even though we no longer hold a reference to it here anymore. |
+ found->second.get()->SetPriority(client_->GetTree(), TilePriority()); |
tiles_.erase(found); |
+ } |
} |
const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); |