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

Side by Side Diff: cc/resources/picture_layer_tiling.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: make reviewer happier 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
OLDNEW
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 <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 22
23 namespace base { 23 namespace base {
24 namespace trace_event { 24 namespace trace_event {
25 class TracedValue; 25 class TracedValue;
26 } 26 }
27 } 27 }
28 28
29 namespace cc { 29 namespace cc {
30 30
31 class PictureLayerTiling; 31 class PictureLayerTiling;
32 class PrioritizedTile;
32 class RasterSource; 33 class RasterSource;
33 34
34 class CC_EXPORT PictureLayerTilingClient { 35 class CC_EXPORT PictureLayerTilingClient {
35 public: 36 public:
36 // Create a tile at the given content_rect (in the contents scale of the 37 // Create a tile at the given content_rect (in the contents scale of the
37 // tiling) This might return null if the client cannot create such a tile. 38 // tiling) This might return null if the client cannot create such a tile.
38 virtual scoped_refptr<Tile> CreateTile(float contents_scale, 39 virtual scoped_refptr<Tile> CreateTile(float contents_scale,
39 const gfx::Rect& content_rect) = 0; 40 const gfx::Rect& content_rect) = 0;
40 virtual gfx::Size CalculateTileSize( 41 virtual gfx::Size CalculateTileSize(
41 const gfx::Size& content_bounds) const = 0; 42 const gfx::Size& content_bounds) const = 0;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void CreateAllTilesForTesting() { 107 void CreateAllTilesForTesting() {
107 SetLiveTilesRect(gfx::Rect(tiling_data_.tiling_size())); 108 SetLiveTilesRect(gfx::Rect(tiling_data_.tiling_size()));
108 } 109 }
109 const TilingData& TilingDataForTesting() const { return tiling_data_; } 110 const TilingData& TilingDataForTesting() const { return tiling_data_; }
110 std::vector<Tile*> AllTilesForTesting() const { 111 std::vector<Tile*> AllTilesForTesting() const {
111 std::vector<Tile*> all_tiles; 112 std::vector<Tile*> all_tiles;
112 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) 113 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
113 all_tiles.push_back(it->second.get()); 114 all_tiles.push_back(it->second.get());
114 return all_tiles; 115 return all_tiles;
115 } 116 }
116 void UpdateAllTilePrioritiesForTesting() { 117
117 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) 118 void UpdateAllRequiredStateForTesting() {
118 UpdateTilePriority(it->second.get()); 119 for (const auto& key_tile_pair : tiles_)
120 UpdateRequiredStatesOnTile(key_tile_pair.second.get());
119 } 121 }
122 std::map<const Tile*, PrioritizedTile>
123 UpdateAndGetAllPrioritizedTilesForTesting();
124
120 std::vector<scoped_refptr<Tile>> AllRefTilesForTesting() const { 125 std::vector<scoped_refptr<Tile>> AllRefTilesForTesting() const {
121 std::vector<scoped_refptr<Tile>> all_tiles; 126 std::vector<scoped_refptr<Tile>> all_tiles;
122 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) 127 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
123 all_tiles.push_back(it->second); 128 all_tiles.push_back(it->second);
124 return all_tiles; 129 return all_tiles;
125 } 130 }
126 void SetAllTilesOccludedForTesting() { 131 void SetAllTilesOccludedForTesting() {
127 gfx::Rect viewport_in_layer_space = 132 gfx::Rect viewport_in_layer_space =
128 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_); 133 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_);
129 current_occlusion_in_layer_space_ = 134 current_occlusion_in_layer_space_ =
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 209
205 static 210 static
206 gfx::Rect ExpandRectEquallyToAreaBoundedBy( 211 gfx::Rect ExpandRectEquallyToAreaBoundedBy(
207 const gfx::Rect& starting_rect, 212 const gfx::Rect& starting_rect,
208 int64 target_area, 213 int64 target_area,
209 const gfx::Rect& bounding_rect, 214 const gfx::Rect& bounding_rect,
210 RectExpansionCache* cache); 215 RectExpansionCache* cache);
211 216
212 protected: 217 protected:
213 friend class CoverageIterator; 218 friend class CoverageIterator;
219 friend class PrioritizedTile;
214 friend class TilingSetRasterQueueAll; 220 friend class TilingSetRasterQueueAll;
215 friend class TilingSetRasterQueueRequired; 221 friend class TilingSetRasterQueueRequired;
216 friend class TilingSetEvictionQueue; 222 friend class TilingSetEvictionQueue;
217 223
218 typedef std::pair<int, int> TileMapKey; 224 typedef std::pair<int, int> TileMapKey;
219 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap; 225 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap;
220 226
221 struct FrameVisibleRect { 227 struct FrameVisibleRect {
222 gfx::Rect visible_rect_in_content_space; 228 gfx::Rect visible_rect_in_content_space;
223 double frame_time_in_seconds = 0.0; 229 double frame_time_in_seconds = 0.0;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds; 273 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds;
268 visible_rect_history_[0].visible_rect_in_content_space = 274 visible_rect_history_[0].visible_rect_in_content_space =
269 visible_rect_in_content_space; 275 visible_rect_in_content_space;
270 // If we don't have a second history item, set it to the most recent one. 276 // If we don't have a second history item, set it to the most recent one.
271 if (visible_rect_history_[1].frame_time_in_seconds == 0.0) 277 if (visible_rect_history_[1].frame_time_in_seconds == 0.0)
272 visible_rect_history_[1] = visible_rect_history_[0]; 278 visible_rect_history_[1] = visible_rect_history_[0];
273 } 279 }
274 bool IsTileOccludedOnCurrentTree(const Tile* tile) const; 280 bool IsTileOccludedOnCurrentTree(const Tile* tile) const;
275 bool ShouldCreateTileAt(int i, int j) const; 281 bool ShouldCreateTileAt(int i, int j) const;
276 bool IsTileOccluded(const Tile* tile) const; 282 bool IsTileOccluded(const Tile* tile) const;
277 void UpdateTilePriority(Tile* tile) const; 283 void UpdateRequiredStatesOnTile(Tile* tile) const;
284 PrioritizedTile MakePrioritizedTile(Tile* tile) const;
278 TilePriority ComputePriorityForTile(const Tile* tile) const; 285 TilePriority ComputePriorityForTile(const Tile* tile) const;
279 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; } 286 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; }
280 bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; } 287 bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; }
281 bool has_soon_border_rect_tiles() const { 288 bool has_soon_border_rect_tiles() const {
282 return has_soon_border_rect_tiles_; 289 return has_soon_border_rect_tiles_;
283 } 290 }
284 bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; } 291 bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; }
285 292
286 const gfx::Rect& current_visible_rect() const { 293 const gfx::Rect& current_visible_rect() const {
287 return current_visible_rect_; 294 return current_visible_rect_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 353
347 private: 354 private:
348 DISALLOW_ASSIGN(PictureLayerTiling); 355 DISALLOW_ASSIGN(PictureLayerTiling);
349 356
350 RectExpansionCache expansion_cache_; 357 RectExpansionCache expansion_cache_;
351 }; 358 };
352 359
353 } // namespace cc 360 } // namespace cc
354 361
355 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ 362 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698