Index: cc/layers/layer.h |
diff --git a/cc/layers/layer.h b/cc/layers/layer.h |
index 2fec36364570707340f3d6bc57fb886b51e901ee..3a116006fe6c5f3b7d51e72b43f2434dbbbcf60c 100644 |
--- a/cc/layers/layer.h |
+++ b/cc/layers/layer.h |
@@ -25,6 +25,7 @@ |
#include "cc/layers/paint_properties.h" |
#include "cc/layers/scroll_blocks_on.h" |
#include "cc/output/filter_operations.h" |
+#include "cc/proto/layer.pb.h" |
#include "cc/trees/property_tree.h" |
#include "skia/ext/refptr.h" |
#include "third_party/skia/include/core/SkColor.h" |
@@ -74,6 +75,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 +360,23 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, |
virtual void PushPropertiesTo(LayerImpl* layer); |
+ // Return the proto::LayerType that should be used for serialization of the |
+ // current layer. |
+ virtual proto::LayerType GetTypeForProtoSerialization() const; |
Wez
2015/10/27 03:07:06
IIUC this was previously implicit in the behaviour
nyquist
2015/10/28 16:03:44
Yeah, it could have been done like that. However,
|
+ |
+ // 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. |
+ void ToLayerNodeProto(proto::LayerNode* proto) const; |
Wez
2015/10/27 03:07:06
Is it necessary for these to live on the actual La
nyquist
2015/10/28 16:03:44
AFAIK there is no way to set the Layer id outside
vmpstr
2015/10/28 18:20:49
Yeah, my suggestions only really apply if this is
Wez
2015/10/28 23:59:23
It's not clear that we want to be setting the Laye
|
+ |
+ // Recursively iterate over the given LayerNode proto and read the structure |
+ // 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. |
+ 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_; } |