| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "cc/layers/layer_proto_converter.h" | 5 #include "cc/layers/layer_proto_converter.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "cc/layers/empty_content_layer_client.h" | 8 #include "cc/layers/empty_content_layer_client.h" |
| 9 #include "cc/layers/heads_up_display_layer.h" | 9 #include "cc/layers/heads_up_display_layer.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 iter->second->FromLayerPropertiesProto(layer_properties); | 76 iter->second->FromLayerPropertiesProto(layer_properties); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 // static | 80 // static |
| 81 void LayerProtoConverter::RecursivelyFindAllLayers(Layer* root_layer, | 81 void LayerProtoConverter::RecursivelyFindAllLayers(Layer* root_layer, |
| 82 LayerIdMap* layer_id_map) { | 82 LayerIdMap* layer_id_map) { |
| 83 LayerTreeHostCommon::CallFunctionForEveryLayer( | 83 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 84 root_layer->layer_tree_host(), | 84 root_layer->layer_tree_host(), |
| 85 [layer_id_map](Layer* layer) { (*layer_id_map)[layer->id()] = layer; }); | 85 [layer_id_map](Layer* layer) { (*layer_id_map)[layer->id()] = layer; }, |
| 86 CallFunctionLayerType::ALL_LAYERS); |
| 86 } | 87 } |
| 87 | 88 |
| 88 // static | 89 // static |
| 89 scoped_refptr<Layer> LayerProtoConverter::FindOrAllocateAndConstruct( | 90 scoped_refptr<Layer> LayerProtoConverter::FindOrAllocateAndConstruct( |
| 90 const proto::LayerNode& proto, | 91 const proto::LayerNode& proto, |
| 91 const Layer::LayerIdMap& layer_id_map) { | 92 const Layer::LayerIdMap& layer_id_map) { |
| 92 DCHECK(proto.has_id()); | 93 DCHECK(proto.has_id()); |
| 93 Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); | 94 Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); |
| 94 if (iter != layer_id_map.end()) | 95 if (iter != layer_id_map.end()) |
| 95 return iter->second; | 96 return iter->second; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 106 case proto::LayerNode::HEADS_UP_DISPLAY_LAYER: | 107 case proto::LayerNode::HEADS_UP_DISPLAY_LAYER: |
| 107 return HeadsUpDisplayLayer::Create(); | 108 return HeadsUpDisplayLayer::Create(); |
| 108 } | 109 } |
| 109 // TODO(nyquist): Add the rest of the necessary LayerTypes. This function | 110 // TODO(nyquist): Add the rest of the necessary LayerTypes. This function |
| 110 // should not return null. | 111 // should not return null. |
| 111 NOTREACHED(); | 112 NOTREACHED(); |
| 112 return nullptr; | 113 return nullptr; |
| 113 } | 114 } |
| 114 | 115 |
| 115 } // namespace cc | 116 } // namespace cc |
| OLD | NEW |