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> | |
9 | |
8 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
9 #include "cc/resources/picture_layer_tiling_set.h" | 11 #include "cc/resources/picture_layer_tiling_set.h" |
10 | 12 |
11 namespace cc { | 13 namespace cc { |
12 | 14 |
15 // This eviction queue returned tiles from all tilings in a tiling set in | |
vmpstr
2014/12/11 18:35:03
That's awesome. Thanks for the comment.
| |
16 // the following order: | |
17 // 1) Eventually rect tiles (EVENTUALLY tiles). | |
18 // 1) Eventually rect tiles not required for activation from each tiling in | |
19 // the tiling set, in turn, in the following order: | |
20 // 1) the first higher than high res tiling, the second one and so on | |
21 // 2) the first lower than low res tiling, the second one and so on | |
22 // 3) the first between high and low res tiling, the second one and so on | |
23 // 4) low res tiling | |
24 // 5) high res tiling | |
25 // 2) Eventually rect tiles required for activation from the tiling with | |
26 // required for activation tiles. In the case of a pending tree tiling | |
27 // set that is the high res tiling. In the case of an active tree tiling | |
28 // set that is a tiling whose twin tiling is a pending tree high res | |
29 // tiling. | |
30 // 2) Soon border rect and skewport rect tiles (whose priority bin is SOON | |
31 // unless the max tile priority bin is lowered by PictureLayerTilingClient). | |
32 // 1) Soon border rect and skewport rect tiles not required for activation | |
33 // from each tiling in the tiling set. | |
34 // * Tilings are iterated in the same order as in the case of eventually | |
35 // rect tiles not required for activation. | |
36 // * For each tiling, first soon border rect tiles and then skewport | |
37 // rect tiles are returned. | |
38 // 2) Soon border rect and skewport rect tiles required for activation from | |
39 // the tiling with required for activation tiles. | |
40 // * First soon border rect tiles and then skewport rect tiles are | |
41 // returned. | |
42 // 3) Visible rect tiles (whose priority bin is NOW unless the max tile | |
43 // priority bin is lowered by PictureLayerTilingClient). | |
44 // 1) Visible rect tiles not required for activation from each tiling in | |
45 // the tiling set. | |
46 // * Tilings are iterated in the same order as in the case of eventually | |
47 // rect tiles not required for activation. | |
48 // * For each tiling, first occluded tiles and then unoccluded tiles | |
49 // are returned. | |
50 // 2) Visible rect tiles required for activation from the tiling with | |
51 // required for activation tiles. | |
52 // * First occluded tiles and then unoccluded tiles are returned. | |
53 // If the max tile priority bin is lowered by PictureLayerTilingClient, | |
54 // occlusion is not taken into account as occlusion is meaningful only for | |
55 // NOW tiles. | |
56 // | |
57 // Within each tiling and tile priority rect, tiles are returned in reverse | |
58 // spiral order i.e. in (mostly) decreasing distance-to-visible order. | |
59 // | |
60 // If the skip_shared_out_of_order_tiles value passed to the constructor is | |
61 // true (like it should be when there is a twin layer with a twin tiling set), | |
62 // eviction queue does not return shared which are out of order because their | |
63 // priority for tree priority is lowered or raised by a twin layer. | |
64 // * If tree_priority is SAME_PRIORITY_FOR_BOTH_TREES, this happens for | |
65 // a tile specific lower priority tree eviction queue (because priority for | |
66 // tree priority is a merged priority). | |
67 // * If tree priority is NEW_CONTENT_TAKES_PRIORITY, this happens for | |
68 // an active tree eviction queue (because priority for tree priority is | |
69 // the pending priority). | |
70 // * If tree_priority is SMOOTHNESS_TAKES_PRIORITY, this happens for a pending | |
71 // tree eviction queue (because priority for tree priority is the active | |
72 // priority). | |
73 // Those skipped shared out of order tiles are when returned only by the twin | |
74 // eviction queue. | |
13 class CC_EXPORT TilingSetEvictionQueue { | 75 class CC_EXPORT TilingSetEvictionQueue { |
14 public: | 76 public: |
15 TilingSetEvictionQueue(); | 77 TilingSetEvictionQueue(); |
16 TilingSetEvictionQueue(PictureLayerTilingSet* tiling_set, | 78 TilingSetEvictionQueue(PictureLayerTilingSet* tiling_set, |
17 TreePriority tree_priority); | 79 TreePriority tree_priority, |
80 bool skip_shared_out_of_order_tiles); | |
18 ~TilingSetEvictionQueue(); | 81 ~TilingSetEvictionQueue(); |
19 | 82 |
20 Tile* Top(); | 83 Tile* Top(); |
21 const Tile* Top() const; | 84 const Tile* Top() const; |
22 void Pop(); | 85 void Pop(); |
23 bool IsEmpty() const; | 86 bool IsEmpty() const; |
24 | 87 |
25 private: | 88 private: |
26 bool AdvanceToNextCategory(); | |
27 bool AdvanceToNextEvictionTile(); | 89 bool AdvanceToNextEvictionTile(); |
90 bool AdvanceToNextPriorityBin(); | |
28 bool AdvanceToNextTilingRangeType(); | 91 bool AdvanceToNextTilingRangeType(); |
29 bool AdvanceToNextValidTiling(); | 92 bool AdvanceToNextValidTiling(); |
30 | 93 |
31 PictureLayerTilingSet::TilingRange CurrentTilingRange() const; | 94 PictureLayerTilingSet::TilingRange CurrentTilingRange() const; |
32 size_t CurrentTilingIndex() const; | 95 size_t CurrentTilingIndex() const; |
96 bool IsSharedOutOfOrderTile(const Tile* tile) const; | |
97 size_t TilingIndexWithRequiredForActivationTiles() const; | |
33 | 98 |
34 PictureLayerTilingSet* tiling_set_; | 99 PictureLayerTilingSet* tiling_set_; |
100 WhichTree tree_; | |
35 TreePriority tree_priority_; | 101 TreePriority tree_priority_; |
102 bool skip_all_shared_tiles_; | |
103 bool skip_shared_out_of_order_tiles_; | |
104 bool processing_soon_border_rect_; | |
105 bool processing_tiling_with_required_for_activation_tiles_; | |
106 size_t tiling_index_with_required_for_activation_tiles_; | |
36 | 107 |
37 PictureLayerTiling::EvictionCategory current_category_; | 108 TilePriority::PriorityBin current_priority_bin_; |
109 PictureLayerTiling* current_tiling_; | |
38 size_t current_tiling_index_; | 110 size_t current_tiling_index_; |
39 PictureLayerTilingSet::TilingRangeType current_tiling_range_type_; | 111 PictureLayerTilingSet::TilingRangeType current_tiling_range_type_; |
40 Tile* current_eviction_tile_; | 112 Tile* current_eviction_tile_; |
41 | 113 |
42 const std::vector<Tile*>* eviction_tiles_; | 114 TilingData::ReverseSpiralDifferenceIterator spiral_iterator_; |
43 size_t next_eviction_tile_index_; | 115 TilingData::Iterator visible_iterator_; |
116 std::vector<Tile*> unoccluded_now_tiles_; | |
44 }; | 117 }; |
45 | 118 |
46 } // namespace cc | 119 } // namespace cc |
47 | 120 |
48 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_ | 121 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ |
OLD | NEW |