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

Unified Diff: cc/trees/layer_tree_host_common.h

Issue 1907053004: cc: Make CallFunctionForEveryLayer use LayerListIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FindLayers should skip layers instead of returning when switching from call-function to iteration l… Created 4 years, 8 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_impl.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 8d1b5e75f2edf9884926b81cdd46fbe5abc04bc7..5f2d720b486fe82c43fd85be2c34322d5a951a44 100644
--- a/cc/trees/layer_tree_host_common.h
+++ b/cc/trees/layer_tree_host_common.h
@@ -36,13 +36,6 @@ class Layer;
class SwapPromise;
class PropertyTrees;
-enum CallFunctionLayerType : uint32_t {
- BASIC_LAYER = 0,
- MASK_LAYER = 1,
- REPLICA_LAYER = 2,
- ALL_LAYERS = MASK_LAYER | REPLICA_LAYER
-};
-
class CC_EXPORT LayerTreeHostCommon {
public:
struct CC_EXPORT CalcDrawPropsMainInputsForTesting {
@@ -138,13 +131,11 @@ class CC_EXPORT LayerTreeHostCommon {
template <typename Function>
static void CallFunctionForEveryLayer(LayerTreeHost* layer,
- const Function& function,
- const CallFunctionLayerType& type);
+ const Function& function);
template <typename Function>
static void CallFunctionForEveryLayer(LayerTreeImpl* layer,
- const Function& function,
- const CallFunctionLayerType& type);
+ const Function& function);
struct CC_EXPORT ScrollUpdateInfo {
int layer_id;
@@ -178,51 +169,30 @@ struct CC_EXPORT ScrollAndScaleSet {
};
template <typename LayerType, typename Function>
-static void CallFunctionForLayer(LayerType* layer,
- const Function& function,
- const CallFunctionLayerType& type) {
+static void CallFunctionForLayer(LayerType* layer, const Function& function) {
function(layer);
- LayerType* mask_layer = layer->mask_layer();
- if ((type & CallFunctionLayerType::MASK_LAYER) && mask_layer)
+ if (LayerType* mask_layer = layer->mask_layer())
function(mask_layer);
- LayerType* replica_layer = layer->replica_layer();
- if ((type & CallFunctionLayerType::REPLICA_LAYER) && replica_layer) {
+ if (LayerType* replica_layer = layer->replica_layer()) {
function(replica_layer);
- mask_layer = replica_layer->mask_layer();
- if ((type & CallFunctionLayerType::MASK_LAYER) && mask_layer)
+ if (LayerType* mask_layer = replica_layer->mask_layer())
function(mask_layer);
}
}
template <typename Function>
-static void CallFunctionForEveryLayerInternal(
- Layer* layer,
- const Function& function,
- const CallFunctionLayerType& type) {
- CallFunctionForLayer(layer, function, type);
-
- for (size_t i = 0; i < layer->children().size(); ++i) {
- CallFunctionForEveryLayerInternal(layer->children()[i].get(), function,
- type);
- }
-}
-
-template <typename Function>
-void LayerTreeHostCommon::CallFunctionForEveryLayer(
- LayerTreeHost* host,
- const Function& function,
- const CallFunctionLayerType& type) {
- CallFunctionForEveryLayerInternal(host->root_layer(), function, type);
+void LayerTreeHostCommon::CallFunctionForEveryLayer(LayerTreeHost* host,
+ const Function& function) {
+ for (auto* layer : *host)
+ CallFunctionForLayer(layer, function);
}
template <typename Function>
-void LayerTreeHostCommon::CallFunctionForEveryLayer(
- LayerTreeImpl* host_impl,
- const Function& function,
- const CallFunctionLayerType& type) {
+void LayerTreeHostCommon::CallFunctionForEveryLayer(LayerTreeImpl* host_impl,
+ const Function& function) {
for (auto* layer : *host_impl)
- CallFunctionForLayer(layer, function, type);
+ CallFunctionForLayer(layer, function);
}
CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer);
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698