Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: cc/layers/layer_proto_converter.cc

Issue 1527863002: Serialize PictureLayer properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and added comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_proto_converter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_proto_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698