| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 std::vector<std::unique_ptr<SwapPromise>> swap_promises; | 152 std::vector<std::unique_ptr<SwapPromise>> swap_promises; |
| 153 | 153 |
| 154 bool EqualsForTesting(const ScrollAndScaleSet& other) const; | 154 bool EqualsForTesting(const ScrollAndScaleSet& other) const; |
| 155 void ToProtobuf(proto::ScrollAndScaleSet* proto) const; | 155 void ToProtobuf(proto::ScrollAndScaleSet* proto) const; |
| 156 void FromProtobuf(const proto::ScrollAndScaleSet& proto); | 156 void FromProtobuf(const proto::ScrollAndScaleSet& proto); |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 DISALLOW_COPY_AND_ASSIGN(ScrollAndScaleSet); | 159 DISALLOW_COPY_AND_ASSIGN(ScrollAndScaleSet); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 template <typename LayerType, typename Function> | 162 template <typename Function> |
| 163 static void CallFunctionForLayer(LayerType* layer, const Function& function) { | 163 void LayerTreeHostCommon::CallFunctionForEveryLayer(LayerTreeHost* host, |
| 164 function(layer); | 164 const Function& function) { |
| 165 | 165 for (auto* layer : *host) { |
| 166 if (LayerType* mask_layer = layer->mask_layer()) | 166 function(layer); |
| 167 function(mask_layer); | 167 if (Layer* mask_layer = layer->mask_layer()) |
| 168 if (LayerType* replica_layer = layer->replica_layer()) { | |
| 169 function(replica_layer); | |
| 170 if (LayerType* mask_layer = replica_layer->mask_layer()) | |
| 171 function(mask_layer); | 168 function(mask_layer); |
| 169 if (Layer* replica_layer = layer->replica_layer()) { |
| 170 function(replica_layer); |
| 171 if (Layer* mask_layer = replica_layer->mask_layer()) |
| 172 function(mask_layer); |
| 173 } |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 | 176 |
| 175 template <typename Function> | 177 template <typename Function> |
| 176 void LayerTreeHostCommon::CallFunctionForEveryLayer(LayerTreeHost* host, | 178 void LayerTreeHostCommon::CallFunctionForEveryLayer(LayerTreeImpl* tree_impl, |
| 177 const Function& function) { | 179 const Function& function) { |
| 178 for (auto* layer : *host) | 180 for (auto* layer : *tree_impl) |
| 179 CallFunctionForLayer(layer, function); | 181 function(layer); |
| 180 } | |
| 181 | 182 |
| 182 template <typename Function> | 183 for (int id : |
| 183 void LayerTreeHostCommon::CallFunctionForEveryLayer(LayerTreeImpl* host_impl, | 184 tree_impl->property_trees()->effect_tree.mask_replica_layer_ids()) { |
| 184 const Function& function) { | 185 function(tree_impl->LayerById(id)); |
| 185 for (auto* layer : *host_impl) | 186 } |
| 186 CallFunctionForLayer(layer, function); | |
| 187 } | 187 } |
| 188 | 188 |
| 189 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); | 189 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); |
| 190 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); | 190 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); |
| 191 | 191 |
| 192 } // namespace cc | 192 } // namespace cc |
| 193 | 193 |
| 194 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 194 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| OLD | NEW |