Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: cc/layers/layer_proto_converter.h

Issue 1423523002: Add support for (de)serializing cc::Layer properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@serialize-layer-hierarchy
Patch Set: Addressed comments about raw pointers and new test. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_proto_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_proto_converter.h
diff --git a/cc/layers/layer_proto_converter.h b/cc/layers/layer_proto_converter.h
index 29424a0347f392a2407518f2af57fbcc3bf51440..7f2742b9467b10d14e73d192dade76c483c0fc7a 100644
--- a/cc/layers/layer_proto_converter.h
+++ b/cc/layers/layer_proto_converter.h
@@ -13,6 +13,7 @@ namespace cc {
namespace proto {
class LayerNode;
+class LayerUpdate;
}
// A class to faciliate (de)serialization of a Layer tree to protocol buffers.
@@ -28,9 +29,22 @@ class CC_EXPORT LayerProtoConverter {
// root Layer after updating the hierarchy (may be the same as
// |existing_root|).
static scoped_refptr<Layer> DeserializeLayerHierarchy(
- scoped_refptr<Layer> existing_root,
+ const scoped_refptr<Layer> existing_root,
const proto::LayerNode& root_node);
+ // Starting at |root_layer|, serializes the properties of all the dirty nodes
+ // in the Layer hierarchy. The proto::LayerUpdate will contain all nodes that
+ // either are dirty or have dirty descendants. Only nodes that are dirty will
+ // contain the list of dirty properties.
+ static void SerializeLayerProperties(Layer* root_layer,
+ proto::LayerUpdate* layer_update);
+
+ // Iterate over all updated layers from the LayerUpdate, and update the
+ // local Layers.
+ static void DeserializeLayerProperties(
+ Layer* existing_root,
+ const proto::LayerUpdate& layer_update);
+
// 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().
@@ -42,6 +56,12 @@ class CC_EXPORT LayerProtoConverter {
LayerProtoConverter();
~LayerProtoConverter();
+ // This method is the inner recursive function for SerializeLayerProperties
+ // declared above.
+ static void RecursivelySerializeLayerProperties(
+ Layer* root_layer,
+ proto::LayerUpdate* layer_update);
+
using LayerIdMap = base::hash_map<int, scoped_refptr<Layer>>;
// Start at |layer| and recursively add |layer| and all its children and
// special layers to |layer_id_map|.
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_proto_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698