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

Unified Diff: cc/layers/layer.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: Add early return in LayerProtoConverter::RecursivelySerializeLayerProperties 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 | « no previous file | cc/layers/layer.cc » ('j') | cc/layers/layer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.h
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 5c298f5fd0b5fb03334c173bb8b8d54af1eb3c54..0dbd09d2cf958f7659a08b21333f9b43fcbdf95f 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -69,6 +69,8 @@ struct AnimationEvent;
namespace proto {
class LayerNode;
+class LayerProperties;
+class LayerUpdate;
} // namespace proto
// Base class for composited layers. Special layer types are derived from
@@ -387,6 +389,22 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void FromLayerNodeProto(const proto::LayerNode& proto,
const LayerIdMap& layer_map);
+ // This method is similar to PushPropertiesTo, but instead of pushing to
+ // a LayerImpl, it pushes the properties to proto::LayerProperties. It adds
+ // this layer to the proto::LayerUpdate if it or any of its descendants
+ // have changed properties. If this layer contains changed properties, the
+ // properties themselves will also be pushed the proto::LayerProperties.
+ // Similarly to PushPropertiesTo, this method also resets
+ // |needs_push_properties_| and |num_dependents_need_push_properties_|.
+ // Returns whether any of the descendants have changed properties.
+ bool ToLayerPropertiesProto(proto::LayerUpdate* layer_update);
+
+ // Read all property values from the given LayerProperties object and update
+ // the current layer. The values for |needs_push_properties_| and
+ // |num_dependents_need_push_properties_| are always updated, but the rest
+ // of |proto| is only read if |needs_push_properties_| is set.
+ void FromLayerPropertiesProto(const proto::LayerProperties& proto);
+
LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
@@ -589,6 +607,22 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
bool IsPropertyChangeAllowed() const;
+ // Serialize all the necessary properties to be able to reconstruct this Layer
+ // into proto::LayerProperties. This function must not set values for
+ // |needs_push_properties_| or |num_dependents_need_push_properties_| as they
+ // are dealt with at a higher level. This is only called if
+ // |needs_push_properties_| is set. For descendants of Layer, implementations
+ // must first call their parent class.
+ virtual void LayerSpecificPropertiesToProto(proto::LayerProperties* proto);
+
+ // Deserialize all the necessary properties from proto::LayerProperties into
+ // this Layer. This function must not set values for |needs_push_properties_|
+ // or |num_dependents_need_push_properties_| as they are dealt with at a
+ // higher level. This is only called if |needs_push_properties_| is set. For
+ // descendants of Layer, implementations must first call their parent class.
+ virtual void FromLayerSpecificPropertiesProto(
+ const proto::LayerProperties& proto);
+
// This flag is set when the layer needs to push properties to the impl
// side.
bool needs_push_properties_;
« no previous file with comments | « no previous file | cc/layers/layer.cc » ('j') | cc/layers/layer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698