Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(791)

Side by Side Diff: cc/resources/tiling_set_eviction_queue.h

Issue 1130123003: cc: Separate the priority from the tile and put in new PrioritizedTile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/tile_manager_unittest.cc ('k') | cc/resources/tiling_set_eviction_queue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 8 #include <vector>
9 9
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
11 #include "cc/resources/picture_layer_tiling_set.h" 11 #include "cc/resources/picture_layer_tiling_set.h"
12 #include "cc/resources/prioritized_tile.h"
12 13
13 namespace cc { 14 namespace cc {
14 15
15 // This eviction queue returned tiles from all tilings in a tiling set in 16 // This eviction queue returned tiles from all tilings in a tiling set in
16 // the order in which the tiles should be evicted. It can be thought of as the 17 // the order in which the tiles should be evicted. It can be thought of as the
17 // following: 18 // following:
18 // for all phases: 19 // for all phases:
19 // for all ordered tilings: 20 // for all ordered tilings:
20 // yield the next tile for the given phase from the given tiling 21 // yield the next tile for the given phase from the given tiling
21 // 22 //
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // higher of the two trees, we might visit a tile that should actually be 61 // higher of the two trees, we might visit a tile that should actually be
61 // returned by its twin. In those situations, the tiles are not returned. That 62 // returned by its twin. In those situations, the tiles are not returned. That
62 // is, since the twin has higher priority, it should return it when it gets to 63 // is, since the twin has higher priority, it should return it when it gets to
63 // it. This ensures that we don't block raster because we've returned a tile 64 // it. This ensures that we don't block raster because we've returned a tile
64 // with low priority on one tree, but high combined priority. 65 // with low priority on one tree, but high combined priority.
65 class CC_EXPORT TilingSetEvictionQueue { 66 class CC_EXPORT TilingSetEvictionQueue {
66 public: 67 public:
67 explicit TilingSetEvictionQueue(PictureLayerTilingSet* tiling_set); 68 explicit TilingSetEvictionQueue(PictureLayerTilingSet* tiling_set);
68 ~TilingSetEvictionQueue(); 69 ~TilingSetEvictionQueue();
69 70
70 Tile* Top(); 71 const PrioritizedTile& Top() const;
71 const Tile* Top() const;
72 void Pop(); 72 void Pop();
73 bool IsEmpty() const; 73 bool IsEmpty() const;
74 74
75 private: 75 private:
76 enum Phase { 76 enum Phase {
77 EVENTUALLY_RECT, 77 EVENTUALLY_RECT,
78 SOON_BORDER_RECT, 78 SOON_BORDER_RECT,
79 SKEWPORT_RECT, 79 SKEWPORT_RECT,
80 PENDING_VISIBLE_RECT, 80 PENDING_VISIBLE_RECT,
81 PENDING_VISIBLE_RECT_REQUIRED_FOR_ACTIVATION, 81 PENDING_VISIBLE_RECT_REQUIRED_FOR_ACTIVATION,
82 VISIBLE_RECT_OCCLUDED, 82 VISIBLE_RECT_OCCLUDED,
83 VISIBLE_RECT_UNOCCLUDED, 83 VISIBLE_RECT_UNOCCLUDED,
84 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED, 84 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_OCCLUDED,
85 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED 85 VISIBLE_RECT_REQUIRED_FOR_ACTIVATION_UNOCCLUDED
86 }; 86 };
87 87
88 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set); 88 void GenerateTilingOrder(PictureLayerTilingSet* tiling_set);
89 89
90 // Helper base class for individual region iterators. 90 // Helper base class for individual region iterators.
91 class EvictionRectIterator { 91 class EvictionRectIterator {
92 public: 92 public:
93 EvictionRectIterator(); 93 EvictionRectIterator();
94 EvictionRectIterator(std::vector<PictureLayerTiling*>* tilings, 94 EvictionRectIterator(std::vector<PictureLayerTiling*>* tilings,
95 WhichTree tree, 95 WhichTree tree,
96 bool skip_pending_visible_rect); 96 bool skip_pending_visible_rect);
97 97
98 bool done() const { return !tile_; } 98 bool done() const { return !prioritized_tile_.tile(); }
99 Tile* operator*() const { return tile_; } 99 const PrioritizedTile& operator*() const { return prioritized_tile_; }
100 100
101 protected: 101 protected:
102 ~EvictionRectIterator() = default; 102 ~EvictionRectIterator() = default;
103 103
104 template <typename TilingIteratorType> 104 template <typename TilingIteratorType>
105 bool AdvanceToNextTile(TilingIteratorType* iterator); 105 bool AdvanceToNextTile(TilingIteratorType* iterator);
106 template <typename TilingIteratorType> 106 template <typename TilingIteratorType>
107 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); 107 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator);
108 108
109 Tile* tile_; 109 PrioritizedTile prioritized_tile_;
110 std::vector<PictureLayerTiling*>* tilings_; 110 std::vector<PictureLayerTiling*>* tilings_;
111 WhichTree tree_; 111 WhichTree tree_;
112 bool skip_pending_visible_rect_; 112 bool skip_pending_visible_rect_;
113 size_t tiling_index_; 113 size_t tiling_index_;
114 }; 114 };
115 115
116 class PendingVisibleTilingIterator : public EvictionRectIterator { 116 class PendingVisibleTilingIterator : public EvictionRectIterator {
117 public: 117 public:
118 PendingVisibleTilingIterator() = default; 118 PendingVisibleTilingIterator() = default;
119 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, 119 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings,
120 WhichTree tree, 120 WhichTree tree,
121 bool return_required_for_activation_tiles); 121 bool return_required_for_activation_tiles);
122 122
123 PendingVisibleTilingIterator& operator++(); 123 PendingVisibleTilingIterator& operator++();
124 124
125 private: 125 private:
126 bool TileMatchesRequiredFlags(const Tile* tile) const; 126 bool TileMatchesRequiredFlags(const PrioritizedTile& tile) const;
127 127
128 TilingData::DifferenceIterator iterator_; 128 TilingData::DifferenceIterator iterator_;
129 bool return_required_for_activation_tiles_; 129 bool return_required_for_activation_tiles_;
130 }; 130 };
131 131
132 class VisibleTilingIterator : public EvictionRectIterator { 132 class VisibleTilingIterator : public EvictionRectIterator {
133 public: 133 public:
134 VisibleTilingIterator() = default; 134 VisibleTilingIterator() = default;
135 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, 135 VisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings,
136 WhichTree tree, 136 WhichTree tree,
137 bool return_occluded_tiles, 137 bool return_occluded_tiles,
138 bool return_required_for_activation_tiles); 138 bool return_required_for_activation_tiles);
139 139
140 VisibleTilingIterator& operator++(); 140 VisibleTilingIterator& operator++();
141 141
142 private: 142 private:
143 bool TileMatchesRequiredFlags(const Tile* tile) const; 143 bool TileMatchesRequiredFlags(const PrioritizedTile& tile) const;
144 144
145 TilingData::Iterator iterator_; 145 TilingData::Iterator iterator_;
146 bool return_occluded_tiles_; 146 bool return_occluded_tiles_;
147 bool return_required_for_activation_tiles_; 147 bool return_required_for_activation_tiles_;
148 }; 148 };
149 149
150 class SkewportTilingIterator : public EvictionRectIterator { 150 class SkewportTilingIterator : public EvictionRectIterator {
151 public: 151 public:
152 SkewportTilingIterator() = default; 152 SkewportTilingIterator() = default;
153 SkewportTilingIterator(std::vector<PictureLayerTiling*>* tilings, 153 SkewportTilingIterator(std::vector<PictureLayerTiling*>* tilings,
(...skipping 26 matching lines...) Expand all
180 EventuallyTilingIterator& operator++(); 180 EventuallyTilingIterator& operator++();
181 181
182 private: 182 private:
183 TilingData::ReverseSpiralDifferenceIterator iterator_; 183 TilingData::ReverseSpiralDifferenceIterator iterator_;
184 }; 184 };
185 185
186 void AdvancePhase(); 186 void AdvancePhase();
187 187
188 WhichTree tree_; 188 WhichTree tree_;
189 Phase phase_; 189 Phase phase_;
190 Tile* current_tile_; 190 PrioritizedTile current_tile_;
191 std::vector<PictureLayerTiling*> tilings_; 191 std::vector<PictureLayerTiling*> tilings_;
192 192
193 EventuallyTilingIterator eventually_iterator_; 193 EventuallyTilingIterator eventually_iterator_;
194 SoonBorderTilingIterator soon_iterator_; 194 SoonBorderTilingIterator soon_iterator_;
195 SkewportTilingIterator skewport_iterator_; 195 SkewportTilingIterator skewport_iterator_;
196 PendingVisibleTilingIterator pending_visible_iterator_; 196 PendingVisibleTilingIterator pending_visible_iterator_;
197 VisibleTilingIterator visible_iterator_; 197 VisibleTilingIterator visible_iterator_;
198 }; 198 };
199 199
200 } // namespace cc 200 } // namespace cc
201 201
202 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_ 202 #endif // CC_RESOURCES_TILING_SET_EVICTION_QUEUE_H_
OLDNEW
« no previous file with comments | « cc/resources/tile_manager_unittest.cc ('k') | cc/resources/tiling_set_eviction_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698