Chromium Code Reviews| Index: cc/resources/picture_layer_tiling.h |
| diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h |
| index 34e7defd99bd40c0e8fc3fbaa610ce4a5411cc00..586fe9c9966df8def825f4e788c1d28ce8b85bb8 100644 |
| --- a/cc/resources/picture_layer_tiling.h |
| +++ b/cc/resources/picture_layer_tiling.h |
| @@ -77,8 +77,10 @@ class CC_EXPORT PictureLayerTiling { |
| void Invalidate(const Region& layer_invalidation); |
| void SetRasterSourceOnTiles(); |
| void CreateMissingTilesInLiveTilesRect(); |
| + void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin); |
| - void CloneTilesAndPropertiesFrom(const PictureLayerTiling& twin_tiling); |
| + bool IsTileRequiredForActivation(const Tile* tile) const; |
| + bool IsTileRequiredForDraw(const Tile* tile) const; |
| void set_resolution(TileResolution resolution) { resolution_ = resolution; } |
| TileResolution resolution() const { return resolution_; } |
| @@ -95,34 +97,30 @@ class CC_EXPORT PictureLayerTiling { |
| Tile* TileAt(int i, int j) const { |
| TileMap::const_iterator iter = tiles_.find(TileMapKey(i, j)); |
| - return (iter == tiles_.end()) ? NULL : iter->second.get(); |
| + return iter == tiles_.end() ? nullptr : iter->second.get(); |
| } |
| + // For testing functionality. |
| void CreateAllTilesForTesting() { |
| SetLiveTilesRect(gfx::Rect(tiling_data_.tiling_size())); |
| } |
| - |
| const TilingData& TilingDataForTesting() const { return tiling_data_; } |
| - |
| std::vector<Tile*> AllTilesForTesting() const { |
| std::vector<Tile*> all_tiles; |
| for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| all_tiles.push_back(it->second.get()); |
| return all_tiles; |
| } |
| - |
| void UpdateAllTilePrioritiesForTesting() { |
| for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| UpdateTileAndTwinPriority(it->second.get()); |
| } |
| - |
| std::vector<scoped_refptr<Tile>> AllRefTilesForTesting() const { |
| std::vector<scoped_refptr<Tile>> all_tiles; |
| for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| all_tiles.push_back(it->second); |
| return all_tiles; |
| } |
| - |
| void SetAllTilesOccludedForTesting() { |
| gfx::Rect viewport_in_layer_space = |
| ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_); |
| @@ -131,37 +129,10 @@ class CC_EXPORT PictureLayerTiling { |
| SimpleEnclosedRegion(viewport_in_layer_space), |
| SimpleEnclosedRegion(viewport_in_layer_space)); |
| } |
| - |
| const gfx::Rect& GetCurrentVisibleRectForTesting() const { |
| return current_visible_rect_; |
| } |
| - bool IsTileOccluded(const Tile* tile) const; |
| - bool IsTileRequiredForActivationIfVisible(const Tile* tile) const; |
| - bool IsTileRequiredForDrawIfVisible(const Tile* tile) const; |
| - |
| - void UpdateTileAndTwinPriority(Tile* tile) const; |
| - TilePriority ComputePriorityForTile(const Tile* tile) const; |
| - void UpdateRequiredStateForTile(Tile* tile, WhichTree tree) const; |
| - bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; } |
| - bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; } |
| - bool has_soon_border_rect_tiles() const { |
| - return has_soon_border_rect_tiles_; |
| - } |
| - bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; } |
| - |
| - const gfx::Rect& current_visible_rect() const { |
| - return current_visible_rect_; |
| - } |
| - const gfx::Rect& current_skewport_rect() const { |
| - return current_skewport_rect_; |
| - } |
| - const gfx::Rect& current_soon_border_rect() const { |
| - return current_soon_border_rect_; |
| - } |
| - const gfx::Rect& current_eventually_rect() const { |
| - return current_eventually_rect_; |
| - } |
| void VerifyAllTilesHaveCurrentRasterSource() const; |
| // Iterate over all tiles to fill content_rect. Even if tiles are invalid |
| @@ -236,10 +207,6 @@ class CC_EXPORT PictureLayerTiling { |
| const gfx::Rect& bounding_rect, |
| RectExpansionCache* cache); |
| - bool has_ever_been_updated() const { |
| - return visible_rect_history_[0].frame_time_in_seconds != 0.0; |
| - } |
| - |
| protected: |
| friend class CoverageIterator; |
| friend class TilingSetRasterQueueAll; |
| @@ -262,12 +229,10 @@ class CC_EXPORT PictureLayerTiling { |
| int skewport_extrapolation_limit_in_content_pixels); |
| void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
| void VerifyLiveTilesRect(bool is_on_recycle_tree) const; |
| - Tile* CreateTile(int i, |
| - int j, |
| - const PictureLayerTiling* twin_tiling, |
| - PictureLayerTiling* recycled_twin); |
| + Tile* CreateTile(int i, int j); |
| // 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); |
| + bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; |
| // Computes a skewport. The calculation extrapolates the last visible |
| // rect and the current visible rect to expand the skewport to where it |
| @@ -278,12 +243,12 @@ class CC_EXPORT PictureLayerTiling { |
| const; |
| // Save the required data for computing tile priorities later. |
| - void UpdateTilePriorityRects(float content_to_screen_scale_, |
| - const gfx::Rect& visible_rect_in_content_space, |
| - const gfx::Rect& skewport, |
| - const gfx::Rect& soon_border_rect, |
| - const gfx::Rect& eventually_rect, |
| - const Occlusion& occlusion_in_layer_space); |
| + void SetTilePriorityRects(float content_to_screen_scale_, |
| + const gfx::Rect& visible_rect_in_content_space, |
| + const gfx::Rect& skewport, |
| + const gfx::Rect& soon_border_rect, |
| + const gfx::Rect& eventually_rect, |
| + const Occlusion& occlusion_in_layer_space); |
| void UpdateTilePriorityForTree(Tile* tile, WhichTree tree) const; |
| bool NeedsUpdateForFrameAtTimeAndViewport( |
| @@ -304,6 +269,42 @@ class CC_EXPORT PictureLayerTiling { |
| if (visible_rect_history_[1].frame_time_in_seconds == 0.0) |
| visible_rect_history_[1] = visible_rect_history_[0]; |
| } |
| + bool IsTileOccludedOnCurrentTree(const Tile* tile) const; |
| + bool ShouldCreateTileAt(int i, int j) const; |
| + bool IsTileOccluded(const Tile* tile) const; |
| + void UpdateTileAndTwinPriority(Tile* tile) const; |
| + TilePriority ComputePriorityForTile(const Tile* tile) const; |
| + bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; } |
| + bool has_skewport_rect_tiles() const { return has_skewport_rect_tiles_; } |
| + bool has_soon_border_rect_tiles() const { |
| + return has_soon_border_rect_tiles_; |
| + } |
| + bool has_eventually_rect_tiles() const { return has_eventually_rect_tiles_; } |
| + |
| + const gfx::Rect& current_visible_rect() const { |
| + return current_visible_rect_; |
| + } |
| + const gfx::Rect& pending_visible_rect() const { |
| + const PictureLayerTiling* twin = |
|
enne (OOO)
2015/04/13 22:36:02
This needs a serious comment. It's still hard to
vmpstr
2015/04/13 23:52:13
Well... to be fair, it doesn't just happen, it was
|
| + client_->GetTree() == ACTIVE_TREE |
| + ? client_->GetPendingOrActiveTwinTiling(this) |
| + : this; |
| + if (twin) |
| + return twin->current_visible_rect(); |
| + return current_visible_rect(); |
| + } |
| + const gfx::Rect& current_skewport_rect() const { |
| + return current_skewport_rect_; |
| + } |
| + const gfx::Rect& current_soon_border_rect() const { |
| + return current_soon_border_rect_; |
| + } |
| + const gfx::Rect& current_eventually_rect() const { |
| + return current_eventually_rect_; |
| + } |
| + bool has_ever_been_updated() const { |
| + return visible_rect_history_[0].frame_time_in_seconds != 0.0; |
| + } |
| const size_t max_tiles_for_interest_area_; |
| const float skewport_target_time_in_seconds_; |