Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CC_RESOURCES_TILE_PRIORITY_QUEUE_H_ | |
| 6 #define CC_RESOURCES_TILE_PRIORITY_QUEUE_H_ | |
| 7 | |
| 8 #include <utility> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "cc/base/cc_export.h" | |
| 12 #include "cc/layers/picture_layer_impl.h" | |
| 13 #include "cc/resources/tile_priority.h" | |
| 14 | |
| 15 namespace cc { | |
| 16 | |
| 17 class Tile; | |
| 18 | |
| 19 struct CC_EXPORT PairedPictureLayer { | |
| 20 PairedPictureLayer(); | |
| 21 ~PairedPictureLayer(); | |
| 22 | |
| 23 PictureLayerImpl* active_layer; | |
| 24 PictureLayerImpl* pending_layer; | |
| 25 }; | |
| 26 | |
| 27 class CC_EXPORT RasterTileQueue { | |
|
reveman
2014/07/09 02:21:09
How about only declaring an abstract TilePriortyQu
vmpstr
2014/07/09 18:35:38
Done.
| |
| 28 public: | |
| 29 RasterTileQueue(); | |
| 30 ~RasterTileQueue(); | |
| 31 | |
| 32 void Prepare(const std::vector<PairedPictureLayer>& paired_picture_layers, | |
| 33 TreePriority tree_priority); | |
| 34 | |
| 35 void Pop(); | |
| 36 bool IsEmpty(); | |
| 37 Tile* Top(); | |
| 38 | |
| 39 private: | |
| 40 struct PairedPictureLayerIterator { | |
| 41 PairedPictureLayerIterator(); | |
| 42 ~PairedPictureLayerIterator(); | |
| 43 | |
| 44 Tile* PeekTile(TreePriority tree_priority); | |
| 45 void PopTile(TreePriority tree_priority); | |
| 46 | |
| 47 std::pair<PictureLayerImpl::LayerRasterTileIterator*, WhichTree> | |
| 48 NextTileIterator(TreePriority tree_priority); | |
| 49 | |
| 50 PictureLayerImpl::LayerRasterTileIterator active_iterator; | |
| 51 PictureLayerImpl::LayerRasterTileIterator pending_iterator; | |
| 52 | |
| 53 std::vector<Tile*> returned_shared_tiles; | |
| 54 }; | |
| 55 | |
| 56 class RasterOrderComparator { | |
| 57 public: | |
| 58 explicit RasterOrderComparator(TreePriority tree_priority); | |
| 59 | |
| 60 bool operator()(PairedPictureLayerIterator* a, | |
| 61 PairedPictureLayerIterator* b) const; | |
| 62 | |
| 63 private: | |
| 64 TreePriority tree_priority_; | |
| 65 }; | |
| 66 | |
| 67 std::vector<PairedPictureLayerIterator> paired_iterators_; | |
| 68 std::vector<PairedPictureLayerIterator*> iterator_heap_; | |
| 69 TreePriority tree_priority_; | |
| 70 RasterOrderComparator comparator_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(RasterTileQueue); | |
| 73 }; | |
| 74 | |
| 75 struct CC_EXPORT EvictionTileQueue { | |
| 76 public: | |
| 77 EvictionTileQueue(); | |
| 78 ~EvictionTileQueue(); | |
| 79 | |
| 80 void Prepare(const std::vector<PairedPictureLayer>& paired_picture_layers, | |
| 81 TreePriority tree_priority); | |
| 82 | |
| 83 void Pop(); | |
| 84 bool IsEmpty(); | |
| 85 Tile* Top(); | |
| 86 | |
| 87 private: | |
| 88 struct PairedPictureLayerIterator { | |
| 89 PairedPictureLayerIterator(); | |
| 90 ~PairedPictureLayerIterator(); | |
| 91 | |
| 92 Tile* PeekTile(TreePriority tree_priority); | |
| 93 void PopTile(TreePriority tree_priority); | |
| 94 | |
| 95 PictureLayerImpl::LayerEvictionTileIterator* NextTileIterator( | |
| 96 TreePriority tree_priority); | |
| 97 | |
| 98 PictureLayerImpl::LayerEvictionTileIterator active_iterator; | |
| 99 PictureLayerImpl::LayerEvictionTileIterator pending_iterator; | |
| 100 | |
| 101 std::vector<Tile*> returned_shared_tiles; | |
| 102 }; | |
| 103 | |
| 104 class EvictionOrderComparator { | |
| 105 public: | |
| 106 explicit EvictionOrderComparator(TreePriority tree_priority); | |
| 107 | |
| 108 bool operator()(PairedPictureLayerIterator* a, | |
| 109 PairedPictureLayerIterator* b) const; | |
| 110 | |
| 111 private: | |
| 112 TreePriority tree_priority_; | |
| 113 }; | |
| 114 | |
| 115 void Initialize(); | |
| 116 | |
| 117 std::vector<PairedPictureLayerIterator> paired_iterators_; | |
| 118 std::vector<PairedPictureLayerIterator*> iterator_heap_; | |
| 119 std::vector<PairedPictureLayer> paired_picture_layers_; | |
| 120 TreePriority tree_priority_; | |
| 121 EvictionOrderComparator comparator_; | |
| 122 bool initialized_; | |
| 123 | |
| 124 DISALLOW_COPY_AND_ASSIGN(EvictionTileQueue); | |
| 125 }; | |
| 126 | |
| 127 } // namespace cc | |
| 128 | |
| 129 #endif // CC_RESOURCES_TILE_PRIORITY_QUEUE_H_ | |
| OLD | NEW |