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

Side by Side Diff: cc/resources/picture_layer_tiling_set.cc

Issue 878743005: cc: Add some debugging info to failing DCHECK in PictureLayerTilingSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addcheck: [ Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | 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/resources/picture_layer_tiling_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 for (PictureLayerTiling* tiling : tilings_) { 109 for (PictureLayerTiling* tiling : tilings_) {
110 DCHECK(tiling->tile_size() == 110 DCHECK(tiling->tile_size() ==
111 client_->CalculateTileSize(tiling->tiling_size())) 111 client_->CalculateTileSize(tiling->tiling_size()))
112 << "tile_size: " << tiling->tile_size().ToString() 112 << "tile_size: " << tiling->tile_size().ToString()
113 << " tiling_size: " << tiling->tiling_size().ToString() 113 << " tiling_size: " << tiling->tiling_size().ToString()
114 << " CalculateTileSize: " 114 << " CalculateTileSize: "
115 << client_->CalculateTileSize(tiling->tiling_size()).ToString(); 115 << client_->CalculateTileSize(tiling->tiling_size()).ToString();
116 } 116 }
117 117
118 if (!tilings_.empty()) { 118 if (!tilings_.empty()) {
119 size_t num_high_res = std::count_if(tilings_.begin(), tilings_.end(), 119 DCHECK_LE(NumHighResTilings(), 1);
vmpstr 2015/02/05 18:35:08 heh, oh yeah we have NumHighResTilings
danakj 2015/02/05 18:35:52 i didnt even know/remember that :)
120 [](PictureLayerTiling* tiling) {
121 return tiling->resolution() == HIGH_RESOLUTION;
122 });
123 DCHECK_LE(num_high_res, 1u);
124 // When commiting from the main thread the high res tiling may get dropped, 120 // When commiting from the main thread the high res tiling may get dropped,
125 // but when cloning to the active tree, there should always be one. 121 // but when cloning to the active tree, there should always be one.
126 if (twin_set) 122 if (twin_set) {
127 DCHECK_EQ(1u, num_high_res); 123 DCHECK_EQ(1, NumHighResTilings())
124 << " num tilings on active: " << tilings_.size()
125 << " num tilings on pending: " << twin_set->tilings_.size()
126 << " num high res on pending: " << twin_set->NumHighResTilings()
127 << " are on active tree: " << (client_->GetTree() == ACTIVE_TREE);
128 }
128 } 129 }
129 #endif 130 #endif
130 } 131 }
131 132
132 void PictureLayerTilingSet::CleanUpTilings( 133 void PictureLayerTilingSet::CleanUpTilings(
133 float min_acceptable_high_res_scale, 134 float min_acceptable_high_res_scale,
134 float max_acceptable_high_res_scale, 135 float max_acceptable_high_res_scale,
135 const std::vector<PictureLayerTiling*>& needed_tilings, 136 const std::vector<PictureLayerTiling*>& needed_tilings,
136 bool should_have_low_res, 137 bool should_have_low_res,
137 PictureLayerTilingSet* twin_set, 138 PictureLayerTilingSet* twin_set,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 contents_scale, raster_source, client_, max_tiles_for_interest_area_, 208 contents_scale, raster_source, client_, max_tiles_for_interest_area_,
208 skewport_target_time_in_seconds_, 209 skewport_target_time_in_seconds_,
209 skewport_extrapolation_limit_in_content_pixels_)); 210 skewport_extrapolation_limit_in_content_pixels_));
210 PictureLayerTiling* appended = tilings_.back(); 211 PictureLayerTiling* appended = tilings_.back();
211 212
212 tilings_.sort(LargestToSmallestScaleFunctor()); 213 tilings_.sort(LargestToSmallestScaleFunctor());
213 return appended; 214 return appended;
214 } 215 }
215 216
216 int PictureLayerTilingSet::NumHighResTilings() const { 217 int PictureLayerTilingSet::NumHighResTilings() const {
217 int num_high_res = 0; 218 return std::count_if(tilings_.begin(), tilings_.end(),
218 for (size_t i = 0; i < tilings_.size(); ++i) { 219 [](PictureLayerTiling* tiling) {
219 if (tilings_[i]->resolution() == HIGH_RESOLUTION) 220 return tiling->resolution() == HIGH_RESOLUTION;
220 num_high_res++; 221 });
221 }
222 return num_high_res;
223 } 222 }
224 223
225 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithScale( 224 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithScale(
226 float scale) const { 225 float scale) const {
227 for (size_t i = 0; i < tilings_.size(); ++i) { 226 for (size_t i = 0; i < tilings_.size(); ++i) {
228 if (tilings_[i]->contents_scale() == scale) 227 if (tilings_[i]->contents_scale() == scale)
229 return tilings_[i]; 228 return tilings_[i];
230 } 229 }
231 return NULL; 230 return NULL;
232 } 231 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 case LOWER_THAN_LOW_RES: 535 case LOWER_THAN_LOW_RES:
537 range = TilingRange(low_res_range.end, tilings_.size()); 536 range = TilingRange(low_res_range.end, tilings_.size());
538 break; 537 break;
539 } 538 }
540 539
541 DCHECK_LE(range.start, range.end); 540 DCHECK_LE(range.start, range.end);
542 return range; 541 return range;
543 } 542 }
544 543
545 } // namespace cc 544 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698