| 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. These nodes |
| 40 // either are dirty or have dirty descendants. Only nodes that are dirty will | 40 // will contain the list of dirty properties. This function also resets the |
| 41 // contain the list of dirty properties. | 41 // layers that need push properties set. |
| 42 static void SerializeLayerProperties(Layer* root_layer, | 42 static void SerializeLayerProperties(LayerTreeHost* host, |
| 43 proto::LayerUpdate* layer_update); | 43 proto::LayerUpdate* layer_update); |
| 44 | 44 |
| 45 // Iterate over all updated layers from the LayerUpdate, and update the | 45 // 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 | 46 // local Layers. |existing_root| must not be null, as that will make it |
| 47 // impossible to find the layer to apply the properties to. | 47 // impossible to find the layer to apply the properties to. |
| 48 static void DeserializeLayerProperties( | 48 static void DeserializeLayerProperties( |
| 49 Layer* existing_root, | 49 Layer* existing_root, |
| 50 const proto::LayerUpdate& layer_update); | 50 const proto::LayerUpdate& layer_update); |
| 51 | 51 |
| 52 // Returns the Layer with proto.id() as the Layer id, if it exists in | 52 // Returns the Layer with proto.id() as the Layer id, if it exists in |
| (...skipping 18 matching lines...) Expand all Loading... |
| 71 // and special layers to |layer_id_map|. | 71 // and special layers to |layer_id_map|. |
| 72 // TODO(vmpstr): LayerIdMap ref counts layers, so this function needs to deal | 72 // TODO(vmpstr): LayerIdMap ref counts layers, so this function needs to deal |
| 73 // with ref counted objects instead of iterating over raw pointers. | 73 // with ref counted objects instead of iterating over raw pointers. |
| 74 static void RecursivelyFindAllLayers(Layer* root_layer, | 74 static void RecursivelyFindAllLayers(Layer* root_layer, |
| 75 LayerIdMap* layer_id_map); | 75 LayerIdMap* layer_id_map); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace cc | 78 } // namespace cc |
| 79 | 79 |
| 80 #endif // CC_LAYERS_LAYER_PROTO_CONVERTER_H_ | 80 #endif // CC_LAYERS_LAYER_PROTO_CONVERTER_H_ |
| OLD | NEW |