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. |
26 // VISIBLE_RECT_OCCLUDED - Occluded, not required for activation, visible tiles. | 30 // VISIBLE_RECT_OCCLUDED - Occluded, not required for activation, visible tiles. |
27 // VISIBLE_RECT_UNOCCLUDED - Unoccluded, not required for activation, visible | 31 // VISIBLE_RECT_UNOCCLUDED - Unoccluded, not required for activation, visible |
28 // tiles. | 32 // tiles. |
29 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED - Occluded, but required for | 33 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED - Occluded, but required for |
30 // activation, visible tiles. This can happen when an active tree tile is | 34 // activation, visible tiles. This can happen when an active tree tile is |
31 // occluded, but is not occluded on the pending tree (and is required for | 35 // occluded, but is not occluded on the pending tree (and is required for |
32 // activation). | 36 // activation). |
33 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED - Unoccluded, required for | 37 // VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED - Unoccluded, required for |
34 // activation, tiles. | 38 // activation, tiles. |
35 // | 39 // |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Tile* Top(); | 71 Tile* Top(); |
68 const Tile* Top() const; | 72 const Tile* Top() const; |
69 void Pop(); | 73 void Pop(); |
70 bool IsEmpty() const; | 74 bool IsEmpty() const; |
71 | 75 |
72 private: | 76 private: |
73 enum Phase { | 77 enum Phase { |
74 EVENTUALLY_RECT, | 78 EVENTUALLY_RECT, |
75 SOON_BORDER_RECT, | 79 SOON_BORDER_RECT, |
76 SKEWPORT_RECT, | 80 SKEWPORT_RECT, |
| 81 PENDING_VISIBLE_RECT, |
| 82 PENDING_VISIBLE_RECT_REQUIRED_FOR_ACTIVATION, |
77 VISIBLE_RECT_OCCLUDED, | 83 VISIBLE_RECT_OCCLUDED, |
78 VISIBLE_RECT_UNOCCLUDED, | 84 VISIBLE_RECT_UNOCCLUDED, |
79 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED, | 85 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED, |
80 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED | 86 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED |
81 }; | 87 }; |
82 | 88 |
83 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set); | 89 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set); |
84 | 90 |
85 // Helper base class for individual region iterators. | 91 // Helper base class for individual region iterators. |
86 class EvictionRectIterator { | 92 class EvictionRectIterator { |
87 public: | 93 public: |
88 EvictionRectIterator(); | 94 EvictionRectIterator(); |
89 EvictionRectIterator(std::vector<PictureLayerTiling*>* tilings, | 95 EvictionRectIterator(std::vector<PictureLayerTiling*>* tilings, |
90 WhichTree tree, | 96 WhichTree tree, |
91 bool skip_shared_out_of_order_tiles); | 97 bool skip_shared_out_of_order_tiles, |
| 98 bool skip_pending_visible_rect); |
92 | 99 |
93 bool done() const { return !tile_; } | 100 bool done() const { return !tile_; } |
94 Tile* operator*() const { return tile_; } | 101 Tile* operator*() const { return tile_; } |
95 | 102 |
96 protected: | 103 protected: |
97 ~EvictionRectIterator() = default; | 104 ~EvictionRectIterator() = default; |
98 | 105 |
99 template <typename TilingIteratorType> | 106 template <typename TilingIteratorType> |
100 bool AdvanceToNextTile(TilingIteratorType* iterator); | 107 bool AdvanceToNextTile(TilingIteratorType* iterator); |
101 template <typename TilingIteratorType> | 108 template <typename TilingIteratorType> |
102 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); | 109 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); |
103 | 110 |
104 Tile* tile_; | 111 Tile* tile_; |
105 std::vector<PictureLayerTiling*>* tilings_; | 112 std::vector<PictureLayerTiling*>* tilings_; |
106 WhichTree tree_; | 113 WhichTree tree_; |
107 bool skip_shared_out_of_order_tiles_; | 114 bool skip_shared_out_of_order_tiles_; |
| 115 bool skip_pending_visible_rect_; |
108 size_t tiling_index_; | 116 size_t tiling_index_; |
109 }; | 117 }; |
110 | 118 |
| 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 |
111 class VisibleTilingIterator : public EvictionRectIterator { | 136 class VisibleTilingIterator : public EvictionRectIterator { |
112 public: | 137 public: |
113 VisibleTilingIterator() = default; | 138 VisibleTilingIterator() = default; |
114 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, | 139 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, |
115 WhichTree tree, | 140 WhichTree tree, |
116 bool skip_shared_out_of_order_tiles, | 141 bool skip_shared_out_of_order_tiles, |
117 bool return_occluded_tiles, | 142 bool return_occluded_tiles, |
118 bool return_required_for_activation_tiles); | 143 bool return_required_for_activation_tiles); |
119 | 144 |
120 VisibleTilingIterator& operator++(); | 145 VisibleTilingIterator& operator++(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 195 |
171 WhichTree tree_; | 196 WhichTree tree_; |
172 bool skip_shared_out_of_order_tiles_; | 197 bool skip_shared_out_of_order_tiles_; |
173 Phase phase_; | 198 Phase phase_; |
174 Tile* current_tile_; | 199 Tile* current_tile_; |
175 std::vector<PictureLayerTiling*> tilings_; | 200 std::vector<PictureLayerTiling*> tilings_; |
176 | 201 |
177 EventuallyTilingIterator eventually_iterator_; | 202 EventuallyTilingIterator eventually_iterator_; |
178 SoonBorderTilingIterator soon_iterator_; | 203 SoonBorderTilingIterator soon_iterator_; |
179 SkewportTilingIterator skewport_iterator_; | 204 SkewportTilingIterator skewport_iterator_; |
| 205 PendingVisibleTilingIterator pending_visible_iterator_; |
180 VisibleTilingIterator visible_iterator_; | 206 VisibleTilingIterator visible_iterator_; |
181 }; | 207 }; |
182 | 208 |
183 } // namespace cc | 209 } // namespace cc |
184 | 210 |
185 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ | 211 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ |
OLD | NEW |