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

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

Issue 1126813002: cc: Pass priority rect information from iterators to tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 SetLiveTilesRect(gfx::Rect(tiling_data_.tiling_size())); 107 SetLiveTilesRect(gfx::Rect(tiling_data_.tiling_size()));
108 } 108 }
109 const TilingData& TilingDataForTesting() const { return tiling_data_; } 109 const TilingData& TilingDataForTesting() const { return tiling_data_; }
110 std::vector<Tile*> AllTilesForTesting() const { 110 std::vector<Tile*> AllTilesForTesting() const {
111 std::vector<Tile*> all_tiles; 111 std::vector<Tile*> all_tiles;
112 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) 112 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
113 all_tiles.push_back(it->second.get()); 113 all_tiles.push_back(it->second.get());
114 return all_tiles; 114 return all_tiles;
115 } 115 }
116 void UpdateAllTilePrioritiesForTesting() { 116 void UpdateAllTilePrioritiesForTesting() {
117 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) 117 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end();
118 UpdateTilePriority(it->second.get()); 118 ++it) {
119 Tile* tile = it->second.get();
120 UpdateTilePriority(tile, ComputePriorityRectForTile(tile));
121 }
119 } 122 }
120 std::vector<scoped_refptr<Tile>> AllRefTilesForTesting() const { 123 std::vector<scoped_refptr<Tile>> AllRefTilesForTesting() const {
121 std::vector<scoped_refptr<Tile>> all_tiles; 124 std::vector<scoped_refptr<Tile>> all_tiles;
122 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) 125 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
123 all_tiles.push_back(it->second); 126 all_tiles.push_back(it->second);
124 return all_tiles; 127 return all_tiles;
125 } 128 }
126 void SetAllTilesOccludedForTesting() { 129 void SetAllTilesOccludedForTesting() {
127 gfx::Rect viewport_in_layer_space = 130 gfx::Rect viewport_in_layer_space =
128 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_); 131 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 int64 target_area, 211 int64 target_area,
209 const gfx::Rect& bounding_rect, 212 const gfx::Rect& bounding_rect,
210 RectExpansionCache* cache); 213 RectExpansionCache* cache);
211 214
212 protected: 215 protected:
213 friend class CoverageIterator; 216 friend class CoverageIterator;
214 friend class TilingSetRasterQueueAll; 217 friend class TilingSetRasterQueueAll;
215 friend class TilingSetRasterQueueRequired; 218 friend class TilingSetRasterQueueRequired;
216 friend class TilingSetEvictionQueue; 219 friend class TilingSetEvictionQueue;
217 220
221 enum PriorityRect {
vmpstr 2015/05/05 18:04:01 nit: PriorityRectType
USE eero AT chromium.org 2015/05/06 12:05:20 Done.
222 VISIBLE_RECT,
223 PENDING_VISIBLE_RECT,
224 SKEWPORT_RECT,
225 SOON_BORDER_RECT,
226 EVENTUALLY_RECT
227 };
228
218 typedef std::pair<int, int> TileMapKey; 229 typedef std::pair<int, int> TileMapKey;
219 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap; 230 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap;
220 231
221 struct FrameVisibleRect { 232 struct FrameVisibleRect {
222 gfx::Rect visible_rect_in_content_space; 233 gfx::Rect visible_rect_in_content_space;
223 double frame_time_in_seconds = 0.0; 234 double frame_time_in_seconds = 0.0;
224 }; 235 };
225 236
226 PictureLayerTiling(WhichTree tree, 237 PictureLayerTiling(WhichTree tree,
227 float contents_scale, 238 float contents_scale,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds; 278 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds;
268 visible_rect_history_[0].visible_rect_in_content_space = 279 visible_rect_history_[0].visible_rect_in_content_space =
269 visible_rect_in_content_space; 280 visible_rect_in_content_space;
270 // If we don't have a second history item, set it to the most recent one. 281 // 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) 282 if (visible_rect_history_[1].frame_time_in_seconds == 0.0)
272 visible_rect_history_[1] = visible_rect_history_[0]; 283 visible_rect_history_[1] = visible_rect_history_[0];
273 } 284 }
274 bool IsTileOccludedOnCurrentTree(const Tile* tile) const; 285 bool IsTileOccludedOnCurrentTree(const Tile* tile) const;
275 bool ShouldCreateTileAt(int i, int j) const; 286 bool ShouldCreateTileAt(int i, int j) const;
276 bool IsTileOccluded(const Tile* tile) const; 287 bool IsTileOccluded(const Tile* tile) const;
277 void UpdateTilePriority(Tile* tile) const; 288 void UpdateTilePriority(Tile* tile, PriorityRect priority_rect) const;
278 TilePriority ComputePriorityForTile(const Tile* tile) const; 289 TilePriority ComputePriorityForTile(const Tile* tile,
290 PriorityRect priority_rect) const;
291 PriorityRect ComputePriorityRectForTile(const Tile* tile) const;
vmpstr 2015/05/05 18:04:01 nit: ComputePriorityRectTypeForTile
USE eero AT chromium.org 2015/05/06 12:05:20 Done.
279 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; } 292 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; }
280 bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; } 293 bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; }
281 bool has_soon_border_rect_tiles() const { 294 bool has_soon_border_rect_tiles() const {
282 return has_soon_border_rect_tiles_; 295 return has_soon_border_rect_tiles_;
283 } 296 }
284 bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; } 297 bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; }
285 298
286 const gfx::Rect& current_visible_rect() const { 299 const gfx::Rect& current_visible_rect() const {
287 return current_visible_rect_; 300 return current_visible_rect_;
288 } 301 }
(...skipping 10 matching lines...) Expand all
299 } 312 }
300 const gfx::Rect& current_soon_border_rect() const { 313 const gfx::Rect& current_soon_border_rect() const {
301 return current_soon_border_rect_; 314 return current_soon_border_rect_;
302 } 315 }
303 const gfx::Rect& current_eventually_rect() const { 316 const gfx::Rect& current_eventually_rect() const {
304 return current_eventually_rect_; 317 return current_eventually_rect_;
305 } 318 }
306 bool has_ever_been_updated() const { 319 bool has_ever_been_updated() const {
307 return visible_rect_history_[0].frame_time_in_seconds != 0.0; 320 return visible_rect_history_[0].frame_time_in_seconds != 0.0;
308 } 321 }
322 WhichTree tree() const { return tree_; }
309 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); 323 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles);
310 324
311 const size_t max_tiles_for_interest_area_; 325 const size_t max_tiles_for_interest_area_;
312 const float skewport_target_time_in_seconds_; 326 const float skewport_target_time_in_seconds_;
313 const int skewport_extrapolation_limit_in_content_pixels_; 327 const int skewport_extrapolation_limit_in_content_pixels_;
314 328
315 // Given properties. 329 // Given properties.
316 const float contents_scale_; 330 const float contents_scale_;
317 PictureLayerTilingClient* const client_; 331 PictureLayerTilingClient* const client_;
318 const WhichTree tree_; 332 const WhichTree tree_;
(...skipping 27 matching lines...) Expand all
346 360
347 private: 361 private:
348 DISALLOW_ASSIGN(PictureLayerTiling); 362 DISALLOW_ASSIGN(PictureLayerTiling);
349 363
350 RectExpansionCache expansion_cache_; 364 RectExpansionCache expansion_cache_;
351 }; 365 };
352 366
353 } // namespace cc 367 } // namespace cc
354 368
355 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ 369 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/picture_layer_tiling.cc » ('j') | cc/resources/picture_layer_tiling.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698