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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 400633004: cc: Remove tilings from recycle tree when active tree removes them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 } 1188 }
1189 1189
1190 // Don't remove tilings that are being used (and thus would cause a flash.) 1190 // Don't remove tilings that are being used (and thus would cause a flash.)
1191 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) != 1191 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) !=
1192 used_tilings.end()) 1192 used_tilings.end())
1193 continue; 1193 continue;
1194 1194
1195 to_remove.push_back(tiling); 1195 to_remove.push_back(tiling);
1196 } 1196 }
1197 1197
1198 if (to_remove.empty())
1199 return;
1200
1201 // Remove tilings on this tree and the twin tree.
1198 for (size_t i = 0; i < to_remove.size(); ++i) { 1202 for (size_t i = 0; i < to_remove.size(); ++i) {
1199 const PictureLayerTiling* twin_tiling = GetTwinTiling(to_remove[i]); 1203 const PictureLayerTiling* twin_tiling = GetTwinTiling(to_remove[i]);
1200 // Only remove tilings from the twin layer if they have 1204 // Only remove tilings from the twin layer if they have
1201 // NON_IDEAL_RESOLUTION. 1205 // NON_IDEAL_RESOLUTION.
1202 if (twin_tiling && twin_tiling->resolution() == NON_IDEAL_RESOLUTION) 1206 if (twin_tiling && twin_tiling->resolution() == NON_IDEAL_RESOLUTION)
1203 twin->RemoveTiling(to_remove[i]->contents_scale()); 1207 twin->RemoveTiling(to_remove[i]->contents_scale());
1204 // TODO(enne): temporary sanity CHECK for http://crbug.com/358350 1208 // TODO(enne): temporary sanity CHECK for http://crbug.com/358350
1205 CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution()); 1209 CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution());
1206 tilings_->Remove(to_remove[i]); 1210 tilings_->Remove(to_remove[i]);
1207 } 1211 }
1212
1208 DCHECK_GT(tilings_->num_tilings(), 0u); 1213 DCHECK_GT(tilings_->num_tilings(), 0u);
1214 SanityCheckTilingState();
1209 1215
1210 SanityCheckTilingState(); 1216 // Also remove tilings from the recycle tree to ensure that recycle tree
1217 // doesn't have any unshared tiles.
1218 PictureLayerImpl* recycled_twin = static_cast<PictureLayerImpl*>(
1219 layer_tree_impl()->FindRecycleTreeLayerById(id()));
1220 if (!recycled_twin)
1221 return;
1222
1223 for (size_t i = 0; i < to_remove.size(); ++i)
1224 recycled_twin->RemoveTiling(to_remove[i]->contents_scale());
danakj 2014/07/17 21:54:48 We might remove the high res tiling on the recycle
1211 } 1225 }
1212 1226
1213 float PictureLayerImpl::MinimumContentsScale() const { 1227 float PictureLayerImpl::MinimumContentsScale() const {
1214 float setting_min = layer_tree_impl()->settings().minimum_contents_scale; 1228 float setting_min = layer_tree_impl()->settings().minimum_contents_scale;
1215 1229
1216 // If the contents scale is less than 1 / width (also for height), 1230 // If the contents scale is less than 1 / width (also for height),
1217 // then it will end up having less than one pixel of content in that 1231 // then it will end up having less than one pixel of content in that
1218 // dimension. Bump the minimum contents scale up in this case to prevent 1232 // dimension. Bump the minimum contents scale up in this case to prevent
1219 // this from happening. 1233 // this from happening.
1220 int min_dimension = std::min(bounds().width(), bounds().height()); 1234 int min_dimension = std::min(bounds().width(), bounds().height());
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 return iterator_index_ < iterators_.size(); 1643 return iterator_index_ < iterators_.size();
1630 } 1644 }
1631 1645
1632 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1646 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1633 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1647 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1634 return it->get_type() == iteration_stage_ && 1648 return it->get_type() == iteration_stage_ &&
1635 (**it)->required_for_activation() == required_for_activation_; 1649 (**it)->required_for_activation() == required_for_activation_;
1636 } 1650 }
1637 1651
1638 } // namespace cc 1652 } // namespace cc
OLDNEW
« 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