Index: cc/layers/layer.h |
diff --git a/cc/layers/layer.h b/cc/layers/layer.h |
index 2fec36364570707340f3d6bc57fb886b51e901ee..3a6ebf6e1cb843baf5ba6029c518e40931e5dae4 100644 |
--- a/cc/layers/layer.h |
+++ b/cc/layers/layer.h |
@@ -67,6 +67,10 @@ class ScrollbarLayerInterface; |
class SimpleEnclosedRegion; |
struct AnimationEvent; |
+namespace proto { |
+class LayerNode; |
+} // proto |
+ |
// Base class for composited layers. Special layer types are derived from |
// this class. |
class CC_EXPORT Layer : public base::RefCounted<Layer>, |
@@ -74,6 +78,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, |
public LayerAnimationValueProvider { |
public: |
typedef LayerList LayerListType; |
+ typedef base::hash_map<int, scoped_refptr<Layer>> LayerIdMap; |
enum LayerIdLabels { |
INVALID_ID = -1, |
@@ -358,6 +363,18 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, |
virtual void PushPropertiesTo(LayerImpl* layer); |
+ // Recursively iterate over this layer and all children and write the |
+ // hierarchical structure to the given LayerNode proto. In addition to the |
+ // structure itself, the Layer id and type is also written to facilitate |
+ // construction of the correct layer on the client. |
+ virtual void ToLayerNodeProto(proto::LayerNode* proto) const; |
+ // Recursively iterate over the given LayerNode proto and read the structure |
vmpstr
2015/10/23 21:26:10
nit: can you put a blank line before this one?
nyquist
2015/10/26 03:14:29
Done.
|
+ // into this node and its children. The |layer_map| should be used to look |
+ // for previously existing Layers, since they should be re-used between each |
+ // hierarchy update. |
+ virtual void FromLayerNodeProto(const proto::LayerNode& proto, |
+ const LayerIdMap& layer_map); |
+ |
LayerTreeHost* layer_tree_host() { return layer_tree_host_; } |
const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } |