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

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

Issue 694143002: cc: Ensure that eviction tiling range is sane. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 TilingRange high_res_range(0, 0); 332 TilingRange high_res_range(0, 0);
333 TilingRange low_res_range(tilings_.size(), tilings_.size()); 333 TilingRange low_res_range(tilings_.size(), tilings_.size());
334 for (size_t i = 0; i < tilings_.size(); ++i) { 334 for (size_t i = 0; i < tilings_.size(); ++i) {
335 const PictureLayerTiling* tiling = tilings_[i]; 335 const PictureLayerTiling* tiling = tilings_[i];
336 if (tiling->resolution() == HIGH_RESOLUTION) 336 if (tiling->resolution() == HIGH_RESOLUTION)
337 high_res_range = TilingRange(i, i + 1); 337 high_res_range = TilingRange(i, i + 1);
338 if (tiling->resolution() == LOW_RESOLUTION) 338 if (tiling->resolution() == LOW_RESOLUTION)
339 low_res_range = TilingRange(i, i + 1); 339 low_res_range = TilingRange(i, i + 1);
340 } 340 }
341 341
342 TilingRange range(0, 0);
342 switch (type) { 343 switch (type) {
343 case HIGHER_THAN_HIGH_RES: 344 case HIGHER_THAN_HIGH_RES:
344 return TilingRange(0, high_res_range.start); 345 range = TilingRange(0, high_res_range.start);
346 break;
345 case HIGH_RES: 347 case HIGH_RES:
346 return high_res_range; 348 range = high_res_range;
349 break;
347 case BETWEEN_HIGH_AND_LOW_RES: 350 case BETWEEN_HIGH_AND_LOW_RES:
348 return TilingRange(high_res_range.end, low_res_range.start); 351 // TODO(vmpstr): This code assumes that high res tiling will come before
352 // low res tiling, however there are cases where this assumption is
353 // violated. As a result, it's better to be safe in these situations,
354 // since otherwise we can end up accessing a tile that doesn't exist. See
355 // crbug.com/429397 for high res tiling appearing after low res tiling.
356 if (high_res_range.start <= low_res_range.start)
357 range = TilingRange(high_res_range.end, low_res_range.start);
358 else
359 range = TilingRange(low_res_range.end, high_res_range.start);
360 break;
349 case LOW_RES: 361 case LOW_RES:
350 return low_res_range; 362 range = low_res_range;
reveman 2014/11/01 12:25:34 missing a break statement here
vmpstr 2014/11/01 18:08:49 Done.
351 case LOWER_THAN_LOW_RES: 363 case LOWER_THAN_LOW_RES:
352 return TilingRange(low_res_range.end, tilings_.size()); 364 range = TilingRange(low_res_range.end, tilings_.size());
reveman 2014/11/01 12:25:34 and I think you should add a break statement here
vmpstr 2014/11/01 18:08:49 Done.
353 } 365 }
354 366
355 NOTREACHED(); 367 DCHECK_LE(range.start, range.end);
356 return TilingRange(0, 0); 368 return range;
357 } 369 }
358 370
359 } // namespace cc 371 } // 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