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

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: update 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 } 1194 }
1195 1195
1196 // Don't remove tilings that are being used (and thus would cause a flash.) 1196 // Don't remove tilings that are being used (and thus would cause a flash.)
1197 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) != 1197 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) !=
1198 used_tilings.end()) 1198 used_tilings.end())
1199 continue; 1199 continue;
1200 1200
1201 to_remove.push_back(tiling); 1201 to_remove.push_back(tiling);
1202 } 1202 }
1203 1203
1204 if (to_remove.empty())
1205 return;
1206
1207 PictureLayerImpl* recycled_twin = static_cast<PictureLayerImpl*>(
1208 layer_tree_impl()->FindRecycleTreeLayerById(id()));
1209 // Remove tilings on this tree and the twin tree.
1204 for (size_t i = 0; i < to_remove.size(); ++i) { 1210 for (size_t i = 0; i < to_remove.size(); ++i) {
1205 const PictureLayerTiling* twin_tiling = GetTwinTiling(to_remove[i]); 1211 const PictureLayerTiling* twin_tiling = GetTwinTiling(to_remove[i]);
1206 // Only remove tilings from the twin layer if they have 1212 // Only remove tilings from the twin layer if they have
1207 // NON_IDEAL_RESOLUTION. 1213 // NON_IDEAL_RESOLUTION.
1208 if (twin_tiling && twin_tiling->resolution() == NON_IDEAL_RESOLUTION) 1214 if (twin_tiling && twin_tiling->resolution() == NON_IDEAL_RESOLUTION)
1209 twin->RemoveTiling(to_remove[i]->contents_scale()); 1215 twin->RemoveTiling(to_remove[i]->contents_scale());
1216 // Remove the tiling from the recycle tree.
danakj 2014/07/18 18:34:58 nit: mention we're ignoring it resolution because
vmpstr 2014/07/18 23:21:12 Done.
1217 if (recycled_twin)
1218 recycled_twin->RemoveTiling(to_remove[i]->contents_scale());
1210 // TODO(enne): temporary sanity CHECK for http://crbug.com/358350 1219 // TODO(enne): temporary sanity CHECK for http://crbug.com/358350
1211 CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution()); 1220 CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution());
1212 tilings_->Remove(to_remove[i]); 1221 tilings_->Remove(to_remove[i]);
1213 } 1222 }
1223
1214 DCHECK_GT(tilings_->num_tilings(), 0u); 1224 DCHECK_GT(tilings_->num_tilings(), 0u);
1215
1216 SanityCheckTilingState(); 1225 SanityCheckTilingState();
1217 } 1226 }
1218 1227
1219 float PictureLayerImpl::MinimumContentsScale() const { 1228 float PictureLayerImpl::MinimumContentsScale() const {
1220 float setting_min = layer_tree_impl()->settings().minimum_contents_scale; 1229 float setting_min = layer_tree_impl()->settings().minimum_contents_scale;
1221 1230
1222 // If the contents scale is less than 1 / width (also for height), 1231 // If the contents scale is less than 1 / width (also for height),
1223 // then it will end up having less than one pixel of content in that 1232 // then it will end up having less than one pixel of content in that
1224 // dimension. Bump the minimum contents scale up in this case to prevent 1233 // dimension. Bump the minimum contents scale up in this case to prevent
1225 // this from happening. 1234 // this from happening.
(...skipping 28 matching lines...) Expand all
1254 bool PictureLayerImpl::CanHaveTilingWithScale(float contents_scale) const { 1263 bool PictureLayerImpl::CanHaveTilingWithScale(float contents_scale) const {
1255 if (!CanHaveTilings()) 1264 if (!CanHaveTilings())
1256 return false; 1265 return false;
1257 if (contents_scale < MinimumContentsScale()) 1266 if (contents_scale < MinimumContentsScale())
1258 return false; 1267 return false;
1259 return true; 1268 return true;
1260 } 1269 }
1261 1270
1262 void PictureLayerImpl::SanityCheckTilingState() const { 1271 void PictureLayerImpl::SanityCheckTilingState() const {
1263 #if DCHECK_IS_ON 1272 #if DCHECK_IS_ON
1273 // Recycle tree doesn't have any restrictions.
1274 if (layer_tree_impl()->IsRecycleTree())
1275 return;
1276
1264 if (!CanHaveTilings()) { 1277 if (!CanHaveTilings()) {
1265 DCHECK_EQ(0u, tilings_->num_tilings()); 1278 DCHECK_EQ(0u, tilings_->num_tilings());
1266 return; 1279 return;
1267 } 1280 }
1268 if (tilings_->num_tilings() == 0) 1281 if (tilings_->num_tilings() == 0)
1269 return; 1282 return;
1270 1283
1271 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res 1284 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res
1272 // tiling to mark its tiles as being required for activation. 1285 // tiling to mark its tiles as being required for activation.
1273 DCHECK_EQ(1, tilings_->NumHighResTilings()); 1286 DCHECK_EQ(1, tilings_->NumHighResTilings());
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 return iterator_index_ < iterators_.size(); 1648 return iterator_index_ < iterators_.size();
1636 } 1649 }
1637 1650
1638 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1651 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1639 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1652 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1640 return it->get_type() == iteration_stage_ && 1653 return it->get_type() == iteration_stage_ &&
1641 (**it)->required_for_activation() == required_for_activation_; 1654 (**it)->required_for_activation() == required_for_activation_;
1642 } 1655 }
1643 1656
1644 } // namespace cc 1657 } // 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