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

Unified Diff: cc/layer_tree_host_common.cc

Issue 12045086: cc: Throttle tile priority updates to once a frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasedonmaster Created 7 years, 11 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/layer_tree_host_common.h ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 7c559b7420b180ae1c09b92751505c04aa62d82e..bffc7db62a3c9001b034355b17915fb000ca1a60 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -235,22 +235,19 @@ static inline bool subtreeShouldBeSkipped(Layer* layer)
// Called on each layer that could be drawn after all information from
// calcDrawProperties has been updated on that layer. May have some false
// positives (e.g. layers get this called on them but don't actually get drawn).
-static inline void markLayerAsUpdated(LayerImpl* layer)
+static inline void updateTilePrioritiesForLayer(LayerImpl* layer)
{
- layer->didUpdateTransforms();
+ layer->updateTilePriorities();
// Mask layers don't get this call, so explicitly update them so they can
// kick off tile rasterization.
if (layer->maskLayer())
- layer->maskLayer()->didUpdateTransforms();
- if (layer->replicaLayer()) {
- layer->replicaLayer()->didUpdateTransforms();
- if (layer->replicaLayer()->maskLayer())
- layer->replicaLayer()->maskLayer()->didUpdateTransforms();
- }
+ layer->maskLayer()->updateTilePriorities();
+ if (layer->replicaLayer() && layer->replicaLayer()->maskLayer())
+ layer->replicaLayer()->maskLayer()->updateTilePriorities();
}
-static inline void markLayerAsUpdated(Layer* layer)
+static inline void updateTilePrioritiesForLayer(Layer* layer)
{
}
@@ -534,7 +531,7 @@ static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo
const gfx::Rect& clipRectFromAncestor, const gfx::Rect& clipRectFromAncestorInDescendantSpace, bool ancestorClipsSubtree,
RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList,
LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, bool subtreeCanUseLCDText,
- gfx::Rect& drawableContentRectOfSubtree)
+ gfx::Rect& drawableContentRectOfSubtree, bool updateTilePriorities)
{
// This function computes the new matrix transformations recursively for this
// layer and all its descendants. It also computes the appropriate render surfaces.
@@ -880,7 +877,7 @@ static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo
calculateDrawPropertiesInternal<LayerType, LayerList, RenderSurfaceType>(child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix,
clipRectForSubtree, clipRectForSubtreeInDescendantSpace, subtreeShouldBeClipped, nearestAncestorThatMovesPixels,
renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor,
- subtreeCanUseLCDText, drawableContentRectOfChildSubtree);
+ subtreeCanUseLCDText, drawableContentRectOfChildSubtree, updateTilePriorities);
if (!drawableContentRectOfChildSubtree.IsEmpty()) {
accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOfChildSubtree);
if (child->renderSurface())
@@ -980,7 +977,8 @@ static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo
}
}
- markLayerAsUpdated(layer);
+ if (updateTilePriorities)
+ updateTilePrioritiesForLayer(layer);
// If neither this layer nor any of its children were added, early out.
if (sortingStartIndex == descendants.size())
@@ -1012,6 +1010,7 @@ void LayerTreeHostCommon::calculateDrawProperties(Layer* rootLayer, const gfx::S
// The root layer's renderSurface should receive the deviceViewport as the initial clipRect.
bool subtreeShouldBeClipped = true;
gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
+ bool updateTilePriorities = false;
// This function should have received a root layer.
DCHECK(isRootLayer(rootLayer));
@@ -1021,7 +1020,8 @@ void LayerTreeHostCommon::calculateDrawProperties(Layer* rootLayer, const gfx::S
rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList,
dummyLayerList, 0, maxTextureSize,
- deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentRect);
+ deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentRect,
+ updateTilePriorities);
// The dummy layer list should not have been used.
DCHECK(dummyLayerList.size() == 0);
@@ -1029,7 +1029,7 @@ void LayerTreeHostCommon::calculateDrawProperties(Layer* rootLayer, const gfx::S
DCHECK(rootLayer->renderSurface());
}
-void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, bool canUseLCDText, std::vector<LayerImpl*>& renderSurfaceLayerList)
+void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, bool canUseLCDText, std::vector<LayerImpl*>& renderSurfaceLayerList, bool updateTilePriorities)
{
gfx::Rect totalDrawableContentRect;
gfx::Transform identityMatrix;
@@ -1050,7 +1050,8 @@ void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gf
rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList,
dummyLayerList, &layerSorter, maxTextureSize,
- deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentRect);
+ deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentRect,
+ updateTilePriorities);
// The dummy layer list should not have been used.
DCHECK(dummyLayerList.size() == 0);
« no previous file with comments | « cc/layer_tree_host_common.h ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698