Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #ifndef CC_LAYERS_LAYER_DESERIALIZER_H_ | |
| 6 #define CC_LAYERS_LAYER_DESERIALIZER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "cc/base/cc_export.h" | |
| 10 #include "cc/layers/layer.h" | |
| 11 | |
| 12 namespace cc { | |
| 13 | |
| 14 namespace proto { | |
| 15 class LayerNode; | |
| 16 class LayerUpdate; | |
| 17 } | |
| 18 | |
| 19 // A class to faciliate deserialization of a Layer tree. | |
| 20 class CC_EXPORT LayerDeserializer { | |
| 21 public: | |
| 22 // Recursively iterate over the given LayerNode proto and read the structure | |
| 23 // into a local Layer structure, re-using existing Layers. returns the new | |
| 24 // root Layer after updating the hierarchy (may be the same as | |
| 25 // |existing_root|). | |
| 26 static scoped_refptr<Layer> DeserializeLayerHierarchy( | |
| 27 scoped_refptr<Layer> existing_root, | |
| 28 const proto::LayerNode& root_node); | |
| 29 | |
| 30 private: | |
| 31 LayerDeserializer(); | |
| 32 virtual ~LayerDeserializer(); | |
| 33 | |
| 34 typedef base::hash_map<int, scoped_refptr<Layer>> LayerIdMap; | |
| 35 // Start at |layer| and recursively add |layer| and all its children and | |
| 36 // special layers to |layer_id_map|. | |
| 37 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.
| |
| 38 LayerIdMap* layer_id_map); | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(LayerDeserializer); | |
| 41 }; | |
| 42 | |
| 43 } // namespace cc | |
| 44 | |
| 45 #endif // CC_LAYERS_LAYER_DESERIALIZER_H_ | |
| OLD | NEW |