OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ALL_H_ |
6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ | 6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_ALL_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/raster_tile_priority_queue.h" |
14 #include "cc/resources/tile_priority.h" | 15 #include "cc/resources/tile_priority.h" |
15 #include "cc/resources/tiling_set_raster_queue.h" | 16 #include "cc/resources/tiling_set_raster_queue_all.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 | 19 |
19 // TODO(vmpstr): Consider virtualizing this and adding ::Create with the | 20 class CC_EXPORT RasterTilePriorityQueueAll : public RasterTilePriorityQueue { |
20 // parameters of ::Build that would create a simpler queue for required only | |
21 // tiles (ie, there's no need for the heap if all we're interested in are the | |
22 // required tiles. | |
23 class CC_EXPORT RasterTilePriorityQueue { | |
24 public: | 21 public: |
25 enum class Type { ALL, REQUIRED_FOR_ACTIVATION, REQUIRED_FOR_DRAW }; | |
26 | |
27 class PairedTilingSetQueue { | 22 class PairedTilingSetQueue { |
28 public: | 23 public: |
29 PairedTilingSetQueue(); | 24 PairedTilingSetQueue(); |
30 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, | 25 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, |
31 TreePriority tree_priority, | 26 TreePriority tree_priority); |
32 Type type); | |
33 ~PairedTilingSetQueue(); | 27 ~PairedTilingSetQueue(); |
34 | 28 |
35 bool IsEmpty() const; | 29 bool IsEmpty() const; |
36 Tile* Top(TreePriority tree_priority); | 30 Tile* Top(TreePriority tree_priority); |
37 void Pop(TreePriority tree_priority); | 31 void Pop(TreePriority tree_priority); |
38 | 32 |
39 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; | 33 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; |
40 void SkipTilesReturnedByTwin(TreePriority tree_priority); | 34 void SkipTilesReturnedByTwin(TreePriority tree_priority); |
41 | 35 |
42 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; | 36 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; |
43 | 37 |
44 const TilingSetRasterQueue* active_queue() const { | 38 const TilingSetRasterQueueAll* active_queue() const { |
45 return active_queue_.get(); | 39 return active_queue_.get(); |
46 } | 40 } |
47 const TilingSetRasterQueue* pending_queue() const { | 41 const TilingSetRasterQueueAll* pending_queue() const { |
48 return pending_queue_.get(); | 42 return pending_queue_.get(); |
49 } | 43 } |
50 | 44 |
51 private: | 45 private: |
52 scoped_ptr<TilingSetRasterQueue> active_queue_; | 46 scoped_ptr<TilingSetRasterQueueAll> active_queue_; |
53 scoped_ptr<TilingSetRasterQueue> pending_queue_; | 47 scoped_ptr<TilingSetRasterQueueAll> pending_queue_; |
54 bool has_both_layers_; | 48 bool has_both_layers_; |
55 | 49 |
56 // Set of returned tiles (excluding the current one) for DCHECKing. | 50 // Set of returned tiles (excluding the current one) for DCHECKing. |
57 std::set<const Tile*> returned_tiles_for_debug_; | 51 std::set<const Tile*> returned_tiles_for_debug_; |
58 }; | 52 }; |
59 | 53 |
60 RasterTilePriorityQueue(); | 54 RasterTilePriorityQueueAll(); |
61 ~RasterTilePriorityQueue(); | 55 ~RasterTilePriorityQueueAll() override; |
| 56 |
| 57 bool IsEmpty() const override; |
| 58 Tile* Top() override; |
| 59 void Pop() override; |
| 60 |
| 61 private: |
| 62 friend class RasterTilePriorityQueue; |
62 | 63 |
63 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, | 64 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, |
64 TreePriority tree_priority, | 65 TreePriority tree_priority); |
65 Type type); | |
66 void Reset(); | |
67 | 66 |
68 bool IsEmpty() const; | |
69 Tile* Top(); | |
70 void Pop(); | |
71 | |
72 private: | |
73 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that | 67 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that |
74 // PairedTilingSetQueue is fast enough to copy. In that case, we can use | 68 // PairedTilingSetQueue is fast enough to copy. In that case, we can use |
75 // objects directly (ie std::vector<PairedTilingSetQueue>. | 69 // objects directly (ie std::vector<PairedTilingSetQueue>. |
76 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; | 70 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; |
77 TreePriority tree_priority_; | 71 TreePriority tree_priority_; |
78 | 72 |
79 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue); | 73 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueueAll); |
80 }; | 74 }; |
81 | 75 |
82 } // namespace cc | 76 } // namespace cc |
83 | 77 |
84 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ | 78 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_ALL_H_ |
OLD | NEW |