Index: cc/resources/raster_tile_priority_queue.cc |
diff --git a/cc/resources/raster_tile_priority_queue.cc b/cc/resources/raster_tile_priority_queue.cc |
index 64a4a913ebfa78cfd4444f2b9b62a52ccad50d96..cbe90f9498d8ff27934312490f95905660e998ff 100644 |
--- a/cc/resources/raster_tile_priority_queue.cc |
+++ b/cc/resources/raster_tile_priority_queue.cc |
@@ -152,6 +152,8 @@ RasterTilePriorityQueue::PairedPictureLayerQueue::PairedPictureLayerQueue( |
tree_priority == SMOOTHNESS_TAKES_PRIORITY) |
: PictureLayerImpl::LayerRasterTileIterator()), |
has_both_layers(layer_pair.active && layer_pair.pending) { |
+ if (has_both_layers) |
+ SkipTilesReturnedByTwin(tree_priority); |
} |
RasterTilePriorityQueue::PairedPictureLayerQueue::~PairedPictureLayerQueue() { |
@@ -185,31 +187,37 @@ void RasterTilePriorityQueue::PairedPictureLayerQueue::Pop( |
DCHECK(returned_tiles_for_debug.insert(**next_iterator).second); |
++(*next_iterator); |
- if (has_both_layers) { |
- // We have both layers (active and pending) thus we can encounter shared |
- // tiles twice (from the active iterator and from the pending iterator). |
- for (; !IsEmpty(); ++(*next_iterator)) { |
- next_tree = NextTileIteratorTree(tree_priority); |
- next_iterator = |
- next_tree == ACTIVE_TREE ? &active_iterator : &pending_iterator; |
- |
- // Accept all non-shared tiles. |
- const Tile* tile = **next_iterator; |
- if (!tile->is_shared()) |
- break; |
- |
- // Accept a shared tile if the next tree is the higher priority one |
- // corresponding the iterator (active or pending) which usually (but due |
- // to spiral iterators not always) returns the shared tile first. |
- if (next_tree == HigherPriorityTree(tree_priority, NULL, NULL, tile)) |
- break; |
- } |
- } |
+ if (has_both_layers) |
+ SkipTilesReturnedByTwin(tree_priority); |
// If no empty, use Top to do DCHECK the next iterator. |
DCHECK(IsEmpty() || Top(tree_priority)); |
} |
+void RasterTilePriorityQueue::PairedPictureLayerQueue::SkipTilesReturnedByTwin( |
+ TreePriority tree_priority) { |
+ // We have both layers (active and pending) thus we can encounter shared |
+ // tiles twice (from the active iterator and from the pending iterator). |
+ while (!IsEmpty()) { |
+ WhichTree next_tree = NextTileIteratorTree(tree_priority); |
+ PictureLayerImpl::LayerRasterTileIterator* next_iterator = |
+ next_tree == ACTIVE_TREE ? &active_iterator : &pending_iterator; |
+ |
+ // Accept all non-shared tiles. |
+ const Tile* tile = **next_iterator; |
+ if (!tile->is_shared()) |
+ break; |
+ |
+ // Accept a shared tile if the next tree is the higher priority one |
+ // corresponding the iterator (active or pending) which usually (but due |
+ // to spiral iterators not always) returns the shared tile first. |
+ if (next_tree == HigherPriorityTree(tree_priority, nullptr, nullptr, tile)) |
+ break; |
+ |
+ ++(*next_iterator); |
reveman
2014/10/10 15:30:40
ah, we're advancing the iterator we decided to use
vmpstr
2014/10/10 15:36:18
Same here :)
|
+ } |
+} |
+ |
WhichTree |
RasterTilePriorityQueue::PairedPictureLayerQueue::NextTileIteratorTree( |
TreePriority tree_priority) const { |
@@ -223,7 +231,7 @@ RasterTilePriorityQueue::PairedPictureLayerQueue::NextTileIteratorTree( |
// Now both iterators have tiles, so we have to decide based on tree priority. |
return HigherPriorityTree( |
- tree_priority, &active_iterator, &pending_iterator, NULL); |
+ tree_priority, &active_iterator, &pending_iterator, nullptr); |
} |
} // namespace cc |