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/raster_tile_priority_queue.h" | 5 #include "cc/resources/raster_tile_priority_queue.h" |
6 | 6 |
7 namespace cc { | 7 namespace cc { |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 void RasterTilePriorityQueue::Build( | 78 void RasterTilePriorityQueue::Build( |
79 const std::vector<PictureLayerImpl::Pair>& paired_layers, | 79 const std::vector<PictureLayerImpl::Pair>& paired_layers, |
80 TreePriority tree_priority) { | 80 TreePriority tree_priority) { |
81 tree_priority_ = tree_priority; | 81 tree_priority_ = tree_priority; |
82 for (std::vector<PictureLayerImpl::Pair>::const_iterator it = | 82 for (std::vector<PictureLayerImpl::Pair>::const_iterator it = |
83 paired_layers.begin(); | 83 paired_layers.begin(); |
84 it != paired_layers.end(); | 84 it != paired_layers.end(); |
85 ++it) { | 85 ++it) { |
86 paired_queues_heap_.push_back( | 86 paired_queues_.push_back( |
87 make_scoped_ptr(new PairedPictureLayerQueue(*it, tree_priority_))); | 87 make_scoped_ptr(new PairedPictureLayerQueue(*it, tree_priority_))); |
88 } | 88 } |
89 | 89 |
90 paired_queues_heap_.make_heap(RasterOrderComparator(tree_priority_)); | 90 paired_queues_.make_heap(RasterOrderComparator(tree_priority_)); |
91 } | 91 } |
92 | 92 |
93 void RasterTilePriorityQueue::Reset() { | 93 void RasterTilePriorityQueue::Reset() { |
94 paired_queues_heap_.clear(); | 94 paired_queues_.clear(); |
95 } | 95 } |
96 | 96 |
97 bool RasterTilePriorityQueue::IsEmpty() const { | 97 bool RasterTilePriorityQueue::IsEmpty() const { |
98 return paired_queues_heap_.empty() || paired_queues_heap_.front()->IsEmpty(); | 98 return paired_queues_.empty() || paired_queues_.front()->IsEmpty(); |
99 } | 99 } |
100 | 100 |
101 Tile* RasterTilePriorityQueue::Top() { | 101 Tile* RasterTilePriorityQueue::Top() { |
102 DCHECK(!IsEmpty()); | 102 DCHECK(!IsEmpty()); |
103 return paired_queues_heap_.front()->Top(tree_priority_); | 103 return paired_queues_.front()->Top(tree_priority_); |
104 } | 104 } |
105 | 105 |
106 void RasterTilePriorityQueue::Pop() { | 106 void RasterTilePriorityQueue::Pop() { |
107 DCHECK(!IsEmpty()); | 107 DCHECK(!IsEmpty()); |
108 | 108 |
109 paired_queues_heap_.pop_heap(RasterOrderComparator(tree_priority_)); | 109 paired_queues_.pop_heap(RasterOrderComparator(tree_priority_)); |
110 PairedPictureLayerQueue* paired_queue = paired_queues_heap_.back(); | 110 PairedPictureLayerQueue* paired_queue = paired_queues_.back(); |
111 paired_queue->Pop(tree_priority_); | 111 paired_queue->Pop(tree_priority_); |
112 paired_queues_heap_.push_heap(RasterOrderComparator(tree_priority_)); | 112 paired_queues_.push_heap(RasterOrderComparator(tree_priority_)); |
113 } | 113 } |
114 | 114 |
115 RasterTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue() { | 115 RasterTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue() { |
116 } | 116 } |
117 | 117 |
118 RasterTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue( | 118 RasterTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue( |
119 const PictureLayerImpl::Pair& layer_pair, | 119 const PictureLayerImpl::Pair& layer_pair, |
120 TreePriority tree_priority) | 120 TreePriority tree_priority) |
121 : active_iterator(layer_pair.active | 121 : active_iterator(layer_pair.active |
122 ? PictureLayerImpl::LayerRasterTileIterator( | 122 ? PictureLayerImpl::LayerRasterTileIterator( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 default: | 215 default: |
216 NOTREACHED(); | 216 NOTREACHED(); |
217 } | 217 } |
218 | 218 |
219 NOTREACHED(); | 219 NOTREACHED(); |
220 // Keep the compiler happy. | 220 // Keep the compiler happy. |
221 return ACTIVE_TREE; | 221 return ACTIVE_TREE; |
222 } | 222 } |
223 | 223 |
224 } // namespace cc | 224 } // namespace cc |
OLD | NEW |