Chromium Code Reviews| Index: cc/layers/layer_proto_converter.cc |
| diff --git a/cc/layers/layer_proto_converter.cc b/cc/layers/layer_proto_converter.cc |
| index 2dcc3d90a441209006cffd8f9fc55a3fc6bd4610..8cc48bb6c102057aea135d5a1a76f3b6c089a14b 100644 |
| --- a/cc/layers/layer_proto_converter.cc |
| +++ b/cc/layers/layer_proto_converter.cc |
| @@ -42,6 +42,31 @@ scoped_refptr<Layer> LayerProtoConverter::DeserializeLayerHierarchy( |
| } |
| // static |
| +void LayerProtoConverter::SerializeLayerProperties( |
|
vmpstr
2015/11/17 21:05:44
I think these should be more symmetrical wrt to ch
nyquist
2015/11/18 00:24:34
Done.
|
| + const scoped_refptr<Layer> root_layer, |
| + proto::LayerUpdate* layer_update) { |
| + root_layer->ToLayerPropertiesProto(layer_update); |
| +} |
| + |
| +// static |
| +void LayerProtoConverter::DeserializeLayerProperties( |
| + scoped_refptr<Layer> existing_root, |
| + const proto::LayerUpdate& layer_update) { |
| + LayerIdMap layer_id_map; |
| + RecursivelyFindAllLayers(existing_root, &layer_id_map); |
| + |
| + for (int i = 0; i < layer_update.layers_size(); ++i) { |
| + const proto::LayerProperties& layer_properties = layer_update.layers(i); |
| + |
| + Layer::LayerIdMap::const_iterator iter = |
| + layer_id_map.find(layer_properties.id()); |
| + DCHECK(iter != layer_id_map.end()); |
| + |
| + iter->second->FromLayerPropertiesProto(layer_properties); |
| + } |
| +} |
| + |
| +// static |
| void LayerProtoConverter::RecursivelyFindAllLayers( |
| const scoped_refptr<Layer>& layer, |
| LayerIdMap* layer_id_map) { |