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

Unified Diff: cc/resources/picture_layer_tiling.h

Issue 1051993002: cc: Remove tile sharing from tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/picture_layer_tiling.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e108bf82175403b15fd2f31ad2486725f435ec25 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,55 @@ 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_;
+ }
+ // This returns "next" visible rect. That is, when the pending tree (if one
enne (OOO) 2015/04/14 23:27:16 Ok, fine. I think this comment makes things more
vmpstr 2015/04/15 19:16:35 Sure. Done.
+ // exists) activates, the value returned by current_visible_rect will become
+ // this value. If there is no pending tree, then this value _is_ the current
+ // visible rect. Similarly, if we're quering this value on the pending tree,
+ // then this is also the same value as the current visible rect. The only
+ // situations where this returns a different value is when queried on the
+ // active tree and the pending tree has a different visible rect.
+ // This rect is used to identify active tree tiles that are required for
+ // activation. That is, since activation will move our visible rect to this
+ // value, any tile that exists in the pending_visible_rect but not in the
+ // current_visible_rect is going to make it on screen for the first time:
+ // it could be required for activation. In cases where this value is the same
+ // as the current visible rect, there are no such tiles.
+ const gfx::Rect& pending_visible_rect() const {
+ const PictureLayerTiling* twin =
+ 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_;
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/picture_layer_tiling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698