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

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

Issue 328383002: Merge 276305 "cc: Don't cleanup the pending twin's low res tiling." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src/
Patch Set: Created 6 years, 6 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/resources/picture_layer_tiling_set.cc » ('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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 void PictureLayerImpl::CleanUpTilingsOnActiveLayer( 1167 void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
1168 std::vector<PictureLayerTiling*> used_tilings) { 1168 std::vector<PictureLayerTiling*> used_tilings) {
1169 DCHECK(layer_tree_impl()->IsActiveTree()); 1169 DCHECK(layer_tree_impl()->IsActiveTree());
1170 if (tilings_->num_tilings() == 0) 1170 if (tilings_->num_tilings() == 0)
1171 return; 1171 return;
1172 1172
1173 float min_acceptable_high_res_scale = std::min( 1173 float min_acceptable_high_res_scale = std::min(
1174 raster_contents_scale_, ideal_contents_scale_); 1174 raster_contents_scale_, ideal_contents_scale_);
1175 float max_acceptable_high_res_scale = std::max( 1175 float max_acceptable_high_res_scale = std::max(
1176 raster_contents_scale_, ideal_contents_scale_); 1176 raster_contents_scale_, ideal_contents_scale_);
1177 float twin_low_res_scale = 0.f;
1177 1178
1178 PictureLayerImpl* twin = twin_layer_; 1179 PictureLayerImpl* twin = twin_layer_;
1179 if (twin) { 1180 if (twin) {
1180 min_acceptable_high_res_scale = std::min( 1181 min_acceptable_high_res_scale = std::min(
1181 min_acceptable_high_res_scale, 1182 min_acceptable_high_res_scale,
1182 std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_)); 1183 std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_));
1183 max_acceptable_high_res_scale = std::max( 1184 max_acceptable_high_res_scale = std::max(
1184 max_acceptable_high_res_scale, 1185 max_acceptable_high_res_scale,
1185 std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_)); 1186 std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_));
1187
1188 for (size_t i = 0; i < twin->tilings_->num_tilings(); ++i) {
1189 PictureLayerTiling* tiling = twin->tilings_->tiling_at(i);
1190 if (tiling->resolution() == LOW_RESOLUTION)
1191 twin_low_res_scale = tiling->contents_scale();
1192 }
1186 } 1193 }
1187 1194
1188 std::vector<PictureLayerTiling*> to_remove; 1195 std::vector<PictureLayerTiling*> to_remove;
1189 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 1196 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
1190 PictureLayerTiling* tiling = tilings_->tiling_at(i); 1197 PictureLayerTiling* tiling = tilings_->tiling_at(i);
1191 1198
1192 // Keep multiple high resolution tilings even if not used to help 1199 // Keep multiple high resolution tilings even if not used to help
1193 // activate earlier at non-ideal resolutions. 1200 // activate earlier at non-ideal resolutions.
1194 if (tiling->contents_scale() >= min_acceptable_high_res_scale && 1201 if (tiling->contents_scale() >= min_acceptable_high_res_scale &&
1195 tiling->contents_scale() <= max_acceptable_high_res_scale) 1202 tiling->contents_scale() <= max_acceptable_high_res_scale)
1196 continue; 1203 continue;
1197 1204
1198 // Keep low resolution tilings, if the layer should have them. 1205 // Keep low resolution tilings, if the layer should have them.
1199 if (tiling->resolution() == LOW_RESOLUTION && ShouldHaveLowResTiling()) 1206 if (ShouldHaveLowResTiling()) {
1200 continue; 1207 if (tiling->resolution() == LOW_RESOLUTION ||
1208 tiling->contents_scale() == twin_low_res_scale)
1209 continue;
1210 }
1201 1211
1202 // Don't remove tilings that are being used (and thus would cause a flash.) 1212 // Don't remove tilings that are being used (and thus would cause a flash.)
1203 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) != 1213 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) !=
1204 used_tilings.end()) 1214 used_tilings.end())
1205 continue; 1215 continue;
1206 1216
1207 to_remove.push_back(tiling); 1217 to_remove.push_back(tiling);
1208 } 1218 }
1209 1219
1210 for (size_t i = 0; i < to_remove.size(); ++i) { 1220 for (size_t i = 0; i < to_remove.size(); ++i) {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 return iterator_index_ < iterators_.size(); 1571 return iterator_index_ < iterators_.size();
1562 } 1572 }
1563 1573
1564 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1574 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1565 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1575 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1566 return it->get_type() == iteration_stage_ && 1576 return it->get_type() == iteration_stage_ &&
1567 (**it)->required_for_activation() == required_for_activation_; 1577 (**it)->required_for_activation() == required_for_activation_;
1568 } 1578 }
1569 1579
1570 } // namespace cc 1580 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/picture_layer_tiling_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698