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

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: Created 6 years, 4 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 898a7062328ab3434d400cdba4b889af36e97fad..e377eed3db7380bfa9ca9a586c4c8b0fdb538902 100644
--- a/cc/resources/picture_layer_tiling.h
+++ b/cc/resources/picture_layer_tiling.h
@@ -48,6 +48,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() {}
@@ -100,7 +101,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_;
@@ -166,12 +167,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)
@@ -179,10 +184,21 @@ class CC_EXPORT PictureLayerTiling {
return all_tiles;
}
+ void SetAllTilesOccludedForTesting() {
+ for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end();
+ ++it) {
+ occlusion_set_.insert(std::make_pair(it->second->tiling_i_index(),
+ it->second->tiling_j_index()));
+ }
+ }
+
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
@@ -243,18 +259,6 @@ class CC_EXPORT PictureLayerTiling {
const LayerImpl* render_target,
const gfx::Transform& draw_transform);
- // 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_;
}
@@ -313,6 +317,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_;
@@ -324,9 +331,12 @@ class CC_EXPORT PictureLayerTiling {
TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map.
gfx::Rect live_tiles_rect_;
+ base::hash_set<std::pair<int, int> > occlusion_set_;
+
// 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_;

Powered by Google App Engine
This is Rietveld 408576698