Index: cc/resources/picture_layer_tiling.h |
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h |
index daa04851d9c22f8759e283d5fd0d9d048b3f22bb..8b3cf6760ea5b9cb2e6f62141cfe44afc1a77e56 100644 |
--- a/cc/resources/picture_layer_tiling.h |
+++ b/cc/resources/picture_layer_tiling.h |
@@ -35,9 +35,9 @@ class CC_EXPORT PictureLayerTilingClient { |
public: |
// Create a tile at the given content_rect (in the contents scale of the |
// tiling) This might return null if the client cannot create such a tile. |
- virtual scoped_refptr<Tile> CreateTile( |
- PictureLayerTiling* tiling, |
- const gfx::Rect& content_rect) = 0; |
+ virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, |
+ const gfx::Rect& content_rect, |
+ int flags) = 0; |
virtual gfx::Size CalculateTileSize( |
const gfx::Size& content_bounds) const = 0; |
// This invalidation region defines the area (if any, it can by null) that |
@@ -128,7 +128,8 @@ class CC_EXPORT PictureLayerTiling { |
gfx::Size layer_bounds() const { return layer_bounds_; } |
void UpdateTilesToCurrentRasterSource(RasterSource* raster_source, |
const Region& layer_invalidation, |
- const gfx::Size& new_layer_bounds); |
+ const gfx::Size& new_layer_bounds, |
+ base::TimeTicks frame_time); |
void CreateMissingTilesInLiveTilesRect(); |
void RemoveTilesInRegion(const Region& layer_region); |
@@ -283,8 +284,24 @@ class CC_EXPORT PictureLayerTiling { |
friend class TilingRasterTileIterator; |
friend class TilingSetEvictionQueue; |
+ class CC_EXPORT TileInvalidationState { |
+ public: |
+ TileInvalidationState(); |
+ |
+ void Invalidate(base::TimeTicks current_frame_time); |
+ bool FrequentlyInvalidated() const; |
+ |
+ private: |
+ static const int kFrequentInvalidationThreshold; |
+ |
+ base::TimeTicks last_frame_time_; |
+ int frame_count_; |
+ }; |
+ |
typedef std::pair<int, int> TileMapKey; |
typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap; |
+ typedef base::hash_map<TileMapKey, TileInvalidationState> |
+ TileInvalidationStateMap; |
PictureLayerTiling(float contents_scale, |
const gfx::Size& layer_bounds, |
@@ -293,7 +310,10 @@ class CC_EXPORT PictureLayerTiling { |
void VerifyLiveTilesRect(); |
Tile* CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); |
// Returns true if the Tile existed and was removed from the tiling. |
- bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
+ bool RemoveTileAt(int i, |
+ int j, |
+ PictureLayerTiling* recycled_twin, |
+ bool remove_invalidation_state); |
// Computes a skewport. The calculation extrapolates the last visible |
// rect and the current visible rect to expand the skewport to where it |
@@ -307,10 +327,11 @@ class CC_EXPORT PictureLayerTiling { |
const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, |
EvictionCategory category); |
- void Invalidate(const Region& layer_region); |
+ void Invalidate(const Region& layer_region, base::TimeTicks frame_time); |
void DoInvalidate(const Region& layer_region, |
- bool recreate_invalidated_tiles); |
+ bool recreate_invalidated_tiles, |
+ base::TimeTicks frame_time); |
void UpdateTileAndTwinPriority(Tile* tile) const; |
void UpdateTilePriority(Tile* tile) const; |
@@ -324,6 +345,7 @@ class CC_EXPORT PictureLayerTiling { |
// Internal data. |
TilingData tiling_data_; |
TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. |
+ TileInvalidationStateMap tile_invalidation_states_; |
gfx::Rect live_tiles_rect_; |
// State saved for computing velocities based upon finite differences. |