Index: cc/resources/picture_layer_tiling.h |
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h |
index 407a2ad74d0e4cade0e2becaa889fb776e040c5d..ac1644ca18b16ec20b46af2712d538cb94f00e75 100644 |
--- a/cc/resources/picture_layer_tiling.h |
+++ b/cc/resources/picture_layer_tiling.h |
@@ -45,6 +45,44 @@ class CC_EXPORT PictureLayerTilingClient { |
class CC_EXPORT PictureLayerTiling { |
public: |
+ class CC_EXPORT TilingRasterTileIterator { |
epennerAtGoogle
2014/03/05 00:16:03
Cool. One thing I didn't see in here is whether we
vmpstr
2014/03/05 00:37:21
Not really... See my comment in the unittests. I t
|
+ public: |
+ enum Type { VISIBLE, SKEWPORT, EVENTUALLY }; |
+ |
+ TilingRasterTileIterator(); |
+ explicit TilingRasterTileIterator(PictureLayerTiling* tiling); |
+ ~TilingRasterTileIterator(); |
+ |
+ operator bool() const { return !!current_tile_; } |
+ Tile* operator*() { return current_tile_; } |
+ Type get_type() const { return type_; } |
+ |
+ TilingRasterTileIterator& operator++(); |
+ |
+ bool HasVisibleTiles() const { return type_ == VISIBLE; } |
+ |
+ gfx::Rect TileBounds() const { |
+ DCHECK(*this); |
+ if (type_ == VISIBLE) { |
+ return tiling_->tiling_data_.TileBounds(visible_iterator_.index_x(), |
+ visible_iterator_.index_y()); |
+ } |
+ return tiling_->tiling_data_.TileBounds(spiral_iterator_.index_x(), |
+ spiral_iterator_.index_y()); |
+ } |
+ |
+ private: |
+ void AdvancePhase(); |
+ |
+ PictureLayerTiling* tiling_; |
+ |
+ Type type_; |
+ |
+ Tile* current_tile_; |
+ TilingData::Iterator visible_iterator_; |
+ TilingData::SpiralDifferenceIterator spiral_iterator_; |
+ }; |
+ |
~PictureLayerTiling(); |
// Create a tiling with no tiles. CreateTiles must be called to add some. |
@@ -69,6 +107,11 @@ class CC_EXPORT PictureLayerTiling { |
gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } |
float contents_scale() const { return contents_scale_; } |
+ Tile* TileAt(int i, int j) const { |
+ TileMap::const_iterator iter = tiles_.find(TileMapKey(i, j)); |
+ return (iter == tiles_.end()) ? NULL : iter->second.get(); |
+ } |
+ |
void CreateAllTilesForTesting() { |
SetLiveTilesRect(gfx::Rect(tiling_data_.total_size())); |
} |
@@ -81,8 +124,6 @@ class CC_EXPORT PictureLayerTiling { |
return all_tiles; |
} |
- Tile* TileAt(int i, int j) const; |
- |
// Iterate over all tiles to fill content_rect. Even if tiles are invalid |
// (i.e. no valid resource) this tiling should still iterate over them. |
// The union of all geometry_rect calls for each element iterated over should |
@@ -159,6 +200,8 @@ class CC_EXPORT PictureLayerTiling { |
return frame_time_in_seconds != last_impl_frame_time_in_seconds_; |
} |
+ size_t RequiredGPUMemoryInBytes() const; |
+ |
scoped_ptr<base::Value> AsValue() const; |
size_t GPUMemoryUsageInBytes() const; |
@@ -183,6 +226,9 @@ class CC_EXPORT PictureLayerTiling { |
} |
protected: |
+ friend class TilingRasterTileIterator; |
+ friend class TilingEvictionTileIterator; |
+ |
typedef std::pair<int, int> TileMapKey; |
typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
@@ -213,7 +259,13 @@ class CC_EXPORT PictureLayerTiling { |
// State saved for computing velocities based upon finite differences. |
double last_impl_frame_time_in_seconds_; |
- gfx::RectF last_visible_rect_in_content_space_; |
+ gfx::Rect last_visible_rect_in_content_space_; |
+ |
+ gfx::Rect current_visible_rect_in_content_space_; |
+ gfx::Rect current_skewport_; |
+ gfx::Rect current_eventually_rect_; |
+ |
+ WhichTree last_update_tree_; |
friend class CoverageIterator; |