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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 502453003: cc: Remove tiles from recycle tree that were deleted on active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +address comment 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
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 0ec80686b8dc87069fd123bd1cb5cffb7084c3ef..dd39587cbba0a1c6851653e46701adb4649959c5 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -60,6 +60,7 @@ PictureLayerImpl::Pair::~Pair() {
PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, int id)
: LayerImpl(tree_impl, id),
twin_layer_(NULL),
+ recycled_twin_layer_(NULL),
pile_(PicturePileImpl::Create()),
is_mask_(false),
ideal_page_scale_(0.f),
@@ -109,8 +110,10 @@ 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;
+ layer_impl->recycled_twin_layer_ = this;
+ DCHECK(!recycled_twin_layer_);
twin_layer_ = NULL;
layer_impl->SetIsMask(is_mask_);
@@ -610,6 +613,14 @@ const PictureLayerTiling* PictureLayerImpl::GetTwinTiling(
return NULL;
}
+PictureLayerTiling* PictureLayerImpl::GetRecycledTwinTiling(
+ const PictureLayerTiling* tiling) const {
+ if (!recycled_twin_layer_ || !recycled_twin_layer_->tilings_)
+ return NULL;
+ return recycled_twin_layer_->tilings_->TilingAtScale(
+ tiling->contents_scale());
+}
+
size_t PictureLayerImpl::GetMaxTilesForInterestArea() const {
return layer_tree_impl()->settings().max_tiles_for_interest_area;
}
@@ -946,6 +957,7 @@ void PictureLayerImpl::DoPostCommitInitialization() {
if (twin_layer_) {
DCHECK(!twin_layer_->twin_layer_);
twin_layer_->twin_layer_ = this;
+ twin_layer_->recycled_twin_layer_ = NULL;
// If the twin has never been pushed to, do not sync from it.
// This can happen if this function is called during activation.
if (!twin_layer_->needs_post_commit_initialization_)
@@ -1250,8 +1262,6 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
if (to_remove.empty())
return;
- PictureLayerImpl* recycled_twin = static_cast<PictureLayerImpl*>(
- layer_tree_impl()->FindRecycleTreeLayerById(id()));
// 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]);
@@ -1261,8 +1271,8 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
twin->RemoveTiling(to_remove[i]->contents_scale());
// Remove the tiling from the recycle tree. Note that we ignore resolution,
// since we don't need to maintain high/low res on the recycle tree.
- if (recycled_twin)
- recycled_twin->RemoveTiling(to_remove[i]->contents_scale());
+ if (recycled_twin_layer_)
+ recycled_twin_layer_->RemoveTiling(to_remove[i]->contents_scale());
// TODO(enne): temporary sanity CHECK for http://crbug.com/358350
CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution());
tilings_->Remove(to_remove[i]);

Powered by Google App Engine
This is Rietveld 408576698