| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 paired_layers.begin(); | 93 paired_layers.begin(); |
| 94 it != paired_layers.end(); | 94 it != paired_layers.end(); |
| 95 ++it) { | 95 ++it) { |
| 96 paired_queues_.push_back( | 96 paired_queues_.push_back( |
| 97 make_scoped_ptr(new PairedTilingSetQueue(*it, tree_priority_))); | 97 make_scoped_ptr(new PairedTilingSetQueue(*it, tree_priority_))); |
| 98 } | 98 } |
| 99 | 99 |
| 100 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_)); | 100 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void EvictionTilePriorityQueue::Reset() { | |
| 104 paired_queues_.clear(); | |
| 105 } | |
| 106 | |
| 107 bool EvictionTilePriorityQueue::IsEmpty() const { | 103 bool EvictionTilePriorityQueue::IsEmpty() const { |
| 108 return paired_queues_.empty() || paired_queues_.front()->IsEmpty(); | 104 return paired_queues_.empty() || paired_queues_.front()->IsEmpty(); |
| 109 } | 105 } |
| 110 | 106 |
| 111 Tile* EvictionTilePriorityQueue::Top() { | 107 Tile* EvictionTilePriorityQueue::Top() { |
| 112 DCHECK(!IsEmpty()); | 108 DCHECK(!IsEmpty()); |
| 113 return paired_queues_.front()->Top(tree_priority_); | 109 return paired_queues_.front()->Top(tree_priority_); |
| 114 } | 110 } |
| 115 | 111 |
| 116 void EvictionTilePriorityQueue::Pop() { | 112 void EvictionTilePriorityQueue::Pop() { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 return active_tile->required_for_activation() ? PENDING_TREE : ACTIVE_TREE; | 205 return active_tile->required_for_activation() ? PENDING_TREE : ACTIVE_TREE; |
| 210 } | 206 } |
| 211 | 207 |
| 212 // Return tile with a lower priority. | 208 // Return tile with a lower priority. |
| 213 if (pending_priority.IsHigherPriorityThan(active_priority)) | 209 if (pending_priority.IsHigherPriorityThan(active_priority)) |
| 214 return ACTIVE_TREE; | 210 return ACTIVE_TREE; |
| 215 return PENDING_TREE; | 211 return PENDING_TREE; |
| 216 } | 212 } |
| 217 | 213 |
| 218 } // namespace cc | 214 } // namespace cc |
| OLD | NEW |