| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ | |
| 6 #define CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "cc/base/cc_export.h" | |
| 11 #include "cc/resources/picture_layer_tiling_set.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 // This eviction queue returned tiles from all tilings in a tiling set in | |
| 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. | |
| 75 class CC_EXPORT TilingSetEvictionQueue { | |
| 76 public: | |
| 77 TilingSetEvictionQueue(PictureLayerTilingSet* tiling_set, | |
| 78 TreePriority tree_priority, | |
| 79 bool skip_shared_out_of_order_tiles); | |
| 80 ~TilingSetEvictionQueue(); | |
| 81 | |
| 82 Tile* Top(); | |
| 83 const Tile* Top() const; | |
| 84 void Pop(); | |
| 85 bool IsEmpty() const; | |
| 86 | |
| 87 private: | |
| 88 bool AdvanceToNextEvictionTile(); | |
| 89 bool AdvanceToNextPriorityBin(); | |
| 90 bool AdvanceToNextTilingRangeType(); | |
| 91 bool AdvanceToNextValidTiling(); | |
| 92 | |
| 93 PictureLayerTilingSet::TilingRange CurrentTilingRange() const; | |
| 94 size_t CurrentTilingIndex() const; | |
| 95 bool IsSharedOutOfOrderTile(const Tile* tile) const; | |
| 96 size_t TilingIndexWithRequiredForActivationTiles() const; | |
| 97 | |
| 98 PictureLayerTilingSet* tiling_set_; | |
| 99 WhichTree tree_; | |
| 100 TreePriority tree_priority_; | |
| 101 bool skip_all_shared_tiles_; | |
| 102 bool skip_shared_out_of_order_tiles_; | |
| 103 bool processing_soon_border_rect_; | |
| 104 bool processing_tiling_with_required_for_activation_tiles_; | |
| 105 size_t tiling_index_with_required_for_activation_tiles_; | |
| 106 | |
| 107 TilePriority::PriorityBin current_priority_bin_; | |
| 108 PictureLayerTiling* current_tiling_; | |
| 109 size_t current_tiling_index_; | |
| 110 PictureLayerTilingSet::TilingRangeType current_tiling_range_type_; | |
| 111 Tile* current_eviction_tile_; | |
| 112 | |
| 113 TilingData::ReverseSpiralDifferenceIterator spiral_iterator_; | |
| 114 TilingData::Iterator visible_iterator_; | |
| 115 std::vector<Tile*> unoccluded_now_tiles_; | |
| 116 }; | |
| 117 | |
| 118 } // namespace cc | |
| 119 | |
| 120 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ | |
| OLD | NEW |