| 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/layer.h" | 9 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/layer_settings.h" | 10 #include "cc/layers/layer_settings.h" |
| 11 #include "cc/layers/picture_layer.h" |
| 10 #include "cc/proto/layer.pb.h" | 12 #include "cc/proto/layer.pb.h" |
| 11 #include "cc/trees/layer_tree_host_common.h" | 13 #include "cc/trees/layer_tree_host_common.h" |
| 12 #include "cc/trees/layer_tree_settings.h" | 14 #include "cc/trees/layer_tree_settings.h" |
| 13 | 15 |
| 14 namespace cc { | 16 namespace cc { |
| 15 | 17 |
| 16 LayerProtoConverter::LayerProtoConverter() {} | 18 LayerProtoConverter::LayerProtoConverter() {} |
| 17 | 19 |
| 18 LayerProtoConverter::~LayerProtoConverter() {} | 20 LayerProtoConverter::~LayerProtoConverter() {} |
| 19 | 21 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // static | 98 // static |
| 97 scoped_refptr<Layer> LayerProtoConverter::FindOrAllocateAndConstruct( | 99 scoped_refptr<Layer> LayerProtoConverter::FindOrAllocateAndConstruct( |
| 98 const proto::LayerNode& proto, | 100 const proto::LayerNode& proto, |
| 99 const Layer::LayerIdMap& layer_id_map) { | 101 const Layer::LayerIdMap& layer_id_map) { |
| 100 DCHECK(proto.has_id()); | 102 DCHECK(proto.has_id()); |
| 101 Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); | 103 Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); |
| 102 if (iter != layer_id_map.end()) | 104 if (iter != layer_id_map.end()) |
| 103 return iter->second; | 105 return iter->second; |
| 104 DCHECK(proto.has_type()); | 106 DCHECK(proto.has_type()); |
| 105 switch (proto.type()) { | 107 switch (proto.type()) { |
| 106 case proto::Base: | 108 // Fall through and build a base layer. This won't have any special layer |
| 109 // properties but still maintains the layer hierarchy if we run into a |
| 110 // layer type we don't support. |
| 111 case proto::UNKNOWN: |
| 112 case proto::LAYER: |
| 107 return Layer::Create(LayerSettings()).get(); | 113 return Layer::Create(LayerSettings()).get(); |
| 114 case proto::PICTURE_LAYER: |
| 115 return PictureLayer::Create(LayerSettings(), |
| 116 EmptyContentLayerClient::GetInstance()); |
| 108 } | 117 } |
| 109 // TODO(nyquist): Add the rest of the necessary LayerTypes. This function | 118 // TODO(nyquist): Add the rest of the necessary LayerTypes. This function |
| 110 // should not return null. | 119 // should not return null. |
| 111 NOTREACHED(); | 120 NOTREACHED(); |
| 112 return nullptr; | 121 return nullptr; |
| 113 } | 122 } |
| 114 | 123 |
| 115 } // namespace cc | 124 } // namespace cc |
| OLD | NEW |