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_ |