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 #ifndef CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ | 5 #ifndef CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ |
6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ | 6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/layers/picture_layer_impl.h" | 13 #include "cc/layers/picture_layer_impl.h" |
14 #include "cc/resources/tile_priority.h" | 14 #include "cc/resources/tile_priority.h" |
| 15 #include "cc/resources/tiling_set_raster_queue.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 | 18 |
18 class CC_EXPORT RasterTilePriorityQueue { | 19 class CC_EXPORT RasterTilePriorityQueue { |
19 public: | 20 public: |
20 struct PairedPictureLayerQueue { | 21 struct PairedTilingSetQueue { |
21 PairedPictureLayerQueue(); | 22 PairedTilingSetQueue(); |
22 PairedPictureLayerQueue(const PictureLayerImpl::Pair& layer_pair, | 23 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, |
23 TreePriority tree_priority); | 24 TreePriority tree_priority); |
24 ~PairedPictureLayerQueue(); | 25 ~PairedTilingSetQueue(); |
25 | 26 |
26 bool IsEmpty() const; | 27 bool IsEmpty() const; |
27 Tile* Top(TreePriority tree_priority); | 28 Tile* Top(TreePriority tree_priority); |
28 void Pop(TreePriority tree_priority); | 29 void Pop(TreePriority tree_priority); |
29 | 30 |
30 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; | 31 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; |
31 void SkipTilesReturnedByTwin(TreePriority tree_priority); | 32 void SkipTilesReturnedByTwin(TreePriority tree_priority); |
32 | 33 |
33 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; | 34 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; |
34 | 35 |
35 PictureLayerImpl::LayerRasterTileIterator active_iterator; | 36 scoped_ptr<TilingSetRasterQueue> active_queue; |
36 PictureLayerImpl::LayerRasterTileIterator pending_iterator; | 37 scoped_ptr<TilingSetRasterQueue> pending_queue; |
37 bool has_both_layers; | 38 bool has_both_layers; |
38 | 39 |
39 // Set of returned tiles (excluding the current one) for DCHECKing. | 40 // Set of returned tiles (excluding the current one) for DCHECKing. |
40 std::set<const Tile*> returned_tiles_for_debug; | 41 std::set<const Tile*> returned_tiles_for_debug; |
41 }; | 42 }; |
42 | 43 |
43 RasterTilePriorityQueue(); | 44 RasterTilePriorityQueue(); |
44 ~RasterTilePriorityQueue(); | 45 ~RasterTilePriorityQueue(); |
45 | 46 |
46 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, | 47 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, |
47 TreePriority tree_priority); | 48 TreePriority tree_priority); |
48 void Reset(); | 49 void Reset(); |
49 | 50 |
50 bool IsEmpty() const; | 51 bool IsEmpty() const; |
51 Tile* Top(); | 52 Tile* Top(); |
52 void Pop(); | 53 void Pop(); |
53 | 54 |
54 private: | 55 private: |
55 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that | 56 // 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 // PairedTilingSetQueue is fast enough to copy. In that case, we can use |
57 // objects directly (ie std::vector<PairedPictureLayerQueue>. | 58 // objects directly (ie std::vector<PairedTilingSetQueue>. |
58 ScopedPtrVector<PairedPictureLayerQueue> paired_queues_; | 59 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; |
59 TreePriority tree_priority_; | 60 TreePriority tree_priority_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue); | 62 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue); |
62 }; | 63 }; |
63 | 64 |
64 } // namespace cc | 65 } // namespace cc |
65 | 66 |
66 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ | 67 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ |
OLD | NEW |