Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_LAYERS_LAYER_PROTO_CONVERTER_H_ | 5 #ifndef CC_LAYERS_LAYER_PROTO_CONVERTER_H_ |
| 6 #define CC_LAYERS_LAYER_PROTO_CONVERTER_H_ | 6 #define CC_LAYERS_LAYER_PROTO_CONVERTER_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 // Recursively iterate over the given LayerNode proto and read the structure | 29 // Recursively iterate over the given LayerNode proto and read the structure |
| 30 // into a local Layer structure, re-using existing Layers. returns the new | 30 // into a local Layer structure, re-using existing Layers. returns the new |
| 31 // root Layer after updating the hierarchy (may be the same as | 31 // root Layer after updating the hierarchy (may be the same as |
| 32 // |existing_root|). |existing_root| may be null, which might happen during | 32 // |existing_root|). |existing_root| may be null, which might happen during |
| 33 // the first deserialize. | 33 // the first deserialize. |
| 34 static scoped_refptr<Layer> DeserializeLayerHierarchy( | 34 static scoped_refptr<Layer> DeserializeLayerHierarchy( |
| 35 const scoped_refptr<Layer> existing_root, | 35 const scoped_refptr<Layer> existing_root, |
| 36 const proto::LayerNode& root_node); | 36 const proto::LayerNode& root_node); |
| 37 | 37 |
| 38 // Starting at |root_layer|, serializes the properties of all the dirty nodes | 38 // Serializes the properties of all the dirty nodes in the Layer hierarchy. |
| 39 // in the Layer hierarchy. The proto::LayerUpdate will contain all nodes that | 39 // The proto::LayerUpdate will contain all nodes that are dirty. Only nodes |
| 40 // either are dirty or have dirty descendants. Only nodes that are dirty will | 40 // that are dirty will contain the list of dirty properties. |
|
ajuma
2016/03/18 14:33:15
Since the update only contains dirty nodes now, al
jaydasika
2016/03/19 02:17:58
Done.
| |
| 41 // contain the list of dirty properties. | 41 static void SerializeLayerProperties(LayerTreeHost* host, |
| 42 static void SerializeLayerProperties(Layer* root_layer, | |
| 43 proto::LayerUpdate* layer_update); | 42 proto::LayerUpdate* layer_update); |
| 44 | 43 |
| 45 // Iterate over all updated layers from the LayerUpdate, and update the | 44 // Iterate over all updated layers from the LayerUpdate, and update the |
| 46 // local Layers. |existing_root| must not be null, as that will make it | 45 // local Layers. |existing_root| must not be null, as that will make it |
| 47 // impossible to find the layer to apply the properties to. | 46 // impossible to find the layer to apply the properties to. |
| 48 static void DeserializeLayerProperties( | 47 static void DeserializeLayerProperties( |
| 49 Layer* existing_root, | 48 Layer* existing_root, |
| 50 const proto::LayerUpdate& layer_update); | 49 const proto::LayerUpdate& layer_update); |
| 51 | 50 |
| 52 // Returns the Layer with proto.id() as the Layer id, if it exists in | 51 // Returns the Layer with proto.id() as the Layer id, if it exists in |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 69 using LayerIdMap = std::unordered_map<int, scoped_refptr<Layer>>; | 68 using LayerIdMap = std::unordered_map<int, scoped_refptr<Layer>>; |
| 70 // Start at |layer| and recursively add |layer| and all its children and | 69 // Start at |layer| and recursively add |layer| and all its children and |
| 71 // special layers to |layer_id_map|. | 70 // special layers to |layer_id_map|. |
| 72 static void RecursivelyFindAllLayers(const scoped_refptr<Layer>& layer, | 71 static void RecursivelyFindAllLayers(const scoped_refptr<Layer>& layer, |
| 73 LayerIdMap* layer_id_map); | 72 LayerIdMap* layer_id_map); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace cc | 75 } // namespace cc |
| 77 | 76 |
| 78 #endif // CC_LAYERS_LAYER_PROTO_CONVERTER_H_ | 77 #endif // CC_LAYERS_LAYER_PROTO_CONVERTER_H_ |
| OLD | NEW |