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

Unified Diff: cc/layers/layer.h

Issue 1398443008: Add support for (de)serializing cc::Layer hierarchy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@review-1394353002
Patch Set: Addressed comments from vmpstr Created 5 years, 2 months 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/cc.gyp ('k') | cc/layers/layer.cc » ('j') | no next file with comments »
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 2fec36364570707340f3d6bc57fb886b51e901ee..ebbfa66e370ca152778d8ef62bf6c7831f9fd743 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;
+
+ // 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;
vmpstr 2015/10/26 17:51:45 I meant like // comment // comment void function
nyquist 2015/10/26 19:01:53 Wow... I don't even... Sorry... :-/
+ // 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.
+ virtual void FromLayerNodeProto(const proto::LayerNode& proto,
vmpstr 2015/10/26 17:51:45 Can this also be non virtual?
nyquist 2015/10/26 19:01:53 Doh... Yeah! Done.
+ const LayerIdMap& layer_map);
+
LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
« no previous file with comments | « cc/cc.gyp ('k') | cc/layers/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698