Index: cc/layers/layer_deserializer.h |
diff --git a/cc/layers/layer_deserializer.h b/cc/layers/layer_deserializer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c315d26c0acb1791436be1d6aa5514d898ab0629 |
--- /dev/null |
+++ b/cc/layers/layer_deserializer.h |
@@ -0,0 +1,45 @@ |
+// 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_DESERIALIZER_H_ |
+#define CC_LAYERS_LAYER_DESERIALIZER_H_ |
+ |
+#include "base/macros.h" |
+#include "cc/base/cc_export.h" |
+#include "cc/layers/layer.h" |
+ |
+namespace cc { |
+ |
+namespace proto { |
+class LayerNode; |
+class LayerUpdate; |
+} |
+ |
+// A class to faciliate deserialization of a Layer tree. |
+class CC_EXPORT LayerDeserializer { |
+ public: |
+ // Recursively iterate over the given LayerNode proto and read the structure |
+ // into a local Layer structure, re-using existing Layers. returns the new |
+ // root Layer after updating the hierarchy (may be the same as |
+ // |existing_root|). |
+ static scoped_refptr<Layer> DeserializeLayerHierarchy( |
+ scoped_refptr<Layer> existing_root, |
+ const proto::LayerNode& root_node); |
+ |
+ private: |
+ LayerDeserializer(); |
+ virtual ~LayerDeserializer(); |
+ |
+ typedef base::hash_map<int, scoped_refptr<Layer>> LayerIdMap; |
+ // Start at |layer| and recursively add |layer| and all its children and |
+ // special layers to |layer_id_map|. |
+ static void RecursivelyFindAllLayers(const scoped_refptr<Layer> layer, |
vmpstr
2015/10/21 22:34:14
const scoped_refptr<Layer>& layer?
nyquist
2015/10/23 00:12:30
Done.
|
+ LayerIdMap* layer_id_map); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(LayerDeserializer); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_LAYERS_LAYER_DESERIALIZER_H_ |