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

Unified Diff: cc/resources/picture_layer_tiling.h

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + fix Created 6 years, 3 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
Index: cc/resources/picture_layer_tiling.h
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h
index e3fffeefd5e4fac0e2d0b5b0ef608d543db8a676..97d6a085235b09640c20af455b96f90dd09940d0 100644
--- a/cc/resources/picture_layer_tiling.h
+++ b/cc/resources/picture_layer_tiling.h
@@ -50,6 +50,7 @@ class CC_EXPORT PictureLayerTilingClient {
virtual float GetSkewportTargetTimeInSeconds() const = 0;
virtual int GetSkewportExtrapolationLimitInContentPixels() const = 0;
virtual WhichTree GetTree() const = 0;
+ virtual bool RequiresHighResToDraw() const = 0;
protected:
virtual ~PictureLayerTilingClient() {}
@@ -102,7 +103,7 @@ class CC_EXPORT PictureLayerTiling {
void AdvancePhase();
bool TileNeedsRaster(Tile* tile) const {
RasterMode mode = tile->DetermineRasterModeForTree(tree_);
- return !tile->is_occluded(tree_) && tile->NeedsRasterForMode(mode);
+ return !tiling_->IsTileOccluded(tile) && tile->NeedsRasterForMode(mode);
}
PictureLayerTiling* tiling_;
@@ -168,12 +169,16 @@ class CC_EXPORT PictureLayerTiling {
std::vector<Tile*> AllTilesForTesting() const {
std::vector<Tile*> all_tiles;
- for (TileMap::const_iterator it = tiles_.begin();
- it != tiles_.end(); ++it)
+ 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)
@@ -181,10 +186,22 @@ class CC_EXPORT PictureLayerTiling {
return all_tiles;
}
+ void SetAllTilesOccludedForTesting() {
+ gfx::Rect viewport_in_layer_space =
+ ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_);
+ current_occlusion_in_layer_space_ =
+ Occlusion(gfx::Transform(),
+ 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 IsTileRequiredForActivation(const Tile* tile) 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
@@ -242,18 +259,6 @@ class CC_EXPORT PictureLayerTiling {
double current_frame_time_in_seconds,
const Occlusion& occlusion_in_layer_space);
- // Copies the src_tree priority into the dst_tree priority for all tiles.
- // The src_tree priority is reset to the lowest priority possible. This
- // also updates the pile on each tile to be the current client's pile.
- void DidBecomeActive();
-
- // Resets the active priority for all tiles in a tiling, when an active
- // tiling is becoming recycled. This may include some tiles which are
- // not in the the pending tiling (due to invalidations). This must
- // be called before DidBecomeActive, as it resets the active priority
- // while DidBecomeActive promotes pending priority on a similar set of tiles.
- void DidBecomeRecycled();
-
bool NeedsUpdateForFrameAtTime(double frame_time_in_seconds) {
return frame_time_in_seconds != last_impl_frame_time_in_seconds_;
}
@@ -316,6 +321,9 @@ class CC_EXPORT PictureLayerTiling {
void DoInvalidate(const Region& layer_region,
bool recreate_invalidated_tiles);
+ void UpdateTileAndTwinPriority(Tile* tile) const;
+ void UpdateTilePriority(Tile* tile) const;
+
// Given properties.
float contents_scale_;
gfx::Size layer_bounds_;
@@ -330,6 +338,7 @@ class CC_EXPORT PictureLayerTiling {
// State saved for computing velocities based upon finite differences.
double last_impl_frame_time_in_seconds_;
gfx::Rect last_visible_rect_in_content_space_;
+ float content_to_screen_scale_;
// Iteration rects in content space
gfx::Rect current_visible_rect_;
@@ -342,6 +351,8 @@ class CC_EXPORT PictureLayerTiling {
bool has_soon_border_rect_tiles_;
bool has_eventually_rect_tiles_;
+ Occlusion current_occlusion_in_layer_space_;
+
// TODO(reveman): Remove this in favour of an array of eviction_tiles_ when we
// change all enums to have a consistent way of getting the count/last
// element.

Powered by Google App Engine
This is Rietveld 408576698