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

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

Issue 775483002: cc: Remove max tiles and skewport constants from tiling client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 30 matching lines...) Expand all
41 virtual gfx::Size CalculateTileSize( 41 virtual gfx::Size CalculateTileSize(
42 const gfx::Size& content_bounds) const = 0; 42 const gfx::Size& content_bounds) const = 0;
43 // This invalidation region defines the area (if any, it can by null) that 43 // This invalidation region defines the area (if any, it can by null) that
44 // tiles can not be shared between pending and active trees. 44 // tiles can not be shared between pending and active trees.
45 virtual const Region* GetPendingInvalidation() = 0; 45 virtual const Region* GetPendingInvalidation() = 0;
46 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( 46 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling(
47 const PictureLayerTiling* tiling) const = 0; 47 const PictureLayerTiling* tiling) const = 0;
48 virtual PictureLayerTiling* GetRecycledTwinTiling( 48 virtual PictureLayerTiling* GetRecycledTwinTiling(
49 const PictureLayerTiling* tiling) = 0; 49 const PictureLayerTiling* tiling) = 0;
50 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0; 50 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0;
51 virtual size_t GetMaxTilesForInterestArea() const = 0;
52 virtual float GetSkewportTargetTimeInSeconds() const = 0;
53 virtual int GetSkewportExtrapolationLimitInContentPixels() const = 0;
54 virtual WhichTree GetTree() const = 0; 51 virtual WhichTree GetTree() const = 0;
55 virtual bool RequiresHighResToDraw() const = 0; 52 virtual bool RequiresHighResToDraw() const = 0;
56 53
57 protected: 54 protected:
58 virtual ~PictureLayerTilingClient() {} 55 virtual ~PictureLayerTilingClient() {}
59 }; 56 };
60 57
61 class CC_EXPORT PictureLayerTiling { 58 class CC_EXPORT PictureLayerTiling {
62 public: 59 public:
63 static const int kBorderTexels = 1; 60 static const int kBorderTexels = 1;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 TilingData::Iterator visible_iterator_; 114 TilingData::Iterator visible_iterator_;
118 TilingData::SpiralDifferenceIterator spiral_iterator_; 115 TilingData::SpiralDifferenceIterator spiral_iterator_;
119 }; 116 };
120 117
121 ~PictureLayerTiling(); 118 ~PictureLayerTiling();
122 119
123 // Create a tiling with no tiles. CreateTiles must be called to add some. 120 // Create a tiling with no tiles. CreateTiles must be called to add some.
124 static scoped_ptr<PictureLayerTiling> Create( 121 static scoped_ptr<PictureLayerTiling> Create(
125 float contents_scale, 122 float contents_scale,
126 const gfx::Size& layer_bounds, 123 const gfx::Size& layer_bounds,
127 PictureLayerTilingClient* client); 124 PictureLayerTilingClient* client,
125 size_t max_tiles_for_interest_area,
126 float skewport_target_time_in_seconds,
127 int skewport_extrapolation_limit_in_content_pixels);
128
128 gfx::Size layer_bounds() const { return layer_bounds_; } 129 gfx::Size layer_bounds() const { return layer_bounds_; }
129 void UpdateTilesToCurrentRasterSource(RasterSource* raster_source, 130 void UpdateTilesToCurrentRasterSource(RasterSource* raster_source,
130 const Region& layer_invalidation, 131 const Region& layer_invalidation,
131 const gfx::Size& new_layer_bounds); 132 const gfx::Size& new_layer_bounds);
132 void CreateMissingTilesInLiveTilesRect(); 133 void CreateMissingTilesInLiveTilesRect();
133 void RemoveTilesInRegion(const Region& layer_region); 134 void RemoveTilesInRegion(const Region& layer_region);
134 135
135 void SetClient(PictureLayerTilingClient* client); 136 void SetClient(PictureLayerTilingClient* client);
136 void set_resolution(TileResolution resolution) { resolution_ = resolution; } 137 void set_resolution(TileResolution resolution) { resolution_ = resolution; }
137 TileResolution resolution() const { return resolution_; } 138 TileResolution resolution() const { return resolution_; }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 protected: 282 protected:
282 friend class CoverageIterator; 283 friend class CoverageIterator;
283 friend class TilingRasterTileIterator; 284 friend class TilingRasterTileIterator;
284 friend class TilingSetEvictionQueue; 285 friend class TilingSetEvictionQueue;
285 286
286 typedef std::pair<int, int> TileMapKey; 287 typedef std::pair<int, int> TileMapKey;
287 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap; 288 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap;
288 289
289 PictureLayerTiling(float contents_scale, 290 PictureLayerTiling(float contents_scale,
290 const gfx::Size& layer_bounds, 291 const gfx::Size& layer_bounds,
291 PictureLayerTilingClient* client); 292 PictureLayerTilingClient* client,
293 size_t max_tiles_for_interest_area,
294 float skewport_target_time_in_seconds,
295 int skewport_extrapolation_limit_in_content_pixels);
292 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); 296 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect);
293 void VerifyLiveTilesRect(); 297 void VerifyLiveTilesRect();
294 Tile* CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); 298 Tile* CreateTile(int i, int j, const PictureLayerTiling* twin_tiling);
295 // Returns true if the Tile existed and was removed from the tiling. 299 // Returns true if the Tile existed and was removed from the tiling.
296 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); 300 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin);
297 301
298 // Computes a skewport. The calculation extrapolates the last visible 302 // Computes a skewport. The calculation extrapolates the last visible
299 // rect and the current visible rect to expand the skewport to where it 303 // rect and the current visible rect to expand the skewport to where it
300 // would be in |skewport_target_time| seconds. Note that the skewport 304 // would be in |skewport_target_time| seconds. Note that the skewport
301 // is guaranteed to contain the current visible rect. 305 // is guaranteed to contain the current visible rect.
302 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, 306 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds,
303 const gfx::Rect& visible_rect_in_content_space) 307 const gfx::Rect& visible_rect_in_content_space)
304 const; 308 const;
305 309
306 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); 310 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority);
307 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, 311 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority,
308 EvictionCategory category); 312 EvictionCategory category);
309 313
310 void Invalidate(const Region& layer_region); 314 void Invalidate(const Region& layer_region);
311 315
312 void DoInvalidate(const Region& layer_region, 316 void DoInvalidate(const Region& layer_region,
313 bool recreate_invalidated_tiles); 317 bool recreate_invalidated_tiles);
314 318
315 void UpdateTileAndTwinPriority(Tile* tile) const; 319 void UpdateTileAndTwinPriority(Tile* tile) const;
316 void UpdateTilePriority(Tile* tile) const; 320 void UpdateTilePriority(Tile* tile) const;
317 321
322 const size_t max_tiles_for_interest_area_;
323 const float skewport_target_time_in_seconds_;
324 const int skewport_extrapolation_limit_in_content_pixels_;
325
318 // Given properties. 326 // Given properties.
319 float contents_scale_; 327 float contents_scale_;
320 gfx::Size layer_bounds_; 328 gfx::Size layer_bounds_;
321 TileResolution resolution_; 329 TileResolution resolution_;
322 PictureLayerTilingClient* client_; 330 PictureLayerTilingClient* client_;
323 331
324 // Internal data. 332 // Internal data.
325 TilingData tiling_data_; 333 TilingData tiling_data_;
326 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. 334 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map.
327 gfx::Rect live_tiles_rect_; 335 gfx::Rect live_tiles_rect_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 370
363 private: 371 private:
364 DISALLOW_ASSIGN(PictureLayerTiling); 372 DISALLOW_ASSIGN(PictureLayerTiling);
365 373
366 RectExpansionCache expansion_cache_; 374 RectExpansionCache expansion_cache_;
367 }; 375 };
368 376
369 } // namespace cc 377 } // namespace cc
370 378
371 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ 379 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698