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

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

Issue 407763002: Revert of 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 PictureLayerImpl* recycled_twin = static_cast<PictureLayerImpl*>(
1202 layer_tree_impl()->FindRecycleTreeLayerById(id()));
1203 // Remove tilings on this tree and the twin tree.
1204 for (size_t i = 0; i < to_remove.size(); ++i) { 1198 for (size_t i = 0; i < to_remove.size(); ++i) {
1205 const PictureLayerTiling* twin_tiling = GetTwinTiling(to_remove[i]); 1199 const PictureLayerTiling* twin_tiling = GetTwinTiling(to_remove[i]);
1206 // Only remove tilings from the twin layer if they have 1200 // Only remove tilings from the twin layer if they have
1207 // NON_IDEAL_RESOLUTION. 1201 // NON_IDEAL_RESOLUTION.
1208 if (twin_tiling && twin_tiling->resolution() == NON_IDEAL_RESOLUTION) 1202 if (twin_tiling && twin_tiling->resolution() == NON_IDEAL_RESOLUTION)
1209 twin->RemoveTiling(to_remove[i]->contents_scale()); 1203 twin->RemoveTiling(to_remove[i]->contents_scale());
1210 // Remove the tiling from the recycle tree. Note that we ignore resolution,
1211 // since we don't need to maintain high/low res on the recycle tree.
1212 if (recycled_twin)
1213 recycled_twin->RemoveTiling(to_remove[i]->contents_scale());
1214 // TODO(enne): temporary sanity CHECK for http://crbug.com/358350 1204 // TODO(enne): temporary sanity CHECK for http://crbug.com/358350
1215 CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution()); 1205 CHECK_NE(HIGH_RESOLUTION, to_remove[i]->resolution());
1216 tilings_->Remove(to_remove[i]); 1206 tilings_->Remove(to_remove[i]);
1217 } 1207 }
1208 DCHECK_GT(tilings_->num_tilings(), 0u);
1218 1209
1219 DCHECK_GT(tilings_->num_tilings(), 0u);
1220 SanityCheckTilingState(); 1210 SanityCheckTilingState();
1221 } 1211 }
1222 1212
1223 float PictureLayerImpl::MinimumContentsScale() const { 1213 float PictureLayerImpl::MinimumContentsScale() const {
1224 float setting_min = layer_tree_impl()->settings().minimum_contents_scale; 1214 float setting_min = layer_tree_impl()->settings().minimum_contents_scale;
1225 1215
1226 // If the contents scale is less than 1 / width (also for height), 1216 // If the contents scale is less than 1 / width (also for height),
1227 // then it will end up having less than one pixel of content in that 1217 // then it will end up having less than one pixel of content in that
1228 // dimension. Bump the minimum contents scale up in this case to prevent 1218 // dimension. Bump the minimum contents scale up in this case to prevent
1229 // this from happening. 1219 // this from happening.
(...skipping 28 matching lines...) Expand all
1258 bool PictureLayerImpl::CanHaveTilingWithScale(float contents_scale) const { 1248 bool PictureLayerImpl::CanHaveTilingWithScale(float contents_scale) const {
1259 if (!CanHaveTilings()) 1249 if (!CanHaveTilings())
1260 return false; 1250 return false;
1261 if (contents_scale < MinimumContentsScale()) 1251 if (contents_scale < MinimumContentsScale())
1262 return false; 1252 return false;
1263 return true; 1253 return true;
1264 } 1254 }
1265 1255
1266 void PictureLayerImpl::SanityCheckTilingState() const { 1256 void PictureLayerImpl::SanityCheckTilingState() const {
1267 #if DCHECK_IS_ON 1257 #if DCHECK_IS_ON
1268 // Recycle tree doesn't have any restrictions.
1269 if (layer_tree_impl()->IsRecycleTree())
1270 return;
1271
1272 if (!CanHaveTilings()) { 1258 if (!CanHaveTilings()) {
1273 DCHECK_EQ(0u, tilings_->num_tilings()); 1259 DCHECK_EQ(0u, tilings_->num_tilings());
1274 return; 1260 return;
1275 } 1261 }
1276 if (tilings_->num_tilings() == 0) 1262 if (tilings_->num_tilings() == 0)
1277 return; 1263 return;
1278 1264
1279 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res 1265 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res
1280 // tiling to mark its tiles as being required for activation. 1266 // tiling to mark its tiles as being required for activation.
1281 DCHECK_EQ(1, tilings_->NumHighResTilings()); 1267 DCHECK_EQ(1, tilings_->NumHighResTilings());
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 return iterator_index_ < iterators_.size(); 1629 return iterator_index_ < iterators_.size();
1644 } 1630 }
1645 1631
1646 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1632 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1647 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1633 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1648 return it->get_type() == iteration_stage_ && 1634 return it->get_type() == iteration_stage_ &&
1649 (**it)->required_for_activation() == required_for_activation_; 1635 (**it)->required_for_activation() == required_for_activation_;
1650 } 1636 }
1651 1637
1652 } // namespace cc 1638 } // 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