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

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: 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/eviction_tile_priority_queue.cc ('k') | cc/resources/picture_layer_tiling.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 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 ScopedTilePtr CreateTile(float contents_scale, 39 virtual ScopedTilePtr 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); 114 all_tiles.push_back(it->second);
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); 119 for (const auto& key_tile_pair : tiles_)
120 UpdateRequiredStatesOnTile(key_tile_pair.second);
119 } 121 }
122 std::map<const Tile*, PrioritizedTile>
123 UpdateAndGetAllPrioritizedTilesForTesting();
124
120 void SetAllTilesOccludedForTesting() { 125 void SetAllTilesOccludedForTesting() {
121 gfx::Rect viewport_in_layer_space = 126 gfx::Rect viewport_in_layer_space =
122 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_); 127 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_);
123 current_occlusion_in_layer_space_ = 128 current_occlusion_in_layer_space_ =
124 Occlusion(gfx::Transform(), 129 Occlusion(gfx::Transform(),
125 SimpleEnclosedRegion(viewport_in_layer_space), 130 SimpleEnclosedRegion(viewport_in_layer_space),
126 SimpleEnclosedRegion(viewport_in_layer_space)); 131 SimpleEnclosedRegion(viewport_in_layer_space));
127 } 132 }
128 const gfx::Rect& GetCurrentVisibleRectForTesting() const { 133 const gfx::Rect& GetCurrentVisibleRectForTesting() const {
129 return current_visible_rect_; 134 return current_visible_rect_;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 203
199 static 204 static
200 gfx::Rect ExpandRectEquallyToAreaBoundedBy( 205 gfx::Rect ExpandRectEquallyToAreaBoundedBy(
201 const gfx::Rect& starting_rect, 206 const gfx::Rect& starting_rect,
202 int64 target_area, 207 int64 target_area,
203 const gfx::Rect& bounding_rect, 208 const gfx::Rect& bounding_rect,
204 RectExpansionCache* cache); 209 RectExpansionCache* cache);
205 210
206 protected: 211 protected:
207 friend class CoverageIterator; 212 friend class CoverageIterator;
213 friend class PrioritizedTile;
208 friend class TilingSetRasterQueueAll; 214 friend class TilingSetRasterQueueAll;
209 friend class TilingSetRasterQueueRequired; 215 friend class TilingSetRasterQueueRequired;
210 friend class TilingSetEvictionQueue; 216 friend class TilingSetEvictionQueue;
211 217
212 using TileMapKey = std::pair<int, int>; 218 using TileMapKey = std::pair<int, int>;
213 using TileMap = base::ScopedPtrHashMap<TileMapKey, ScopedTilePtr>; 219 using TileMap = base::ScopedPtrHashMap<TileMapKey, ScopedTilePtr>;
214 220
215 struct FrameVisibleRect { 221 struct FrameVisibleRect {
216 gfx::Rect visible_rect_in_content_space; 222 gfx::Rect visible_rect_in_content_space;
217 double frame_time_in_seconds = 0.0; 223 double frame_time_in_seconds = 0.0;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds; 267 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds;
262 visible_rect_history_[0].visible_rect_in_content_space = 268 visible_rect_history_[0].visible_rect_in_content_space =
263 visible_rect_in_content_space; 269 visible_rect_in_content_space;
264 // If we don't have a second history item, set it to the most recent one. 270 // If we don't have a second history item, set it to the most recent one.
265 if (visible_rect_history_[1].frame_time_in_seconds == 0.0) 271 if (visible_rect_history_[1].frame_time_in_seconds == 0.0)
266 visible_rect_history_[1] = visible_rect_history_[0]; 272 visible_rect_history_[1] = visible_rect_history_[0];
267 } 273 }
268 bool IsTileOccludedOnCurrentTree(const Tile* tile) const; 274 bool IsTileOccludedOnCurrentTree(const Tile* tile) const;
269 bool ShouldCreateTileAt(int i, int j) const; 275 bool ShouldCreateTileAt(int i, int j) const;
270 bool IsTileOccluded(const Tile* tile) const; 276 bool IsTileOccluded(const Tile* tile) const;
271 void UpdateTilePriority(Tile* tile) const; 277 void UpdateRequiredStatesOnTile(Tile* tile) const;
278 PrioritizedTile MakePrioritizedTile(Tile* tile) const;
272 TilePriority ComputePriorityForTile(const Tile* tile) const; 279 TilePriority ComputePriorityForTile(const Tile* tile) const;
273 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; } 280 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; }
274 bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; } 281 bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; }
275 bool has_soon_border_rect_tiles() const { 282 bool has_soon_border_rect_tiles() const {
276 return has_soon_border_rect_tiles_; 283 return has_soon_border_rect_tiles_;
277 } 284 }
278 bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; } 285 bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; }
279 286
280 const gfx::Rect& current_visible_rect() const { 287 const gfx::Rect& current_visible_rect() const {
281 return current_visible_rect_; 288 return current_visible_rect_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 347
341 private: 348 private:
342 DISALLOW_ASSIGN(PictureLayerTiling); 349 DISALLOW_ASSIGN(PictureLayerTiling);
343 350
344 RectExpansionCache expansion_cache_; 351 RectExpansionCache expansion_cache_;
345 }; 352 };
346 353
347 } // namespace cc 354 } // namespace cc
348 355
349 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ 356 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_
OLDNEW
« no previous file with comments | « cc/resources/eviction_tile_priority_queue.cc ('k') | cc/resources/picture_layer_tiling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698