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
3 // found in the LICENSE file.
5 #ifndef CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_
6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_
12 #include "cc/base/cc_export.h"
13 #include "cc/layers/picture_layer_impl.h"
14 #include "cc/resources/tile_priority.h"
18 class CC_EXPORT RasterTilePriorityQueue {
20 struct PairedPictureLayerQueue {
21 PairedPictureLayerQueue();
22 PairedPictureLayerQueue(const PictureLayerImpl::Pair& layer_pair,
23 TreePriority tree_priority);
24 ~PairedPictureLayerQueue();
27 Tile* Top(TreePriority tree_priority);
28 void Pop(TreePriority tree_priority);
30 WhichTree NextTileIteratorTree(TreePriority tree_priority) const;
31 void SkipTilesReturnedByTwin(TreePriority tree_priority);
33 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const;
35 PictureLayerImpl::LayerRasterTileIterator active_iterator;
36 PictureLayerImpl::LayerRasterTileIterator pending_iterator;
39 // Set of returned tiles (excluding the current one) for DCHECKing.
40 std::set<const Tile*> returned_tiles_for_debug;
43 RasterTilePriorityQueue();
44 ~RasterTilePriorityQueue();
46 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers,
47 TreePriority tree_priority);
55 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that
56 // PairedPictureLayerQueue is fast enough to copy. In that case, we can use
57 // objects directly (ie std::vector<PairedPictureLayerQueue>.
58 ScopedPtrVector<PairedPictureLayerQueue> paired_queues_;
59 TreePriority tree_priority_;
61 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue);
66 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_