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_TILES_TILING_SET_EVICTION_QUEUE_H_ | 5 #ifndef CC_TILES_TILING_SET_EVICTION_QUEUE_H_ |
6 #define CC_TILES_TILING_SET_EVICTION_QUEUE_H_ | 6 #define CC_TILES_TILING_SET_EVICTION_QUEUE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set); | 90 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set); |
91 | 91 |
92 // Helper base class for individual region iterators. | 92 // Helper base class for individual region iterators. |
93 class EvictionRectIterator { | 93 class EvictionRectIterator { |
94 public: | 94 public: |
95 EvictionRectIterator(); | 95 EvictionRectIterator(); |
96 EvictionRectIterator( | 96 EvictionRectIterator( |
97 std::vector<PictureLayerTiling*>* tilings, | 97 std::vector<PictureLayerTiling*>* tilings, |
98 WhichTree tree, | 98 WhichTree tree, |
99 PictureLayerTiling::PriorityRectType priority_rect_type); | 99 PictureLayerTiling::PriorityRectType priority_rect_type); |
| 100 EvictionRectIterator(const EvictionRectIterator& other) = default; |
| 101 EvictionRectIterator(EvictionRectIterator&& other) = default; |
| 102 |
| 103 EvictionRectIterator& operator=(const EvictionRectIterator& other) = |
| 104 default; |
| 105 EvictionRectIterator& operator=(EvictionRectIterator&& other) = default; |
100 | 106 |
101 bool done() const { return !prioritized_tile_.tile(); } | 107 bool done() const { return !prioritized_tile_.tile(); } |
102 const PrioritizedTile& operator*() const { return prioritized_tile_; } | 108 const PrioritizedTile& operator*() const { return prioritized_tile_; } |
103 | 109 |
104 protected: | 110 protected: |
105 ~EvictionRectIterator() = default; | 111 ~EvictionRectIterator() = default; |
106 | 112 |
107 template <typename TilingIteratorType> | 113 template <typename TilingIteratorType> |
108 bool AdvanceToNextTile(TilingIteratorType* iterator); | 114 bool AdvanceToNextTile(TilingIteratorType* iterator); |
109 template <typename TilingIteratorType> | 115 template <typename TilingIteratorType> |
110 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); | 116 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); |
111 | 117 |
112 PrioritizedTile prioritized_tile_; | 118 PrioritizedTile prioritized_tile_; |
113 std::vector<PictureLayerTiling*>* tilings_; | 119 std::vector<PictureLayerTiling*>* tilings_; |
114 WhichTree tree_; | 120 WhichTree tree_; |
115 PictureLayerTiling::PriorityRectType priority_rect_type_; | 121 PictureLayerTiling::PriorityRectType priority_rect_type_; |
116 size_t tiling_index_; | 122 size_t tiling_index_; |
117 }; | 123 }; |
118 | 124 |
119 class PendingVisibleTilingIterator : public EvictionRectIterator { | 125 class PendingVisibleTilingIterator : public EvictionRectIterator { |
120 public: | 126 public: |
121 PendingVisibleTilingIterator() = default; | 127 PendingVisibleTilingIterator() = default; |
122 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, | 128 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, |
123 WhichTree tree, | 129 WhichTree tree, |
124 bool return_required_for_activation_tiles); | 130 bool return_required_for_activation_tiles); |
| 131 PendingVisibleTilingIterator(const PendingVisibleTilingIterator& other) = |
| 132 default; |
| 133 PendingVisibleTilingIterator(PendingVisibleTilingIterator&& other) = |
| 134 default; |
| 135 |
| 136 PendingVisibleTilingIterator& operator=( |
| 137 const PendingVisibleTilingIterator& other) = default; |
| 138 PendingVisibleTilingIterator& operator=( |
| 139 PendingVisibleTilingIterator&& other) = default; |
125 | 140 |
126 PendingVisibleTilingIterator& operator++(); | 141 PendingVisibleTilingIterator& operator++(); |
127 | 142 |
128 private: | 143 private: |
129 bool TileMatchesRequiredFlags(const PrioritizedTile& tile) const; | 144 bool TileMatchesRequiredFlags(const PrioritizedTile& tile) const; |
130 | 145 |
131 TilingData::DifferenceIterator iterator_; | 146 TilingData::DifferenceIterator iterator_; |
132 bool return_required_for_activation_tiles_; | 147 bool return_required_for_activation_tiles_; |
133 }; | 148 }; |
134 | 149 |
135 class VisibleTilingIterator : public EvictionRectIterator { | 150 class VisibleTilingIterator : public EvictionRectIterator { |
136 public: | 151 public: |
137 VisibleTilingIterator() = default; | 152 VisibleTilingIterator() = default; |
138 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, | 153 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, |
139 WhichTree tree, | 154 WhichTree tree, |
140 bool return_occluded_tiles, | 155 bool return_occluded_tiles, |
141 bool return_required_for_activation_tiles); | 156 bool return_required_for_activation_tiles); |
142 | 157 |
| 158 VisibleTilingIterator(const VisibleTilingIterator& other) = default; |
| 159 VisibleTilingIterator(VisibleTilingIterator&& other) = default; |
| 160 |
| 161 VisibleTilingIterator& operator=(const VisibleTilingIterator& other) = |
| 162 default; |
| 163 VisibleTilingIterator& operator=(VisibleTilingIterator&& other) = default; |
| 164 |
143 VisibleTilingIterator& operator++(); | 165 VisibleTilingIterator& operator++(); |
144 | 166 |
145 private: | 167 private: |
146 bool TileMatchesRequiredFlags(const PrioritizedTile& tile) const; | 168 bool TileMatchesRequiredFlags(const PrioritizedTile& tile) const; |
147 | 169 |
148 TilingData::Iterator iterator_; | 170 TilingData::Iterator iterator_; |
149 bool return_occluded_tiles_; | 171 bool return_occluded_tiles_; |
150 bool return_required_for_activation_tiles_; | 172 bool return_required_for_activation_tiles_; |
151 }; | 173 }; |
152 | 174 |
153 class SkewportTilingIterator : public EvictionRectIterator { | 175 class SkewportTilingIterator : public EvictionRectIterator { |
154 public: | 176 public: |
155 SkewportTilingIterator() = default; | 177 SkewportTilingIterator() = default; |
156 SkewportTilingIterator(std::vector<PictureLayerTiling*>* tilings, | 178 SkewportTilingIterator(std::vector<PictureLayerTiling*>* tilings, |
157 WhichTree tree); | 179 WhichTree tree); |
| 180 SkewportTilingIterator(const SkewportTilingIterator& other) = default; |
| 181 SkewportTilingIterator(SkewportTilingIterator&& other) = default; |
| 182 |
| 183 SkewportTilingIterator& operator=(const SkewportTilingIterator& other) = |
| 184 default; |
| 185 SkewportTilingIterator& operator=(SkewportTilingIterator&& other) = default; |
158 | 186 |
159 SkewportTilingIterator& operator++(); | 187 SkewportTilingIterator& operator++(); |
160 | 188 |
161 private: | 189 private: |
162 TilingData::ReverseSpiralDifferenceIterator iterator_; | 190 TilingData::ReverseSpiralDifferenceIterator iterator_; |
163 }; | 191 }; |
164 | 192 |
165 class SoonBorderTilingIterator : public EvictionRectIterator { | 193 class SoonBorderTilingIterator : public EvictionRectIterator { |
166 public: | 194 public: |
167 SoonBorderTilingIterator() = default; | 195 SoonBorderTilingIterator() = default; |
168 SoonBorderTilingIterator(std::vector<PictureLayerTiling*>* tilings, | 196 SoonBorderTilingIterator(std::vector<PictureLayerTiling*>* tilings, |
169 WhichTree tree); | 197 WhichTree tree); |
| 198 SoonBorderTilingIterator(const SoonBorderTilingIterator& other) = default; |
| 199 SoonBorderTilingIterator(SoonBorderTilingIterator&& other) = default; |
| 200 |
| 201 SoonBorderTilingIterator& operator=(const SoonBorderTilingIterator& other) = |
| 202 default; |
| 203 SoonBorderTilingIterator& operator=(SoonBorderTilingIterator&& other) = |
| 204 default; |
170 | 205 |
171 SoonBorderTilingIterator& operator++(); | 206 SoonBorderTilingIterator& operator++(); |
172 | 207 |
173 private: | 208 private: |
174 TilingData::ReverseSpiralDifferenceIterator iterator_; | 209 TilingData::ReverseSpiralDifferenceIterator iterator_; |
175 }; | 210 }; |
176 | 211 |
177 class EventuallyTilingIterator : public EvictionRectIterator { | 212 class EventuallyTilingIterator : public EvictionRectIterator { |
178 public: | 213 public: |
179 EventuallyTilingIterator() = default; | 214 EventuallyTilingIterator() = default; |
180 EventuallyTilingIterator(std::vector<PictureLayerTiling*>* tilings, | 215 EventuallyTilingIterator(std::vector<PictureLayerTiling*>* tilings, |
181 WhichTree tree); | 216 WhichTree tree); |
| 217 EventuallyTilingIterator(const EventuallyTilingIterator& other) = default; |
| 218 EventuallyTilingIterator(EventuallyTilingIterator&& other) = default; |
| 219 |
| 220 EventuallyTilingIterator& operator=(const EventuallyTilingIterator& other) = |
| 221 default; |
| 222 EventuallyTilingIterator& operator=(EventuallyTilingIterator&& other) = |
| 223 default; |
182 | 224 |
183 EventuallyTilingIterator& operator++(); | 225 EventuallyTilingIterator& operator++(); |
184 | 226 |
185 private: | 227 private: |
186 TilingData::ReverseSpiralDifferenceIterator iterator_; | 228 TilingData::ReverseSpiralDifferenceIterator iterator_; |
187 }; | 229 }; |
188 | 230 |
189 void AdvancePhase(); | 231 void AdvancePhase(); |
190 | 232 |
191 WhichTree tree_; | 233 WhichTree tree_; |
192 Phase phase_; | 234 Phase phase_; |
193 PrioritizedTile current_tile_; | 235 PrioritizedTile current_tile_; |
194 std::vector<PictureLayerTiling*> tilings_; | 236 std::vector<PictureLayerTiling*> tilings_; |
195 | 237 |
196 EventuallyTilingIterator eventually_iterator_; | 238 EventuallyTilingIterator eventually_iterator_; |
197 SoonBorderTilingIterator soon_iterator_; | 239 SoonBorderTilingIterator soon_iterator_; |
198 SkewportTilingIterator skewport_iterator_; | 240 SkewportTilingIterator skewport_iterator_; |
199 PendingVisibleTilingIterator pending_visible_iterator_; | 241 PendingVisibleTilingIterator pending_visible_iterator_; |
200 VisibleTilingIterator visible_iterator_; | 242 VisibleTilingIterator visible_iterator_; |
201 }; | 243 }; |
202 | 244 |
203 } // namespace cc | 245 } // namespace cc |
204 | 246 |
205 #endif // CC_TILES_TILING_SET_EVICTION_QUEUE_H_ | 247 #endif // CC_TILES_TILING_SET_EVICTION_QUEUE_H_ |
OLD | NEW |