OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_PICTURE_LAYER_TILING_H_ | 5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 Tile* current_tile_; | 117 Tile* current_tile_; |
118 TilingData::Iterator visible_iterator_; | 118 TilingData::Iterator visible_iterator_; |
119 TilingData::SpiralDifferenceIterator spiral_iterator_; | 119 TilingData::SpiralDifferenceIterator spiral_iterator_; |
120 }; | 120 }; |
121 | 121 |
122 class CC_EXPORT TilingEvictionTileIterator { | 122 class CC_EXPORT TilingEvictionTileIterator { |
123 public: | 123 public: |
124 TilingEvictionTileIterator(); | 124 TilingEvictionTileIterator(); |
125 TilingEvictionTileIterator(PictureLayerTiling* tiling, | 125 TilingEvictionTileIterator(PictureLayerTiling* tiling, |
126 TreePriority tree_priority, | 126 TreePriority tree_priority, |
127 EvictionCategory category); | 127 EvictionCategory category, |
| 128 bool skip_shared_high_priority_tiles); |
128 ~TilingEvictionTileIterator(); | 129 ~TilingEvictionTileIterator(); |
129 | 130 |
130 operator bool() const; | 131 operator bool() const; |
131 const Tile* operator*() const; | 132 const Tile* operator*() const; |
132 Tile* operator*(); | 133 Tile* operator*(); |
133 TilingEvictionTileIterator& operator++(); | 134 TilingEvictionTileIterator& operator++(); |
134 | 135 |
135 private: | 136 private: |
136 const std::vector<Tile*>* eviction_tiles_; | 137 void AdvanceEventually(bool* skipped_tiles); |
137 size_t current_eviction_tiles_index_; | 138 void AdvanceSoon(); |
| 139 void AdvanceNow(); |
| 140 bool PrepareTileUnlessReturnedByTwin(Tile* tile) const; |
| 141 |
| 142 PictureLayerTiling* tiling_; |
| 143 TreePriority tree_priority_; |
| 144 EvictionCategory eviction_category_; |
| 145 |
| 146 bool processing_soon_border_rect_; |
| 147 bool skip_shared_high_priority_tiles_; |
| 148 std::vector<Tile*> unoccluded_now_tiles_; |
| 149 size_t unoccluded_now_tiles_index_; |
| 150 |
| 151 Tile* current_tile_; |
| 152 |
| 153 TilingData::Iterator visible_iterator_; |
| 154 TilingData::ReverseSpiralDifferenceIterator spiral_iterator_; |
138 }; | 155 }; |
139 | 156 |
140 ~PictureLayerTiling(); | 157 ~PictureLayerTiling(); |
141 | 158 |
142 // Create a tiling with no tiles. CreateTiles must be called to add some. | 159 // Create a tiling with no tiles. CreateTiles must be called to add some. |
143 static scoped_ptr<PictureLayerTiling> Create( | 160 static scoped_ptr<PictureLayerTiling> Create( |
144 float contents_scale, | 161 float contents_scale, |
145 const gfx::Size& layer_bounds, | 162 const gfx::Size& layer_bounds, |
146 PictureLayerTilingClient* client); | 163 PictureLayerTilingClient* client); |
147 gfx::Size layer_bounds() const { return layer_bounds_; } | 164 gfx::Size layer_bounds() const { return layer_bounds_; } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); | 332 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
316 | 333 |
317 // Computes a skewport. The calculation extrapolates the last visible | 334 // Computes a skewport. The calculation extrapolates the last visible |
318 // rect and the current visible rect to expand the skewport to where it | 335 // rect and the current visible rect to expand the skewport to where it |
319 // would be in |skewport_target_time| seconds. Note that the skewport | 336 // would be in |skewport_target_time| seconds. Note that the skewport |
320 // is guaranteed to contain the current visible rect. | 337 // is guaranteed to contain the current visible rect. |
321 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 338 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
322 const gfx::Rect& visible_rect_in_content_space) | 339 const gfx::Rect& visible_rect_in_content_space) |
323 const; | 340 const; |
324 | 341 |
325 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); | |
326 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, | |
327 EvictionCategory category); | |
328 | |
329 void Invalidate(const Region& layer_region); | 342 void Invalidate(const Region& layer_region); |
330 | 343 |
331 void DoInvalidate(const Region& layer_region, | 344 void DoInvalidate(const Region& layer_region, |
332 bool recreate_invalidated_tiles); | 345 bool recreate_invalidated_tiles); |
333 | 346 |
334 void UpdateTileAndTwinPriority(Tile* tile) const; | 347 void UpdateTileAndTwinPriority(Tile* tile) const; |
335 void UpdateTilePriority(Tile* tile) const; | 348 void UpdateTilePriority(Tile* tile) const; |
336 | 349 |
337 // Given properties. | 350 // Given properties. |
338 float contents_scale_; | 351 float contents_scale_; |
(...skipping 20 matching lines...) Expand all Loading... |
359 gfx::Rect current_soon_border_rect_; | 372 gfx::Rect current_soon_border_rect_; |
360 gfx::Rect current_eventually_rect_; | 373 gfx::Rect current_eventually_rect_; |
361 | 374 |
362 bool has_visible_rect_tiles_; | 375 bool has_visible_rect_tiles_; |
363 bool has_skewport_rect_tiles_; | 376 bool has_skewport_rect_tiles_; |
364 bool has_soon_border_rect_tiles_; | 377 bool has_soon_border_rect_tiles_; |
365 bool has_eventually_rect_tiles_; | 378 bool has_eventually_rect_tiles_; |
366 | 379 |
367 Occlusion current_occlusion_in_layer_space_; | 380 Occlusion current_occlusion_in_layer_space_; |
368 | 381 |
369 // TODO(reveman): Remove this in favour of an array of eviction_tiles_ when we | |
370 // change all enums to have a consistent way of getting the count/last | |
371 // element. | |
372 std::vector<Tile*> eviction_tiles_now_; | |
373 std::vector<Tile*> eviction_tiles_now_and_required_for_activation_; | |
374 std::vector<Tile*> eviction_tiles_soon_; | |
375 std::vector<Tile*> eviction_tiles_soon_and_required_for_activation_; | |
376 std::vector<Tile*> eviction_tiles_eventually_; | |
377 std::vector<Tile*> eviction_tiles_eventually_and_required_for_activation_; | |
378 | |
379 bool eviction_tiles_cache_valid_; | |
380 TreePriority eviction_cache_tree_priority_; | |
381 | |
382 private: | 382 private: |
383 DISALLOW_ASSIGN(PictureLayerTiling); | 383 DISALLOW_ASSIGN(PictureLayerTiling); |
384 | 384 |
385 RectExpansionCache expansion_cache_; | 385 RectExpansionCache expansion_cache_; |
386 }; | 386 }; |
387 | 387 |
388 } // namespace cc | 388 } // namespace cc |
389 | 389 |
390 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 390 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |