| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 layer_id_map.find(layer_properties.id()); | 73 layer_id_map.find(layer_properties.id()); |
| 74 DCHECK(iter != layer_id_map.end()); | 74 DCHECK(iter != layer_id_map.end()); |
| 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::CallFunctionForSubtree( | 83 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 84 root_layer, | 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 } | 86 } |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 scoped_refptr<Layer> LayerProtoConverter::FindOrAllocateAndConstruct( | 89 scoped_refptr<Layer> LayerProtoConverter::FindOrAllocateAndConstruct( |
| 90 const proto::LayerNode& proto, | 90 const proto::LayerNode& proto, |
| 91 const Layer::LayerIdMap& layer_id_map) { | 91 const Layer::LayerIdMap& layer_id_map) { |
| 92 DCHECK(proto.has_id()); | 92 DCHECK(proto.has_id()); |
| 93 Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); | 93 Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); |
| 94 if (iter != layer_id_map.end()) | 94 if (iter != layer_id_map.end()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 106 case proto::LayerNode::HEADS_UP_DISPLAY_LAYER: | 106 case proto::LayerNode::HEADS_UP_DISPLAY_LAYER: |
| 107 return HeadsUpDisplayLayer::Create(); | 107 return HeadsUpDisplayLayer::Create(); |
| 108 } | 108 } |
| 109 // TODO(nyquist): Add the rest of the necessary LayerTypes. This function | 109 // TODO(nyquist): Add the rest of the necessary LayerTypes. This function |
| 110 // should not return null. | 110 // should not return null. |
| 111 NOTREACHED(); | 111 NOTREACHED(); |
| 112 return nullptr; | 112 return nullptr; |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace cc | 115 } // namespace cc |
| OLD | NEW |