| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 void EvictionTilePriorityQueue::Build( | 87 void EvictionTilePriorityQueue::Build( |
| 88 const std::vector<PictureLayerImpl::Pair>& paired_layers, | 88 const std::vector<PictureLayerImpl::Pair>& paired_layers, |
| 89 TreePriority tree_priority) { | 89 TreePriority tree_priority) { |
| 90 tree_priority_ = tree_priority; | 90 tree_priority_ = tree_priority; |
| 91 | 91 |
| 92 for (std::vector<PictureLayerImpl::Pair>::const_iterator it = | 92 for (std::vector<PictureLayerImpl::Pair>::const_iterator it = |
| 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(make_scoped_ptr(new PairedPictureLayerQueue(*it))); |
| 97 make_scoped_ptr(new PairedPictureLayerQueue(*it, tree_priority_))); | |
| 98 } | 97 } |
| 99 | 98 |
| 100 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_)); | 99 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_)); |
| 101 } | 100 } |
| 102 | 101 |
| 103 void EvictionTilePriorityQueue::Reset() { | 102 void EvictionTilePriorityQueue::Reset() { |
| 104 paired_queues_.clear(); | 103 paired_queues_.clear(); |
| 105 } | 104 } |
| 106 | 105 |
| 107 bool EvictionTilePriorityQueue::IsEmpty() const { | 106 bool EvictionTilePriorityQueue::IsEmpty() const { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 119 paired_queues_.pop_heap(EvictionOrderComparator(tree_priority_)); | 118 paired_queues_.pop_heap(EvictionOrderComparator(tree_priority_)); |
| 120 PairedPictureLayerQueue* paired_queue = paired_queues_.back(); | 119 PairedPictureLayerQueue* paired_queue = paired_queues_.back(); |
| 121 paired_queue->Pop(tree_priority_); | 120 paired_queue->Pop(tree_priority_); |
| 122 paired_queues_.push_heap(EvictionOrderComparator(tree_priority_)); | 121 paired_queues_.push_heap(EvictionOrderComparator(tree_priority_)); |
| 123 } | 122 } |
| 124 | 123 |
| 125 EvictionTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue() { | 124 EvictionTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue() { |
| 126 } | 125 } |
| 127 | 126 |
| 128 EvictionTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue( | 127 EvictionTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue( |
| 129 const PictureLayerImpl::Pair& layer_pair, | 128 const PictureLayerImpl::Pair& layer_pair) |
| 130 TreePriority tree_priority) | |
| 131 : active_iterator( | 129 : active_iterator( |
| 132 layer_pair.active | 130 layer_pair.active |
| 133 ? PictureLayerImpl::LayerEvictionTileIterator(layer_pair.active, | 131 ? PictureLayerImpl::LayerEvictionTileIterator(layer_pair.active) |
| 134 tree_priority) | |
| 135 : PictureLayerImpl::LayerEvictionTileIterator()), | 132 : PictureLayerImpl::LayerEvictionTileIterator()), |
| 136 pending_iterator( | 133 pending_iterator( |
| 137 layer_pair.pending | 134 layer_pair.pending |
| 138 ? PictureLayerImpl::LayerEvictionTileIterator(layer_pair.pending, | 135 ? PictureLayerImpl::LayerEvictionTileIterator(layer_pair.pending) |
| 139 tree_priority) | |
| 140 : PictureLayerImpl::LayerEvictionTileIterator()) { | 136 : PictureLayerImpl::LayerEvictionTileIterator()) { |
| 141 } | 137 } |
| 142 | 138 |
| 143 EvictionTilePriorityQueue::PairedPictureLayerQueue::~PairedPictureLayerQueue() { | 139 EvictionTilePriorityQueue::PairedPictureLayerQueue::~PairedPictureLayerQueue() { |
| 144 } | 140 } |
| 145 | 141 |
| 146 bool EvictionTilePriorityQueue::PairedPictureLayerQueue::IsEmpty() const { | 142 bool EvictionTilePriorityQueue::PairedPictureLayerQueue::IsEmpty() const { |
| 147 return !active_iterator && !pending_iterator; | 143 return !active_iterator && !pending_iterator; |
| 148 } | 144 } |
| 149 | 145 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 active_tile->priority_for_tree_priority(tree_priority); | 208 active_tile->priority_for_tree_priority(tree_priority); |
| 213 const TilePriority& pending_priority = | 209 const TilePriority& pending_priority = |
| 214 pending_tile->priority_for_tree_priority(tree_priority); | 210 pending_tile->priority_for_tree_priority(tree_priority); |
| 215 | 211 |
| 216 if (pending_priority.IsHigherPriorityThan(active_priority)) | 212 if (pending_priority.IsHigherPriorityThan(active_priority)) |
| 217 return ACTIVE_TREE; | 213 return ACTIVE_TREE; |
| 218 return PENDING_TREE; | 214 return PENDING_TREE; |
| 219 } | 215 } |
| 220 | 216 |
| 221 } // namespace cc | 217 } // namespace cc |
| OLD | NEW |