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_ |