| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 90   Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); | 90   Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id()); | 
| 91   if (iter != layer_id_map.end()) | 91   if (iter != layer_id_map.end()) | 
| 92     return iter->second; | 92     return iter->second; | 
| 93   DCHECK(proto.has_type()); | 93   DCHECK(proto.has_type()); | 
| 94   switch (proto.type()) { | 94   switch (proto.type()) { | 
| 95     // Fall through and build a base layer.  This won't have any special layer | 95     // Fall through and build a base layer.  This won't have any special layer | 
| 96     // properties but still maintains the layer hierarchy if we run into a | 96     // properties but still maintains the layer hierarchy if we run into a | 
| 97     // layer type we don't support. | 97     // layer type we don't support. | 
| 98     case proto::LayerNode::UNKNOWN: | 98     case proto::LayerNode::UNKNOWN: | 
| 99     case proto::LayerNode::LAYER: | 99     case proto::LayerNode::LAYER: | 
|  | 100     case proto::LayerNode::PUSH_PROPERTIES_COUNTING_LAYER: | 
| 100       return Layer::Create().get(); | 101       return Layer::Create().get(); | 
| 101     case proto::LayerNode::PICTURE_LAYER: | 102     case proto::LayerNode::PICTURE_LAYER: | 
| 102     case proto::LayerNode::FAKE_PICTURE_LAYER: | 103     case proto::LayerNode::FAKE_PICTURE_LAYER: | 
| 103       return PictureLayer::Create(EmptyContentLayerClient::GetInstance()); | 104       return PictureLayer::Create(EmptyContentLayerClient::GetInstance()); | 
| 104     case proto::LayerNode::HEADS_UP_DISPLAY_LAYER: | 105     case proto::LayerNode::HEADS_UP_DISPLAY_LAYER: | 
| 105       return HeadsUpDisplayLayer::Create(); | 106       return HeadsUpDisplayLayer::Create(); | 
| 106     case proto::LayerNode::SOLID_COLOR_SCROLLBAR_LAYER: | 107     case proto::LayerNode::SOLID_COLOR_SCROLLBAR_LAYER: | 
| 107       // Create and return a SolidColorScrollbarLayer with invalid properties | 108       // Create and return a SolidColorScrollbarLayer with invalid properties | 
| 108       // (orientation, thumb thickness, starting track, left_side_scroll, layer | 109       // (orientation, thumb thickness, starting track, left_side_scroll, layer | 
| 109       // id etc.). | 110       // id etc.). | 
| 110       // These properties will be set correctly in the later step when we run | 111       // These properties will be set correctly in the later step when we run | 
| 111       // through LayerTreeHost and deserialize them for each layer. | 112       // through LayerTreeHost and deserialize them for each layer. | 
| 112       return SolidColorScrollbarLayer::Create(ScrollbarOrientation::HORIZONTAL, | 113       return SolidColorScrollbarLayer::Create(ScrollbarOrientation::HORIZONTAL, | 
| 113                                               -1, -1, false, Layer::INVALID_ID); | 114                                               -1, -1, false, Layer::INVALID_ID); | 
| 114   } | 115   } | 
| 115   // TODO(nyquist): Add the rest of the necessary LayerTypes. This function | 116   // TODO(nyquist): Add the rest of the necessary LayerTypes. This function | 
| 116   // should not return null. | 117   // should not return null. | 
| 117   NOTREACHED(); | 118   NOTREACHED(); | 
| 118   return nullptr; | 119   return nullptr; | 
| 119 } | 120 } | 
| 120 | 121 | 
| 121 }  // namespace cc | 122 }  // namespace cc | 
| OLD | NEW | 
|---|