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 baddcf13cee9627225c7ae47853729930f080b8e..5cb9cf88a3e46649b724389b18f9384ed3b5e0dd 100644 |
| --- a/cc/resources/picture_layer_tiling.cc |
| +++ b/cc/resources/picture_layer_tiling.cc |
| @@ -35,11 +35,41 @@ class TileEvictionOrder { |
| const TilePriority& b_priority = |
| b->priority_for_tree_priority(tree_priority_); |
| - if (a_priority.priority_bin == b_priority.priority_bin && |
| - a->required_for_activation() != b->required_for_activation()) { |
| + // Evict a before b if their priority bins differ and a has the higher |
| + // priority bin. |
| + if (a_priority.priority_bin != b_priority.priority_bin) |
| + return a_priority.priority_bin > b_priority.priority_bin; |
| + |
| + // Or if a is not required and b is required. |
| + if (a->required_for_activation() != b->required_for_activation()) |
| return b->required_for_activation(); |
| + |
| + // Or if a is occluded and b is unoccluded. |
| + bool a_is_occluded; |
|
danakj
2014/07/09 17:38:40
initialize these to false
|
| + bool b_is_occluded; |
| + |
| + switch (tree_priority_) { |
|
vmpstr
2014/07/09 23:23:06
Maybe it's worth having something like is_occluded
jbedley
2014/07/11 00:19:38
Done.
|
| + case SMOOTHNESS_TAKES_PRIORITY: |
| + a_is_occluded = a->is_occluded(ACTIVE_TREE); |
| + b_is_occluded = b->is_occluded(ACTIVE_TREE); |
| + break; |
| + case NEW_CONTENT_TAKES_PRIORITY: |
| + a_is_occluded = a->is_occluded(PENDING_TREE); |
| + b_is_occluded = b->is_occluded(PENDING_TREE); |
| + break; |
| + case SAME_PRIORITY_FOR_BOTH_TREES: |
| + a_is_occluded = |
| + a->is_occluded(ACTIVE_TREE) && a->is_occluded(PENDING_TREE); |
| + b_is_occluded = |
| + b->is_occluded(ACTIVE_TREE) && a->is_occluded(PENDING_TREE); |
| + break; |
| } |
| - return b_priority.IsHigherPriorityThan(a_priority); |
| + |
| + if (a_is_occluded != b_is_occluded) |
| + return a_is_occluded; |
| + |
| + // Or if a is farther away from visible. |
| + return a_priority.distance_to_visible > b_priority.distance_to_visible; |
| } |
| private: |