Commit b4ec0e9e authored by vmpstr's avatar vmpstr Committed by Commit bot

cc: Ensure that eviction tiling range is sane.

Currently our code assumes that high res tiling comes before the low
res tiling (for eviction iterators). However, that doesn't seem to be
the case in all situations. Rather that just fixing the problem (if
it is a problem), this patch makes the eviction code be able to proceed
without crashing. In these situations the eviction order of tilings
won't be ideal, but would still visit all tilings.

BUG=429397, 429201
R=danakj, reveman

Review URL: https://codereview.chromium.org/694143002

Cr-Commit-Position: refs/heads/master@{#302394}
parent e0b723c4
...@@ -339,21 +339,36 @@ PictureLayerTilingSet::TilingRange PictureLayerTilingSet::GetTilingRange( ...@@ -339,21 +339,36 @@ PictureLayerTilingSet::TilingRange PictureLayerTilingSet::GetTilingRange(
low_res_range = TilingRange(i, i + 1); low_res_range = TilingRange(i, i + 1);
} }
TilingRange range(0, 0);
switch (type) { switch (type) {
case HIGHER_THAN_HIGH_RES: case HIGHER_THAN_HIGH_RES:
return TilingRange(0, high_res_range.start); range = TilingRange(0, high_res_range.start);
break;
case HIGH_RES: case HIGH_RES:
return high_res_range; range = high_res_range;
break;
case BETWEEN_HIGH_AND_LOW_RES: case BETWEEN_HIGH_AND_LOW_RES:
return TilingRange(high_res_range.end, low_res_range.start); // TODO(vmpstr): This code assumes that high res tiling will come before
// low res tiling, however there are cases where this assumption is
// violated. As a result, it's better to be safe in these situations,
// since otherwise we can end up accessing a tiling that doesn't exist.
// See crbug.com/429397 for high res tiling appearing after low res
// tiling discussion/fixes.
if (high_res_range.start <= low_res_range.start)
range = TilingRange(high_res_range.end, low_res_range.start);
else
range = TilingRange(low_res_range.end, high_res_range.start);
break;
case LOW_RES: case LOW_RES:
return low_res_range; range = low_res_range;
break;
case LOWER_THAN_LOW_RES: case LOWER_THAN_LOW_RES:
return TilingRange(low_res_range.end, tilings_.size()); range = TilingRange(low_res_range.end, tilings_.size());
break;
} }
NOTREACHED(); DCHECK_LE(range.start, range.end);
return TilingRange(0, 0); return range;
} }
} // namespace cc } // namespace cc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment