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.
5 #ifndef CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_
6 #define CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_
10 #include "cc/base/cc_export.h"
11 #include "cc/resources/picture_layer_tiling_set.h"
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
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
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
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
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
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
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.
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 // This happens for a tile specific lower priority tree eviction queue
65 // (because eviction priority the combined priority).
66 // Those skipped shared out of order tiles are when returned only by the twin
68 class CC_EXPORT TilingSetEvictionQueue
{
70 TilingSetEvictionQueue(PictureLayerTilingSet
* tiling_set
,
71 bool skip_shared_out_of_order_tiles
);
72 ~TilingSetEvictionQueue();
75 const Tile
* Top() const;
80 bool AdvanceToNextEvictionTile();
81 bool AdvanceToNextPriorityBin();
82 bool AdvanceToNextTilingRangeType();
83 bool AdvanceToNextValidTiling();
85 PictureLayerTilingSet::TilingRange
CurrentTilingRange() const;
86 size_t CurrentTilingIndex() const;
88 PictureLayerTilingSet
* tiling_set_
;
90 bool skip_shared_out_of_order_tiles_
;
91 bool processing_soon_border_rect_
;
92 bool processing_required_for_activation_tiles_
;
94 TilePriority::PriorityBin current_priority_bin_
;
95 PictureLayerTiling
* current_tiling_
;
96 size_t current_tiling_index_
;
97 PictureLayerTilingSet::TilingRangeType current_tiling_range_type_
;
98 Tile
* current_eviction_tile_
;
100 TilingData::ReverseSpiralDifferenceIterator spiral_iterator_
;
101 TilingData::Iterator visible_iterator_
;
102 std::vector
<Tile
*> unoccluded_now_tiles_
;
107 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_