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

Unified Diff: cc/layers/layer_proto_factory.h

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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/layer_proto_factory.h
diff --git a/cc/layers/layer_proto_factory.h b/cc/layers/layer_proto_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..a60737962a250fb507324d75304ec7e7b5c0eac2
--- /dev/null
+++ b/cc/layers/layer_proto_factory.h
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_LAYERS_LAYER_PROTO_FACTORY_H_
+#define CC_LAYERS_LAYER_PROTO_FACTORY_H_
+
+#include "base/macros.h"
+#include "cc/base/cc_export.h"
+#include "cc/layers/layer.h"
+
+namespace cc {
+
+namespace proto {
+class LayerNode;
+}
+
+// A helper class for finding or constructing layers during deserialization.
+class CC_EXPORT LayerProtoFactory {
+ public:
+ // Returns the Layer with proto.id() as the Layer id, if it exists in
+ // |layer_id_map|. Otherwise, a new Layer is constructed of the type given
+ // from proto.type().
+ static scoped_refptr<Layer> FindOrAllocateAndConstruct(
+ const proto::LayerNode& proto,
+ const Layer::LayerIdMap& layer_id_map);
+
+ private:
+ LayerProtoFactory() {}
+ virtual ~LayerProtoFactory() {}
+
+ DISALLOW_COPY_AND_ASSIGN(LayerProtoFactory);
+};
+
+} // namespace cc
+
+#endif // CC_LAYERS_LAYER_PROTO_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698