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

Unified Diff: cc/layer_tree_host_common.h

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_impl.h ('k') | cc/layer_tree_host_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common.h
diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h
index d91eeccd59cc64b0fdb8bb2bd838684d0f15bd0d..8d8e5d9e64c98eaa2b170935d8e76f8f35375d02 100644
--- a/cc/layer_tree_host_common.h
+++ b/cc/layer_tree_host_common.h
@@ -22,7 +22,7 @@ public:
static gfx::Rect calculateVisibleRect(const gfx::Rect& targetSurfaceRect, const gfx::Rect& layerBoundRect, const gfx::Transform&);
static void calculateDrawProperties(Layer* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, bool canUseLCDText, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList);
- static void calculateDrawProperties(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, bool canUseLCDText, std::vector<LayerImpl*>& renderSurfaceLayerList);
+ static void calculateDrawProperties(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, bool canUseLCDText, std::vector<LayerImpl*>& renderSurfaceLayerList, bool updateTilePriorities);
// Performs hit testing for a given renderSurfaceLayerList.
static LayerImpl* findLayerThatIsHitByPoint(const gfx::PointF& screenSpacePoint, const std::vector<LayerImpl*>& renderSurfaceLayerList);
@@ -33,6 +33,8 @@ public:
template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID);
+ template<class Function, typename LayerType> static void callFunctionForSubtree(LayerType* rootLayer);
+
// Returns a layer with the given id if one exists in the subtree starting
// from the given root layer (including mask and replica layers).
template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId);
@@ -94,6 +96,23 @@ LayerType* LayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int lay
return 0;
}
+template<class Function, typename LayerType>
+void LayerTreeHostCommon::callFunctionForSubtree(LayerType* rootLayer)
+{
+ Function()(rootLayer);
+
+ if (LayerType* maskLayer = rootLayer->maskLayer())
+ Function()(maskLayer);
+ if (LayerType* replicaLayer = rootLayer->replicaLayer()) {
+ Function()(replicaLayer);
+ if (LayerType* maskLayer = replicaLayer->maskLayer())
+ Function()(maskLayer);
+ }
+
+ for (size_t i = 0; i < rootLayer->children().size(); ++i)
+ callFunctionForSubtree<Function>(getChildAsRawPtr(rootLayer->children(), i));
+}
+
} // namespace cc
#endif // CC_LAYER_TREE_HOST_COMMON_H_
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698