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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 399233004: (Reland) cc: Remove recycled tilings when active tree removes them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 4a7e0c0b0b66ae5bdf20743b65c0f51c69824c0d..7007e75f0cabc9921fc2276c2c79dc7d2d874f4c 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -936,6 +936,9 @@ PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
}
void PictureLayerImpl::RemoveTiling(float contents_scale) {
+ if (!tilings_ || tilings_->num_tilings() == 0)
+ return;
+
for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
PictureLayerTiling* tiling = tilings_->tiling_at(i);
if (tiling->contents_scale() == contents_scale) {
@@ -1195,18 +1198,28 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
to_remove.push_back(tiling);
}
+ 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]);
// Only remove tilings from the twin layer if they have
// NON_IDEAL_RESOLUTION.
if (twin_tiling && twin_tiling->resolution() == NON_IDEAL_RESOLUTION)
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());
// TODO(enne): temporary sanity CHECK for http://crbug.com/358350
CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution());
tilings_->Remove(to_remove[i]);
}
- DCHECK_GT(tilings_->num_tilings(), 0u);
+ DCHECK_GT(tilings_->num_tilings(), 0u);
SanityCheckTilingState();
}
@@ -1255,6 +1268,10 @@ bool PictureLayerImpl::CanHaveTilingWithScale(float contents_scale) const {
void PictureLayerImpl::SanityCheckTilingState() const {
#if DCHECK_IS_ON
+ // Recycle tree doesn't have any restrictions.
+ if (layer_tree_impl()->IsRecycleTree())
+ return;
+
if (!CanHaveTilings()) {
DCHECK_EQ(0u, tilings_->num_tilings());
return;
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698