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

Unified Diff: cc/picture_layer_tiling.cc

Issue 12289021: cc: Only register live tiles with the TileManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments, fix 80+char line Created 7 years, 10 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/picture_layer_tiling.h ('k') | cc/picture_layer_tiling_set_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_tiling.cc
diff --git a/cc/picture_layer_tiling.cc b/cc/picture_layer_tiling.cc
index ca357a10b6d51dae26ed0b085fb604e148046051..5dd2dfef0099d9b51829b8b52522638a87881491 100644
--- a/cc/picture_layer_tiling.cc
+++ b/cc/picture_layer_tiling.cc
@@ -417,6 +417,7 @@ void PictureLayerTiling::UpdateTilePriorities(
TileHandle* tile_handle = &find->second;
Tile* tile = tile_handle->tile();
tile->set_priority(tree, priority);
+ tile_handle->UnregisterFromTileManager();
}
last_prioritized_rect_ = inflated_rect;
@@ -442,6 +443,7 @@ void PictureLayerTiling::UpdateTilePriorities(
continue;
TileHandle* tile_handle = &find->second;
Tile* tile = tile_handle->tile();
+ tile_handle->RegisterWithTileManager();
gfx::Rect tile_bounds =
tiling_data_.TileBounds(iter.index_x(), iter.index_y());
@@ -476,6 +478,7 @@ void PictureLayerTiling::UpdateTilePriorities(
continue;
TileHandle* tile_handle = &find->second;
Tile* tile = tile_handle->tile();
+ tile_handle->RegisterWithTileManager();
gfx::Rect tile_bounds =
tiling_data_.TileBounds(iter.index_x(), iter.index_y());
@@ -543,9 +546,17 @@ scoped_ptr<base::Value> PictureLayerTiling::AsValue() const {
return state.PassAs<base::Value>();
}
-TileHandle::TileHandle(scoped_refptr<Tile> tile)
- : tile_(tile),
- managed_tile_state_(tile_->tile_manager()->RegisterTile(tile_)) {
+TileHandle::TileHandle(scoped_refptr<Tile> tile) : tile_(tile) {
+}
+
+void TileHandle::RegisterWithTileManager() {
+ if (managed_tile_state_.get())
+ return;
+ managed_tile_state_ = tile_->tile_manager()->RegisterTile(tile_);
+}
+
+void TileHandle::UnregisterFromTileManager() {
+ managed_tile_state_ = NULL;
}
} // namespace cc
« no previous file with comments | « cc/picture_layer_tiling.h ('k') | cc/picture_layer_tiling_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698