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