Chromium Code Reviews| Index: cc/resources/picture_layer_tiling.cc |
| diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc |
| index 12ab4af1d434b45c2a177c8ee97623e0c505a00c..0d256772d37c568dd24c18bced0b1fdd4fb4aadc 100644 |
| --- a/cc/resources/picture_layer_tiling.cc |
| +++ b/cc/resources/picture_layer_tiling.cc |
| @@ -41,9 +41,7 @@ class TileEvictionOrder { |
| if (a_priority.priority_bin != b_priority.priority_bin) |
| return a_priority.priority_bin > b_priority.priority_bin; |
|
reveman
2014/08/14 09:01:50
should this not be a DCHECK too?
vmpstr
2014/08/14 22:05:50
Good point, yes!
|
| - // Or if a is not required and b is required. |
| - if (a->required_for_activation() != b->required_for_activation()) |
| - return b->required_for_activation(); |
| + DCHECK(a->required_for_activation() == b->required_for_activation()); |
| // Or if a is occluded and b is unoccluded. |
| bool a_is_occluded = a->is_occluded_for_tree_priority(tree_priority_); |
| @@ -847,10 +845,8 @@ void PictureLayerTiling::UpdateEvictionCacheIfNeeded( |
| eviction_cache_tree_priority_ == tree_priority) |
| return; |
| - eventually_eviction_tiles_.clear(); |
| - soon_eviction_tiles_.clear(); |
| - now_eviction_tiles_.clear(); |
| - now_and_required_for_activation_eviction_tiles_.clear(); |
| + for (int i = 0; i < NUM_EVICTION_CATEGORIES; ++i) |
| + eviction_tiles_[i].clear(); |
| for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| // TODO(vmpstr): This should update the priority if UpdateTilePriorities |
| @@ -860,16 +856,23 @@ void PictureLayerTiling::UpdateEvictionCacheIfNeeded( |
| tile->priority_for_tree_priority(tree_priority); |
| switch (priority.priority_bin) { |
| case TilePriority::EVENTUALLY: |
| - eventually_eviction_tiles_.push_back(tile); |
| + if (tile->required_for_activation()) |
| + eviction_tiles_[EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION].push_back( |
| + tile); |
| + else |
| + eviction_tiles_[EVENTUALLY].push_back(tile); |
| break; |
| case TilePriority::SOON: |
| - soon_eviction_tiles_.push_back(tile); |
| + if (tile->required_for_activation()) |
| + eviction_tiles_[SOON_AND_REQUIRED_FOR_ACTIVATION].push_back(tile); |
| + else |
| + eviction_tiles_[SOON].push_back(tile); |
| break; |
| case TilePriority::NOW: |
| if (tile->required_for_activation()) |
| - now_and_required_for_activation_eviction_tiles_.push_back(tile); |
| + eviction_tiles_[NOW_AND_REQUIRED_FOR_ACTIVATION].push_back(tile); |
| else |
| - now_eviction_tiles_.push_back(tile); |
| + eviction_tiles_[NOW].push_back(tile); |
| break; |
| } |
| } |
| @@ -877,15 +880,9 @@ void PictureLayerTiling::UpdateEvictionCacheIfNeeded( |
| // TODO(vmpstr): Do this lazily. One option is to have a "sorted" flag that |
| // can be updated for each of the queues. |
| TileEvictionOrder sort_order(tree_priority); |
| - std::sort(eventually_eviction_tiles_.begin(), |
| - eventually_eviction_tiles_.end(), |
| - sort_order); |
| - std::sort( |
| - soon_eviction_tiles_.begin(), soon_eviction_tiles_.end(), sort_order); |
| - std::sort(now_eviction_tiles_.begin(), now_eviction_tiles_.end(), sort_order); |
| - std::sort(now_and_required_for_activation_eviction_tiles_.begin(), |
| - now_and_required_for_activation_eviction_tiles_.end(), |
| - sort_order); |
| + for (int i = 0; i < NUM_EVICTION_CATEGORIES; ++i) { |
| + std::sort(eviction_tiles_[i].begin(), eviction_tiles_[i].end(), sort_order); |
| + } |
| eviction_tiles_cache_valid_ = true; |
| eviction_cache_tree_priority_ = tree_priority; |
| @@ -895,18 +892,7 @@ const std::vector<Tile*>* PictureLayerTiling::GetEvictionTiles( |
| TreePriority tree_priority, |
| EvictionCategory category) { |
| UpdateEvictionCacheIfNeeded(tree_priority); |
| - switch (category) { |
| - case EVENTUALLY: |
| - return &eventually_eviction_tiles_; |
| - case SOON: |
| - return &soon_eviction_tiles_; |
| - case NOW: |
| - return &now_eviction_tiles_; |
| - case NOW_AND_REQUIRED_FOR_ACTIVATION: |
| - return &now_and_required_for_activation_eviction_tiles_; |
| - } |
| - NOTREACHED(); |
| - return &eventually_eviction_tiles_; |
| + return &eviction_tiles_[category]; |
| } |
| PictureLayerTiling::TilingRasterTileIterator::TilingRasterTileIterator() |