OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/eviction_tile_priority_queue.h" | 5 #include "cc/resources/eviction_tile_priority_queue.h" |
6 | 6 |
7 namespace cc { | 7 namespace cc { |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 DCHECK(!IsEmpty()); | 193 DCHECK(!IsEmpty()); |
194 | 194 |
195 // If we only have one iterator with tiles, return it. | 195 // If we only have one iterator with tiles, return it. |
196 if (!active_queue || active_queue->IsEmpty()) | 196 if (!active_queue || active_queue->IsEmpty()) |
197 return PENDING_TREE; | 197 return PENDING_TREE; |
198 if (!pending_queue || pending_queue->IsEmpty()) | 198 if (!pending_queue || pending_queue->IsEmpty()) |
199 return ACTIVE_TREE; | 199 return ACTIVE_TREE; |
200 | 200 |
201 const Tile* active_tile = active_queue->Top(); | 201 const Tile* active_tile = active_queue->Top(); |
202 const Tile* pending_tile = pending_queue->Top(); | 202 const Tile* pending_tile = pending_queue->Top(); |
| 203 |
| 204 // If tiles are the same, it doesn't matter which tree we return. |
203 if (active_tile == pending_tile) | 205 if (active_tile == pending_tile) |
204 return ACTIVE_TREE; | 206 return ACTIVE_TREE; |
205 | 207 |
206 const TilePriority& active_priority = | 208 const TilePriority& active_priority = |
207 active_tile->priority_for_tree_priority(tree_priority); | 209 active_tile->priority_for_tree_priority(tree_priority); |
208 const TilePriority& pending_priority = | 210 const TilePriority& pending_priority = |
209 pending_tile->priority_for_tree_priority(tree_priority); | 211 pending_tile->priority_for_tree_priority(tree_priority); |
210 | 212 |
| 213 // If the bins are the same and activation differs, then return the tree of |
| 214 // the tile not required for activation. |
| 215 if (active_priority.priority_bin == pending_priority.priority_bin && |
| 216 active_tile->required_for_activation() != |
| 217 pending_tile->required_for_activation()) { |
| 218 return active_tile->required_for_activation() ? PENDING_TREE : ACTIVE_TREE; |
| 219 } |
| 220 |
| 221 // Return tile with a lower priority. |
211 if (pending_priority.IsHigherPriorityThan(active_priority)) | 222 if (pending_priority.IsHigherPriorityThan(active_priority)) |
212 return ACTIVE_TREE; | 223 return ACTIVE_TREE; |
213 return PENDING_TREE; | 224 return PENDING_TREE; |
214 } | 225 } |
215 | 226 |
216 } // namespace cc | 227 } // namespace cc |
OLD | NEW |