diff options
Diffstat (limited to 'cc/layers/picture_layer_impl.cc')
-rw-r--r-- | cc/layers/picture_layer_impl.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index c477720..cedb7a1 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -108,7 +108,7 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { LayerImpl::PushPropertiesTo(base_layer); // When the pending tree pushes to the active tree, the pending twin - // disappears. + // becomes recycled. layer_impl->twin_layer_ = NULL; twin_layer_ = NULL; @@ -533,6 +533,12 @@ gfx::Rect PictureLayerImpl::GetViewportForTilePriorityInContentSpace() const { return visible_rect_in_content_space; } +PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() { + // TODO(vmpstr): Maintain recycled twin as a member. crbug.com/407418 + return static_cast<PictureLayerImpl*>( + layer_tree_impl()->FindRecycleTreeLayerById(id())); +} + void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { if (layer_tree_impl()->IsActiveTree()) { gfx::RectF layer_damage_rect = @@ -609,6 +615,14 @@ const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( return NULL; } +PictureLayerTiling* PictureLayerImpl::GetRecycledTwinTiling( + const PictureLayerTiling* tiling) { + PictureLayerImpl* recycled_twin = GetRecycledTwinLayer(); + if (!recycled_twin || !recycled_twin->tilings_) + return NULL; + return recycled_twin->tilings_->TilingAtScale(tiling->contents_scale()); +} + size_t PictureLayerImpl::GetMaxTilesForInterestArea() const { return layer_tree_impl()->settings().max_tiles_for_interest_area; } @@ -1243,8 +1257,7 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer( if (to_remove.empty()) return; - PictureLayerImpl* recycled_twin = static_cast<PictureLayerImpl*>( - layer_tree_impl()->FindRecycleTreeLayerById(id())); + PictureLayerImpl* recycled_twin = GetRecycledTwinLayer(); // Remove tilings on this tree and the twin tree. for (size_t i = 0; i < to_remove.size(); ++i) { const PictureLayerTiling* twin_tiling = GetTwinTiling(to_remove[i]); |