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

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 framework for base Layer class properties 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_unittest.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..e6e1f8b52391779e5b662d3734d29fa59a8720f2 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,20 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void FromLayerNodeProto(const proto::LayerNode& proto,
const LayerIdMap& layer_map);
+ // Recursively iterate over this layer and all children to find layers with
+ // changed properties. Layers that have changed properties and layers that
+ // contain children that have changed properties are added to the
+ // proto::LayerUpdate. Only layers with changed properties will contain
+ // properties in the resulting proto::LayerProperties proto. This method also
+ // resets |needs_push_properties_| and |num_dependents_need_push_properties_|.
+ void 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 +605,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);
+
+ // Deerialize all the necessary properties from proto::LayerProperties into
David Trainor- moved to gerrit 2015/11/11 15:34:22 Deerialize -> Deserialize
nyquist 2015/11/11 18:31:57 Done.
+ // 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_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698