Chromium Code Reviews| 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 #include "cc/resources/tiling_set_raster_queue.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 // TODO(vmpstr): Consider virtualizing this and adding ::Create with the | |
| 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. | |
| 19 class CC_EXPORT RasterTilePriorityQueue { | 23 class CC_EXPORT RasterTilePriorityQueue { |
| 20 public: | 24 public: |
| 25 enum class Type { ALL, REQUIRED_FOR_ACTIVATION, REQUIRED_FOR_DRAW }; | |
| 26 | |
| 21 struct PairedTilingSetQueue { | 27 struct PairedTilingSetQueue { |
|
danakj
2015/01/08 23:24:40
This class is not a struct (anymore?), it has non-
| |
| 22 PairedTilingSetQueue(); | 28 PairedTilingSetQueue(); |
| 23 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, | 29 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, |
| 24 TreePriority tree_priority); | 30 TreePriority tree_priority, |
| 31 Type type); | |
| 25 ~PairedTilingSetQueue(); | 32 ~PairedTilingSetQueue(); |
| 26 | 33 |
| 27 bool IsEmpty() const; | 34 bool IsEmpty() const; |
| 28 Tile* Top(TreePriority tree_priority); | 35 Tile* Top(TreePriority tree_priority); |
| 29 void Pop(TreePriority tree_priority); | 36 void Pop(TreePriority tree_priority); |
| 30 | 37 |
| 31 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; | 38 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; |
| 32 void SkipTilesReturnedByTwin(TreePriority tree_priority); | 39 void SkipTilesReturnedByTwin(TreePriority tree_priority); |
| 33 | 40 |
| 34 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; | 41 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; |
| 35 | 42 |
| 36 scoped_ptr<TilingSetRasterQueue> active_queue; | 43 scoped_ptr<TilingSetRasterQueue> active_queue; |
| 37 scoped_ptr<TilingSetRasterQueue> pending_queue; | 44 scoped_ptr<TilingSetRasterQueue> pending_queue; |
| 38 bool has_both_layers; | 45 bool has_both_layers; |
| 39 | 46 |
| 40 // Set of returned tiles (excluding the current one) for DCHECKing. | 47 // Set of returned tiles (excluding the current one) for DCHECKing. |
| 41 std::set<const Tile*> returned_tiles_for_debug; | 48 std::set<const Tile*> returned_tiles_for_debug; |
| 42 }; | 49 }; |
| 43 | 50 |
| 44 RasterTilePriorityQueue(); | 51 RasterTilePriorityQueue(); |
| 45 ~RasterTilePriorityQueue(); | 52 ~RasterTilePriorityQueue(); |
| 46 | 53 |
| 47 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, | 54 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, |
| 48 TreePriority tree_priority); | 55 TreePriority tree_priority, |
| 56 Type type); | |
| 49 void Reset(); | 57 void Reset(); |
| 50 | 58 |
| 51 bool IsEmpty() const; | 59 bool IsEmpty() const; |
| 52 Tile* Top(); | 60 Tile* Top(); |
| 53 void Pop(); | 61 void Pop(); |
| 54 | 62 |
| 55 private: | 63 private: |
| 56 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that | 64 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that |
| 57 // PairedTilingSetQueue is fast enough to copy. In that case, we can use | 65 // PairedTilingSetQueue is fast enough to copy. In that case, we can use |
| 58 // objects directly (ie std::vector<PairedTilingSetQueue>. | 66 // objects directly (ie std::vector<PairedTilingSetQueue>. |
| 59 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; | 67 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; |
| 60 TreePriority tree_priority_; | 68 TreePriority tree_priority_; |
| 61 | 69 |
| 62 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue); | 70 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue); |
| 63 }; | 71 }; |
| 64 | 72 |
| 65 } // namespace cc | 73 } // namespace cc |
| 66 | 74 |
| 67 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ | 75 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ |
| OLD | NEW |