OLD | NEW |
1 // Copyright 2015 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_ALL_H_ | 5 #ifndef CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_ALL_H_ |
6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_ALL_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 "base/containers/hash_tables.h" |
12 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
13 #include "cc/layers/picture_layer_impl.h" | 14 #include "cc/layers/picture_layer_impl.h" |
14 #include "cc/resources/raster_tile_priority_queue.h" | 15 #include "cc/resources/raster_tile_priority_queue.h" |
15 #include "cc/resources/tile_priority.h" | 16 #include "cc/resources/tile_priority.h" |
16 #include "cc/resources/tiling_set_raster_queue_all.h" | 17 #include "cc/resources/tiling_set_raster_queue_all.h" |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 | 20 |
20 class CC_EXPORT RasterTilePriorityQueueAll : public RasterTilePriorityQueue { | 21 class CC_EXPORT RasterTilePriorityQueueAll : public RasterTilePriorityQueue { |
21 public: | 22 public: |
22 class PairedTilingSetQueue { | 23 class PairedTilingSetQueue { |
23 public: | 24 public: |
24 PairedTilingSetQueue(); | 25 PairedTilingSetQueue(); |
25 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, | 26 PairedTilingSetQueue(PictureLayerTilingSet* active, |
| 27 PictureLayerTilingSet* pending, |
26 TreePriority tree_priority); | 28 TreePriority tree_priority); |
27 ~PairedTilingSetQueue(); | 29 ~PairedTilingSetQueue(); |
28 | 30 |
29 bool IsEmpty() const; | 31 bool IsEmpty() const; |
30 Tile* Top(TreePriority tree_priority); | 32 Tile* Top(TreePriority tree_priority); |
31 void Pop(TreePriority tree_priority); | 33 void Pop(TreePriority tree_priority); |
32 | 34 |
33 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; | 35 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; |
34 void SkipTilesReturnedByTwin(TreePriority tree_priority); | 36 void SkipTilesReturnedByTwin(TreePriority tree_priority); |
35 | 37 |
36 scoped_refptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() | 38 scoped_refptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() |
37 const; | 39 const; |
38 | 40 |
39 const TilingSetRasterQueueAll* active_queue() const { | 41 const TilingSetRasterQueueAll* active_queue() const { |
40 return active_queue_.get(); | 42 return active_queue_.get(); |
41 } | 43 } |
42 const TilingSetRasterQueueAll* pending_queue() const { | 44 const TilingSetRasterQueueAll* pending_queue() const { |
43 return pending_queue_.get(); | 45 return pending_queue_.get(); |
44 } | 46 } |
45 | 47 |
46 private: | 48 private: |
47 scoped_ptr<TilingSetRasterQueueAll> active_queue_; | 49 scoped_ptr<TilingSetRasterQueueAll> active_queue_; |
48 scoped_ptr<TilingSetRasterQueueAll> pending_queue_; | 50 scoped_ptr<TilingSetRasterQueueAll> pending_queue_; |
49 bool has_both_layers_; | 51 bool has_both_tiling_sets_; |
50 | 52 |
51 // Set of returned tiles (excluding the current one) for DCHECKing. | 53 // Set of returned tiles (excluding the current one) for DCHECKing. |
52 std::set<const Tile*> returned_tiles_for_debug_; | 54 std::set<const Tile*> returned_tiles_for_debug_; |
53 }; | 55 }; |
54 | 56 |
55 RasterTilePriorityQueueAll(); | 57 RasterTilePriorityQueueAll(); |
56 ~RasterTilePriorityQueueAll() override; | 58 ~RasterTilePriorityQueueAll() override; |
57 | 59 |
58 bool IsEmpty() const override; | 60 bool IsEmpty() const override; |
59 Tile* Top() override; | 61 Tile* Top() override; |
60 void Pop() override; | 62 void Pop() override; |
61 | 63 |
62 private: | 64 private: |
63 friend class RasterTilePriorityQueue; | 65 friend class RasterTilePriorityQueue; |
64 | 66 |
65 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, | 67 void Build(const base::hash_map<int, PictureLayerTilingSet::Pair>& |
| 68 paired_picture_layer_tiling_sets, |
| 69 bool has_pending_tree, |
66 TreePriority tree_priority); | 70 TreePriority tree_priority); |
67 | 71 |
68 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that | 72 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that |
69 // PairedTilingSetQueue is fast enough to copy. In that case, we can use | 73 // PairedTilingSetQueue is fast enough to copy. In that case, we can use |
70 // objects directly (ie std::vector<PairedTilingSetQueue>. | 74 // objects directly (ie std::vector<PairedTilingSetQueue>. |
71 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; | 75 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; |
72 TreePriority tree_priority_; | 76 TreePriority tree_priority_; |
73 | 77 |
74 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueueAll); | 78 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueueAll); |
75 }; | 79 }; |
76 | 80 |
77 } // namespace cc | 81 } // namespace cc |
78 | 82 |
79 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_ALL_H_ | 83 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_ALL_H_ |
OLD | NEW |