| 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_TILING_SET_EVICTION_QUEUE_H_ | 5 #ifndef CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ |
| 6 #define CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ | 6 #define CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/resources/picture_layer_tiling_set.h" | 11 #include "cc/resources/picture_layer_tiling_set.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 // This eviction queue returned tiles from all tilings in a tiling set in | 15 // This eviction queue returned tiles from all tilings in a tiling set in |
| 16 // the order in which the tiles should be evicted. It can be thought of as the | 16 // the order in which the tiles should be evicted. It can be thought of as the |
| 17 // following: | 17 // following: |
| 18 // for all phases: | 18 // for all phases: |
| 19 // for all ordered tilings: | 19 // for all ordered tilings: |
| 20 // yield the next tile for the given phase from the given tiling | 20 // yield the next tile for the given phase from the given tiling |
| 21 // | 21 // |
| 22 // Phases are the following (in order in which they are processed): | 22 // Phases are the following (in order in which they are processed): |
| 23 // EVENTUALLY_RECT - Tiles in the eventually region of the tiling. | 23 // EVENTUALLY_RECT - Tiles in the eventually region of the tiling. |
| 24 // SOON_BORDER_RECT - Tiles in the prepainting skirt of the tiling. | 24 // SOON_BORDER_RECT - Tiles in the prepainting skirt of the tiling. |
| 25 // SKEWPORT_RECT - Tiles in the skewport of the tiling. | 25 // SKEWPORT_RECT - Tiles in the skewport of the tiling. |
| 26 // PENDING_VISIBLE_RECT - Tiles that will be visible upon activation, not | |
| 27 // required for activation. | |
| 28 // PENDING_VISIBLE_RECT_REQUIRED_FOR_ACTIVATION - Tiles that will be visible | |
| 29 // upon activation, required for activation. | |
| 30 // VISIBLE_RECT_OCCLUDED - Occluded, not required for activation, visible tiles. | 26 // VISIBLE_RECT_OCCLUDED - Occluded, not required for activation, visible tiles. |
| 31 // VISIBLE_RECT_UNOCCLUDED - Unoccluded, not required for activation, visible | 27 // VISIBLE_RECT_UNOCCLUDED - Unoccluded, not required for activation, visible |
| 32 // tiles. | 28 // tiles. |
| 33 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED - Occluded, but required for | 29 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED - Occluded, but required for |
| 34 // activation, visible tiles. This can happen when an active tree tile is | 30 // activation, visible tiles. This can happen when an active tree tile is |
| 35 // occluded, but is not occluded on the pending tree (and is required for | 31 // occluded, but is not occluded on the pending tree (and is required for |
| 36 // activation). | 32 // activation). |
| 37 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED - Unoccluded, required for | 33 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED - Unoccluded, required for |
| 38 // activation, tiles. | 34 // activation, tiles. |
| 39 // | 35 // |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 Tile* Top(); | 67 Tile* Top(); |
| 72 const Tile* Top() const; | 68 const Tile* Top() const; |
| 73 void Pop(); | 69 void Pop(); |
| 74 bool IsEmpty() const; | 70 bool IsEmpty() const; |
| 75 | 71 |
| 76 private: | 72 private: |
| 77 enum Phase { | 73 enum Phase { |
| 78 EVENTUALLY_RECT, | 74 EVENTUALLY_RECT, |
| 79 SOON_BORDER_RECT, | 75 SOON_BORDER_RECT, |
| 80 SKEWPORT_RECT, | 76 SKEWPORT_RECT, |
| 81 PENDING_VISIBLE_RECT, | |
| 82 PENDING_VISIBLE_RECT_REQUIRED_FOR_ACTIVATION, | |
| 83 VISIBLE_RECT_OCCLUDED, | 77 VISIBLE_RECT_OCCLUDED, |
| 84 VISIBLE_RECT_UNOCCLUDED, | 78 VISIBLE_RECT_UNOCCLUDED, |
| 85 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED, | 79 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED, |
| 86 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED | 80 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED |
| 87 }; | 81 }; |
| 88 | 82 |
| 89 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set); | 83 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set); |
| 90 | 84 |
| 91 // Helper base class for individual region iterators. | 85 // Helper base class for individual region iterators. |
| 92 class EvictionRectIterator { | 86 class EvictionRectIterator { |
| 93 public: | 87 public: |
| 94 EvictionRectIterator(); | 88 EvictionRectIterator(); |
| 95 EvictionRectIterator(std::vector<PictureLayerTiling*>* tilings, | 89 EvictionRectIterator(std::vector<PictureLayerTiling*>* tilings, |
| 96 WhichTree tree, | 90 WhichTree tree, |
| 97 bool skip_shared_out_of_order_tiles, | 91 bool skip_shared_out_of_order_tiles); |
| 98 bool skip_pending_visible_rect); | |
| 99 | 92 |
| 100 bool done() const { return !tile_; } | 93 bool done() const { return !tile_; } |
| 101 Tile* operator*() const { return tile_; } | 94 Tile* operator*() const { return tile_; } |
| 102 | 95 |
| 103 protected: | 96 protected: |
| 104 ~EvictionRectIterator() = default; | 97 ~EvictionRectIterator() = default; |
| 105 | 98 |
| 106 template <typename TilingIteratorType> | 99 template <typename TilingIteratorType> |
| 107 bool AdvanceToNextTile(TilingIteratorType* iterator); | 100 bool AdvanceToNextTile(TilingIteratorType* iterator); |
| 108 template <typename TilingIteratorType> | 101 template <typename TilingIteratorType> |
| 109 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); | 102 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); |
| 110 | 103 |
| 111 Tile* tile_; | 104 Tile* tile_; |
| 112 std::vector<PictureLayerTiling*>* tilings_; | 105 std::vector<PictureLayerTiling*>* tilings_; |
| 113 WhichTree tree_; | 106 WhichTree tree_; |
| 114 bool skip_shared_out_of_order_tiles_; | 107 bool skip_shared_out_of_order_tiles_; |
| 115 bool skip_pending_visible_rect_; | |
| 116 size_t tiling_index_; | 108 size_t tiling_index_; |
| 117 }; | 109 }; |
| 118 | 110 |
| 119 class PendingVisibleTilingIterator : public EvictionRectIterator { | |
| 120 public: | |
| 121 PendingVisibleTilingIterator() = default; | |
| 122 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, | |
| 123 WhichTree tree, | |
| 124 bool skip_shared_out_of_order_tiles, | |
| 125 bool return_required_for_activation_tiles); | |
| 126 | |
| 127 PendingVisibleTilingIterator& operator++(); | |
| 128 | |
| 129 private: | |
| 130 bool TileMatchesRequiredFlags(const Tile* tile) const; | |
| 131 | |
| 132 TilingData::DifferenceIterator iterator_; | |
| 133 bool return_required_for_activation_tiles_; | |
| 134 }; | |
| 135 | |
| 136 class VisibleTilingIterator : public EvictionRectIterator { | 111 class VisibleTilingIterator : public EvictionRectIterator { |
| 137 public: | 112 public: |
| 138 VisibleTilingIterator() = default; | 113 VisibleTilingIterator() = default; |
| 139 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, | 114 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, |
| 140 WhichTree tree, | 115 WhichTree tree, |
| 141 bool skip_shared_out_of_order_tiles, | 116 bool skip_shared_out_of_order_tiles, |
| 142 bool return_occluded_tiles, | 117 bool return_occluded_tiles, |
| 143 bool return_required_for_activation_tiles); | 118 bool return_required_for_activation_tiles); |
| 144 | 119 |
| 145 VisibleTilingIterator& operator++(); | 120 VisibleTilingIterator& operator++(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 170 |
| 196 WhichTree tree_; | 171 WhichTree tree_; |
| 197 bool skip_shared_out_of_order_tiles_; | 172 bool skip_shared_out_of_order_tiles_; |
| 198 Phase phase_; | 173 Phase phase_; |
| 199 Tile* current_tile_; | 174 Tile* current_tile_; |
| 200 std::vector<PictureLayerTiling*> tilings_; | 175 std::vector<PictureLayerTiling*> tilings_; |
| 201 | 176 |
| 202 EventuallyTilingIterator eventually_iterator_; | 177 EventuallyTilingIterator eventually_iterator_; |
| 203 SoonBorderTilingIterator soon_iterator_; | 178 SoonBorderTilingIterator soon_iterator_; |
| 204 SkewportTilingIterator skewport_iterator_; | 179 SkewportTilingIterator skewport_iterator_; |
| 205 PendingVisibleTilingIterator pending_visible_iterator_; | |
| 206 VisibleTilingIterator visible_iterator_; | 180 VisibleTilingIterator visible_iterator_; |
| 207 }; | 181 }; |
| 208 | 182 |
| 209 } // namespace cc | 183 } // namespace cc |
| 210 | 184 |
| 211 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ | 185 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ |
| OLD | NEW |