| 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 |
| 11 class RasterOrderComparator { | 11 class RasterOrderComparator { |
| 12 public: | 12 public: |
| 13 explicit RasterOrderComparator(TreePriority tree_priority) | 13 explicit RasterOrderComparator(TreePriority tree_priority) |
| 14 : tree_priority_(tree_priority) {} | 14 : tree_priority_(tree_priority) {} |
| 15 | 15 |
| 16 bool operator()( | 16 bool operator()( |
| 17 const RasterTilePriorityQueue::PairedPictureLayerQueue* a, | 17 const RasterTilePriorityQueue::PairedTilingSetQueue* a, |
| 18 const RasterTilePriorityQueue::PairedPictureLayerQueue* b) const { | 18 const RasterTilePriorityQueue::PairedTilingSetQueue* b) const { |
| 19 // Note that in this function, we have to return true if and only if | 19 // Note that in this function, we have to return true if and only if |
| 20 // a is strictly lower priority than b. Note that for the sake of | 20 // a is strictly lower priority than b. Note that for the sake of |
| 21 // completeness, empty queue is considered to have lowest priority. | 21 // completeness, empty queue is considered to have lowest priority. |
| 22 if (a->IsEmpty() || b->IsEmpty()) | 22 if (a->IsEmpty() || b->IsEmpty()) |
| 23 return b->IsEmpty() < a->IsEmpty(); | 23 return b->IsEmpty() < a->IsEmpty(); |
| 24 | 24 |
| 25 WhichTree a_tree = a->NextTileIteratorTree(tree_priority_); | 25 WhichTree a_tree = a->NextTileIteratorTree(tree_priority_); |
| 26 const PictureLayerImpl::LayerRasterTileIterator* a_iterator = | 26 const auto* a_queue = |
| 27 a_tree == ACTIVE_TREE ? &a->active_iterator : &a->pending_iterator; | 27 a_tree == ACTIVE_TREE ? a->active_queue.get() : a->pending_queue.get(); |
| 28 | 28 |
| 29 WhichTree b_tree = b->NextTileIteratorTree(tree_priority_); | 29 WhichTree b_tree = b->NextTileIteratorTree(tree_priority_); |
| 30 const PictureLayerImpl::LayerRasterTileIterator* b_iterator = | 30 const auto* b_queue = |
| 31 b_tree == ACTIVE_TREE ? &b->active_iterator : &b->pending_iterator; | 31 b_tree == ACTIVE_TREE ? b->active_queue.get() : b->pending_queue.get(); |
| 32 | 32 |
| 33 const Tile* a_tile = **a_iterator; | 33 const Tile* a_tile = a_queue->Top(); |
| 34 const Tile* b_tile = **b_iterator; | 34 const Tile* b_tile = b_queue->Top(); |
| 35 | 35 |
| 36 const TilePriority& a_priority = | 36 const TilePriority& a_priority = |
| 37 a_tile->priority_for_tree_priority(tree_priority_); | 37 a_tile->priority_for_tree_priority(tree_priority_); |
| 38 const TilePriority& b_priority = | 38 const TilePriority& b_priority = |
| 39 b_tile->priority_for_tree_priority(tree_priority_); | 39 b_tile->priority_for_tree_priority(tree_priority_); |
| 40 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; | 40 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; |
| 41 | 41 |
| 42 // In smoothness mode, we should return pending NOW tiles before active | 42 // In smoothness mode, we should return pending NOW tiles before active |
| 43 // EVENTUALLY tiles. So if both priorities here are eventually, we need to | 43 // EVENTUALLY tiles. So if both priorities here are eventually, we need to |
| 44 // check the pending priority. | 44 // check the pending priority. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 73 return b_priority.resolution == HIGH_RESOLUTION; | 73 return b_priority.resolution == HIGH_RESOLUTION; |
| 74 } | 74 } |
| 75 | 75 |
| 76 return b_priority.IsHigherPriorityThan(a_priority); | 76 return b_priority.IsHigherPriorityThan(a_priority); |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 TreePriority tree_priority_; | 80 TreePriority tree_priority_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 WhichTree HigherPriorityTree( | 83 WhichTree HigherPriorityTree(TreePriority tree_priority, |
| 84 TreePriority tree_priority, | 84 const TilingSetRasterQueue* active_queue, |
| 85 const PictureLayerImpl::LayerRasterTileIterator* active_iterator, | 85 const TilingSetRasterQueue* pending_queue, |
| 86 const PictureLayerImpl::LayerRasterTileIterator* pending_iterator, | 86 const Tile* shared_tile) { |
| 87 const Tile* shared_tile) { | |
| 88 switch (tree_priority) { | 87 switch (tree_priority) { |
| 89 case SMOOTHNESS_TAKES_PRIORITY: { | 88 case SMOOTHNESS_TAKES_PRIORITY: { |
| 90 const Tile* active_tile = shared_tile ? shared_tile : **active_iterator; | 89 const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top(); |
| 91 const Tile* pending_tile = shared_tile ? shared_tile : **pending_iterator; | 90 const Tile* pending_tile = |
| 91 shared_tile ? shared_tile : pending_queue->Top(); |
| 92 | 92 |
| 93 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); | 93 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); |
| 94 const TilePriority& pending_priority = | 94 const TilePriority& pending_priority = |
| 95 pending_tile->priority(PENDING_TREE); | 95 pending_tile->priority(PENDING_TREE); |
| 96 | 96 |
| 97 // If we're down to eventually bin tiles on the active tree, process the | 97 // If we're down to eventually bin tiles on the active tree, process the |
| 98 // pending tree to allow tiles required for activation to be initialized | 98 // pending tree to allow tiles required for activation to be initialized |
| 99 // when memory policy only allows prepaint. | 99 // when memory policy only allows prepaint. |
| 100 if (active_priority.priority_bin == TilePriority::EVENTUALLY && | 100 if (active_priority.priority_bin == TilePriority::EVENTUALLY && |
| 101 pending_priority.priority_bin == TilePriority::NOW) { | 101 pending_priority.priority_bin == TilePriority::NOW) { |
| 102 return PENDING_TREE; | 102 return PENDING_TREE; |
| 103 } | 103 } |
| 104 return ACTIVE_TREE; | 104 return ACTIVE_TREE; |
| 105 } | 105 } |
| 106 case NEW_CONTENT_TAKES_PRIORITY: | 106 case NEW_CONTENT_TAKES_PRIORITY: |
| 107 return PENDING_TREE; | 107 return PENDING_TREE; |
| 108 case SAME_PRIORITY_FOR_BOTH_TREES: { | 108 case SAME_PRIORITY_FOR_BOTH_TREES: { |
| 109 const Tile* active_tile = shared_tile ? shared_tile : **active_iterator; | 109 const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top(); |
| 110 const Tile* pending_tile = shared_tile ? shared_tile : **pending_iterator; | 110 const Tile* pending_tile = |
| 111 shared_tile ? shared_tile : pending_queue->Top(); |
| 111 | 112 |
| 112 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); | 113 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); |
| 113 const TilePriority& pending_priority = | 114 const TilePriority& pending_priority = |
| 114 pending_tile->priority(PENDING_TREE); | 115 pending_tile->priority(PENDING_TREE); |
| 115 | 116 |
| 116 if (active_priority.IsHigherPriorityThan(pending_priority)) | 117 if (active_priority.IsHigherPriorityThan(pending_priority)) |
| 117 return ACTIVE_TREE; | 118 return ACTIVE_TREE; |
| 118 return PENDING_TREE; | 119 return PENDING_TREE; |
| 119 } | 120 } |
| 120 default: | 121 default: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 133 | 134 |
| 134 void RasterTilePriorityQueue::Build( | 135 void RasterTilePriorityQueue::Build( |
| 135 const std::vector<PictureLayerImpl::Pair>& paired_layers, | 136 const std::vector<PictureLayerImpl::Pair>& paired_layers, |
| 136 TreePriority tree_priority) { | 137 TreePriority tree_priority) { |
| 137 tree_priority_ = tree_priority; | 138 tree_priority_ = tree_priority; |
| 138 for (std::vector<PictureLayerImpl::Pair>::const_iterator it = | 139 for (std::vector<PictureLayerImpl::Pair>::const_iterator it = |
| 139 paired_layers.begin(); | 140 paired_layers.begin(); |
| 140 it != paired_layers.end(); | 141 it != paired_layers.end(); |
| 141 ++it) { | 142 ++it) { |
| 142 paired_queues_.push_back( | 143 paired_queues_.push_back( |
| 143 make_scoped_ptr(new PairedPictureLayerQueue(*it, tree_priority_))); | 144 make_scoped_ptr(new PairedTilingSetQueue(*it, tree_priority_))); |
| 144 } | 145 } |
| 145 paired_queues_.make_heap(RasterOrderComparator(tree_priority_)); | 146 paired_queues_.make_heap(RasterOrderComparator(tree_priority_)); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void RasterTilePriorityQueue::Reset() { | 149 void RasterTilePriorityQueue::Reset() { |
| 149 paired_queues_.clear(); | 150 paired_queues_.clear(); |
| 150 } | 151 } |
| 151 | 152 |
| 152 bool RasterTilePriorityQueue::IsEmpty() const { | 153 bool RasterTilePriorityQueue::IsEmpty() const { |
| 153 return paired_queues_.empty() || paired_queues_.front()->IsEmpty(); | 154 return paired_queues_.empty() || paired_queues_.front()->IsEmpty(); |
| 154 } | 155 } |
| 155 | 156 |
| 156 Tile* RasterTilePriorityQueue::Top() { | 157 Tile* RasterTilePriorityQueue::Top() { |
| 157 DCHECK(!IsEmpty()); | 158 DCHECK(!IsEmpty()); |
| 158 return paired_queues_.front()->Top(tree_priority_); | 159 return paired_queues_.front()->Top(tree_priority_); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void RasterTilePriorityQueue::Pop() { | 162 void RasterTilePriorityQueue::Pop() { |
| 162 DCHECK(!IsEmpty()); | 163 DCHECK(!IsEmpty()); |
| 163 | 164 |
| 164 paired_queues_.pop_heap(RasterOrderComparator(tree_priority_)); | 165 paired_queues_.pop_heap(RasterOrderComparator(tree_priority_)); |
| 165 PairedPictureLayerQueue* paired_queue = paired_queues_.back(); | 166 PairedTilingSetQueue* paired_queue = paired_queues_.back(); |
| 166 paired_queue->Pop(tree_priority_); | 167 paired_queue->Pop(tree_priority_); |
| 167 paired_queues_.push_heap(RasterOrderComparator(tree_priority_)); | 168 paired_queues_.push_heap(RasterOrderComparator(tree_priority_)); |
| 168 } | 169 } |
| 169 | 170 |
| 170 RasterTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue() { | 171 RasterTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue() { |
| 171 } | 172 } |
| 172 | 173 |
| 173 RasterTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue( | 174 RasterTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue( |
| 174 const PictureLayerImpl::Pair& layer_pair, | 175 const PictureLayerImpl::Pair& layer_pair, |
| 175 TreePriority tree_priority) | 176 TreePriority tree_priority) |
| 176 : active_iterator(layer_pair.active | 177 : has_both_layers(layer_pair.active && layer_pair.pending) { |
| 177 ? PictureLayerImpl::LayerRasterTileIterator( | 178 if (layer_pair.active) { |
| 178 layer_pair.active, | 179 active_queue = layer_pair.active->CreateRasterQueue( |
| 179 tree_priority == SMOOTHNESS_TAKES_PRIORITY) | 180 tree_priority == SMOOTHNESS_TAKES_PRIORITY); |
| 180 : PictureLayerImpl::LayerRasterTileIterator()), | 181 } |
| 181 pending_iterator(layer_pair.pending | 182 |
| 182 ? PictureLayerImpl::LayerRasterTileIterator( | 183 if (layer_pair.pending) { |
| 183 layer_pair.pending, | 184 pending_queue = layer_pair.pending->CreateRasterQueue( |
| 184 tree_priority == SMOOTHNESS_TAKES_PRIORITY) | 185 tree_priority == SMOOTHNESS_TAKES_PRIORITY); |
| 185 : PictureLayerImpl::LayerRasterTileIterator()), | 186 } |
| 186 has_both_layers(layer_pair.active && layer_pair.pending) { | 187 |
| 187 if (has_both_layers) | 188 if (has_both_layers) |
| 188 SkipTilesReturnedByTwin(tree_priority); | 189 SkipTilesReturnedByTwin(tree_priority); |
| 190 |
| 189 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 191 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 190 "PairedPictureLayerQueue::PairedPictureLayerQueue", | 192 "PairedTilingSetQueue::PairedTilingSetQueue", |
| 191 TRACE_EVENT_SCOPE_THREAD, | 193 TRACE_EVENT_SCOPE_THREAD, "state", StateAsValue()); |
| 192 "state", | |
| 193 StateAsValue()); | |
| 194 } | 194 } |
| 195 | 195 |
| 196 RasterTilePriorityQueue::PairedPictureLayerQueue::~PairedPictureLayerQueue() { | 196 RasterTilePriorityQueue::PairedTilingSetQueue::~PairedTilingSetQueue() { |
| 197 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 197 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 198 "PairedPictureLayerQueue::~PairedPictureLayerQueue", | 198 "PairedTilingSetQueue::~PairedTilingSetQueue", |
| 199 TRACE_EVENT_SCOPE_THREAD, | 199 TRACE_EVENT_SCOPE_THREAD, "state", StateAsValue()); |
| 200 "state", | |
| 201 StateAsValue()); | |
| 202 } | 200 } |
| 203 | 201 |
| 204 bool RasterTilePriorityQueue::PairedPictureLayerQueue::IsEmpty() const { | 202 bool RasterTilePriorityQueue::PairedTilingSetQueue::IsEmpty() const { |
| 205 return !active_iterator && !pending_iterator; | 203 return (!active_queue || active_queue->IsEmpty()) && |
| 204 (!pending_queue || pending_queue->IsEmpty()); |
| 206 } | 205 } |
| 207 | 206 |
| 208 Tile* RasterTilePriorityQueue::PairedPictureLayerQueue::Top( | 207 Tile* RasterTilePriorityQueue::PairedTilingSetQueue::Top( |
| 209 TreePriority tree_priority) { | 208 TreePriority tree_priority) { |
| 210 DCHECK(!IsEmpty()); | 209 DCHECK(!IsEmpty()); |
| 211 | 210 |
| 212 WhichTree next_tree = NextTileIteratorTree(tree_priority); | 211 WhichTree next_tree = NextTileIteratorTree(tree_priority); |
| 213 PictureLayerImpl::LayerRasterTileIterator* next_iterator = | 212 TilingSetRasterQueue* next_queue = |
| 214 next_tree == ACTIVE_TREE ? &active_iterator : &pending_iterator; | 213 next_tree == ACTIVE_TREE ? active_queue.get() : pending_queue.get(); |
| 215 DCHECK(*next_iterator); | 214 DCHECK(next_queue && !next_queue->IsEmpty()); |
| 216 Tile* tile = **next_iterator; | 215 Tile* tile = next_queue->Top(); |
| 217 DCHECK(returned_tiles_for_debug.find(tile) == returned_tiles_for_debug.end()); | 216 DCHECK(returned_tiles_for_debug.find(tile) == returned_tiles_for_debug.end()); |
| 218 return tile; | 217 return tile; |
| 219 } | 218 } |
| 220 | 219 |
| 221 void RasterTilePriorityQueue::PairedPictureLayerQueue::Pop( | 220 void RasterTilePriorityQueue::PairedTilingSetQueue::Pop( |
| 222 TreePriority tree_priority) { | 221 TreePriority tree_priority) { |
| 223 DCHECK(!IsEmpty()); | 222 DCHECK(!IsEmpty()); |
| 224 | 223 |
| 225 WhichTree next_tree = NextTileIteratorTree(tree_priority); | 224 WhichTree next_tree = NextTileIteratorTree(tree_priority); |
| 226 PictureLayerImpl::LayerRasterTileIterator* next_iterator = | 225 TilingSetRasterQueue* next_queue = |
| 227 next_tree == ACTIVE_TREE ? &active_iterator : &pending_iterator; | 226 next_tree == ACTIVE_TREE ? active_queue.get() : pending_queue.get(); |
| 228 DCHECK(*next_iterator); | 227 DCHECK(next_queue && !next_queue->IsEmpty()); |
| 229 DCHECK(returned_tiles_for_debug.insert(**next_iterator).second); | 228 DCHECK(returned_tiles_for_debug.insert(next_queue->Top()).second); |
| 230 ++(*next_iterator); | 229 next_queue->Pop(); |
| 231 | 230 |
| 232 if (has_both_layers) | 231 if (has_both_layers) |
| 233 SkipTilesReturnedByTwin(tree_priority); | 232 SkipTilesReturnedByTwin(tree_priority); |
| 234 | 233 |
| 235 // If no empty, use Top to do DCHECK the next iterator. | 234 // If no empty, use Top to do DCHECK the next iterator. |
| 236 DCHECK(IsEmpty() || Top(tree_priority)); | 235 DCHECK(IsEmpty() || Top(tree_priority)); |
| 237 } | 236 } |
| 238 | 237 |
| 239 void RasterTilePriorityQueue::PairedPictureLayerQueue::SkipTilesReturnedByTwin( | 238 void RasterTilePriorityQueue::PairedTilingSetQueue::SkipTilesReturnedByTwin( |
| 240 TreePriority tree_priority) { | 239 TreePriority tree_priority) { |
| 241 // We have both layers (active and pending) thus we can encounter shared | 240 // We have both layers (active and pending) thus we can encounter shared |
| 242 // tiles twice (from the active iterator and from the pending iterator). | 241 // tiles twice (from the active iterator and from the pending iterator). |
| 243 while (!IsEmpty()) { | 242 while (!IsEmpty()) { |
| 244 WhichTree next_tree = NextTileIteratorTree(tree_priority); | 243 WhichTree next_tree = NextTileIteratorTree(tree_priority); |
| 245 PictureLayerImpl::LayerRasterTileIterator* next_iterator = | 244 TilingSetRasterQueue* next_queue = |
| 246 next_tree == ACTIVE_TREE ? &active_iterator : &pending_iterator; | 245 next_tree == ACTIVE_TREE ? active_queue.get() : pending_queue.get(); |
| 246 DCHECK(next_queue && !next_queue->IsEmpty()); |
| 247 | 247 |
| 248 // Accept all non-shared tiles. | 248 // Accept all non-shared tiles. |
| 249 const Tile* tile = **next_iterator; | 249 const Tile* tile = next_queue->Top(); |
| 250 if (!tile->is_shared()) | 250 if (!tile->is_shared()) |
| 251 break; | 251 break; |
| 252 | 252 |
| 253 // Accept a shared tile if the next tree is the higher priority one | 253 // Accept a shared tile if the next tree is the higher priority one |
| 254 // corresponding the iterator (active or pending) which usually (but due | 254 // corresponding the iterator (active or pending) which usually (but due |
| 255 // to spiral iterators not always) returns the shared tile first. | 255 // to spiral iterators not always) returns the shared tile first. |
| 256 if (next_tree == HigherPriorityTree(tree_priority, nullptr, nullptr, tile)) | 256 if (next_tree == HigherPriorityTree(tree_priority, nullptr, nullptr, tile)) |
| 257 break; | 257 break; |
| 258 | 258 |
| 259 ++(*next_iterator); | 259 next_queue->Pop(); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 WhichTree | 263 WhichTree RasterTilePriorityQueue::PairedTilingSetQueue::NextTileIteratorTree( |
| 264 RasterTilePriorityQueue::PairedPictureLayerQueue::NextTileIteratorTree( | |
| 265 TreePriority tree_priority) const { | 264 TreePriority tree_priority) const { |
| 266 DCHECK(!IsEmpty()); | 265 DCHECK(!IsEmpty()); |
| 267 | 266 |
| 268 // If we only have one iterator with tiles, return it. | 267 // If we only have one queue with tiles, return it. |
| 269 if (!active_iterator) | 268 if (!active_queue || active_queue->IsEmpty()) |
| 270 return PENDING_TREE; | 269 return PENDING_TREE; |
| 271 if (!pending_iterator) | 270 if (!pending_queue || pending_queue->IsEmpty()) |
| 272 return ACTIVE_TREE; | 271 return ACTIVE_TREE; |
| 273 | 272 |
| 274 // Now both iterators have tiles, so we have to decide based on tree priority. | 273 // Now both iterators have tiles, so we have to decide based on tree priority. |
| 275 return HigherPriorityTree( | 274 return HigherPriorityTree(tree_priority, active_queue.get(), |
| 276 tree_priority, &active_iterator, &pending_iterator, nullptr); | 275 pending_queue.get(), nullptr); |
| 277 } | 276 } |
| 278 | 277 |
| 279 scoped_refptr<base::debug::ConvertableToTraceFormat> | 278 scoped_refptr<base::debug::ConvertableToTraceFormat> |
| 280 RasterTilePriorityQueue::PairedPictureLayerQueue::StateAsValue() const { | 279 RasterTilePriorityQueue::PairedTilingSetQueue::StateAsValue() const { |
| 281 scoped_refptr<base::debug::TracedValue> state = | 280 scoped_refptr<base::debug::TracedValue> state = |
| 282 new base::debug::TracedValue(); | 281 new base::debug::TracedValue(); |
| 283 state->BeginDictionary("active_iterator"); | 282 |
| 284 TilePriority::PriorityBin active_priority_bin = | 283 bool active_queue_has_tile = active_queue && !active_queue->IsEmpty(); |
| 285 active_iterator ? (*active_iterator)->priority(ACTIVE_TREE).priority_bin | 284 TilePriority::PriorityBin active_priority_bin = TilePriority::EVENTUALLY; |
| 286 : TilePriority::EVENTUALLY; | 285 TilePriority::PriorityBin pending_priority_bin = TilePriority::EVENTUALLY; |
| 287 TilePriority::PriorityBin pending_priority_bin = | 286 if (active_queue_has_tile) { |
| 288 active_iterator ? (*active_iterator)->priority(PENDING_TREE).priority_bin | 287 active_priority_bin = |
| 289 : TilePriority::EVENTUALLY; | 288 active_queue->Top()->priority(ACTIVE_TREE).priority_bin; |
| 290 state->SetBoolean("has_tile", !!active_iterator); | 289 pending_priority_bin = |
| 290 active_queue->Top()->priority(PENDING_TREE).priority_bin; |
| 291 } |
| 292 |
| 293 state->BeginDictionary("active_queue"); |
| 294 state->SetBoolean("has_tile", active_queue_has_tile); |
| 291 state->SetInteger("active_priority_bin", active_priority_bin); | 295 state->SetInteger("active_priority_bin", active_priority_bin); |
| 292 state->SetInteger("pending_priority_bin", pending_priority_bin); | 296 state->SetInteger("pending_priority_bin", pending_priority_bin); |
| 293 state->EndDictionary(); | 297 state->EndDictionary(); |
| 294 | 298 |
| 295 state->BeginDictionary("pending_iterator"); | 299 bool pending_queue_has_tile = pending_queue && !pending_queue->IsEmpty(); |
| 296 active_priority_bin = | 300 active_priority_bin = TilePriority::EVENTUALLY; |
| 297 pending_iterator ? (*pending_iterator)->priority(ACTIVE_TREE).priority_bin | 301 pending_priority_bin = TilePriority::EVENTUALLY; |
| 298 : TilePriority::EVENTUALLY; | 302 if (pending_queue_has_tile) { |
| 299 pending_priority_bin = | 303 active_priority_bin = |
| 300 pending_iterator | 304 pending_queue->Top()->priority(ACTIVE_TREE).priority_bin; |
| 301 ? (*pending_iterator)->priority(PENDING_TREE).priority_bin | 305 pending_priority_bin = |
| 302 : TilePriority::EVENTUALLY; | 306 pending_queue->Top()->priority(PENDING_TREE).priority_bin; |
| 303 state->SetBoolean("has_tile", !!pending_iterator); | 307 } |
| 308 |
| 309 state->BeginDictionary("pending_queue"); |
| 310 state->SetBoolean("has_tile", active_queue_has_tile); |
| 304 state->SetInteger("active_priority_bin", active_priority_bin); | 311 state->SetInteger("active_priority_bin", active_priority_bin); |
| 305 state->SetInteger("pending_priority_bin", pending_priority_bin); | 312 state->SetInteger("pending_priority_bin", pending_priority_bin); |
| 306 state->EndDictionary(); | 313 state->EndDictionary(); |
| 307 return state; | 314 return state; |
| 308 } | 315 } |
| 309 | 316 |
| 310 } // namespace cc | 317 } // namespace cc |
| OLD | NEW |