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

Unified Diff: cc/trees/layer_tree_host_common.h

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.h
diff --git a/cc/trees/layer_tree_host_common.h b/cc/trees/layer_tree_host_common.h
index 86666176f08abf2a86751567c0b08667e3224620..6c03511c4d880d82c363234c95697584cead8b5b 100644
--- a/cc/trees/layer_tree_host_common.h
+++ b/cc/trees/layer_tree_host_common.h
@@ -125,10 +125,9 @@ class CC_EXPORT LayerTreeHostCommon {
static bool RenderSurfaceContributesToTarget(LayerType*,
int target_surface_layer_id);
- template <typename LayerType>
- static void CallFunctionForSubtree(
- LayerType* root_layer,
- const base::Callback<void(LayerType* layer)>& function);
+ template <typename LayerType, typename Function>
+ static void CallFunctionForSubtree(LayerType* layer,
+ const Function& function);
// Returns a layer with the given id if one exists in the subtree starting
// from the given root layer (including mask and replica layers).
@@ -205,22 +204,21 @@ LayerType* LayerTreeHostCommon::FindLayerInSubtree(LayerType* root_layer,
return NULL;
}
-template <typename LayerType>
-void LayerTreeHostCommon::CallFunctionForSubtree(
- LayerType* root_layer,
- const base::Callback<void(LayerType* layer)>& function) {
- function.Run(root_layer);
-
- if (LayerType* mask_layer = root_layer->mask_layer())
- function.Run(mask_layer);
- if (LayerType* replica_layer = root_layer->replica_layer()) {
- function.Run(replica_layer);
+template <typename LayerType, typename Function>
+void LayerTreeHostCommon::CallFunctionForSubtree(LayerType* layer,
+ const Function& function) {
+ function(layer);
+
+ if (LayerType* mask_layer = layer->mask_layer())
+ function(mask_layer);
+ if (LayerType* replica_layer = layer->replica_layer()) {
+ function(replica_layer);
if (LayerType* mask_layer = replica_layer->mask_layer())
- function.Run(mask_layer);
+ function(mask_layer);
}
- for (size_t i = 0; i < root_layer->children().size(); ++i) {
- CallFunctionForSubtree(get_layer_as_raw_ptr(root_layer->children(), i),
+ for (size_t i = 0; i < layer->children().size(); ++i) {
+ CallFunctionForSubtree(get_layer_as_raw_ptr(layer->children(), i),
function);
}
}
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698