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

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

Issue 1398443008: Add support for (de)serializing cc::Layer hierarchy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@review-1394353002
Patch Set: Fixed CC_EXPORT Created 5 years, 2 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/layers/layer_proto_factory.h"
6
7 #include "cc/layers/layer.h"
8 #include "cc/proto/layer.pb.h"
9 #include "cc/trees/layer_tree_settings.h"
10
11 namespace cc {
12
13 // static
14 scoped_refptr<Layer> LayerProtoFactory::FindOrAllocateAndConstruct(
15 const proto::LayerNode& proto,
16 const Layer::LayerIdMap& layer_id_map) {
17 if (proto.has_id()) {
vmpstr 2015/10/21 22:34:14 Can you DCHECK that it has id?
nyquist 2015/10/23 00:12:31 Done.
18 Layer::LayerIdMap::const_iterator iter = layer_id_map.find(proto.id());
19 if (iter != layer_id_map.end())
20 return iter->second;
21 }
22 if (!proto.has_type())
vmpstr 2015/10/21 22:34:14 When can this happen? I don't think we handle null
nyquist 2015/10/23 00:12:31 Done.
23 return nullptr;
24 switch (proto.type()) {
25 case proto::Base:
26 return Layer::Create(LayerSettings()).get();
27 default:
28 // TODO(nyquist): Add the rest of the necessary LayerTypes.
29 return nullptr;
30 }
31 }
32
33 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698