summaryrefslogtreecommitdiffstats
path: root/cc/proto
diff options
context:
space:
mode:
authornyquist <nyquist@chromium.org>2015-11-06 14:26:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-06 22:27:56 +0000
commit353b7d5d108750e6af2e254bc7e20ee0043b1d99 (patch)
treec97a1bbb23c9eaf44c7562fc2cab223f397e9798 /cc/proto
parent52e09eacf8deaee1e536f893e8521723a183f7a5 (diff)
downloadchromium_src-353b7d5d108750e6af2e254bc7e20ee0043b1d99.zip
chromium_src-353b7d5d108750e6af2e254bc7e20ee0043b1d99.tar.gz
chromium_src-353b7d5d108750e6af2e254bc7e20ee0043b1d99.tar.bz2
Add support for (de)serializing cc::Layer hierarchy.
This CL adds a protocol buffer for serializing the Layer hierarchy, including the mask and replica layers. This will be used whenever the hierarchy has changed and needs to be sent to the client. Given that the protocol still is in flux, and for good measure, all fields in the protocol buffer are marked as optional, even the currently required fields. When a hierarchy is serialized, the whole hierarchy is serialized from the root node, instead of just the changed subtree. Most of the logic lives in the Layer class, but the possibility to change the root of the hierarchy is extracted out to a LayerProtoConverter. It also has functionality to build up a map of the current tree, which will also be used during property deserialization. The next CL will deal with serializing the properties: https://codereview.chromium.org/1423523002/ BUG=538710 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1398443008 Cr-Commit-Position: refs/heads/master@{#358424}
Diffstat (limited to 'cc/proto')
-rw-r--r--cc/proto/BUILD.gn1
-rw-r--r--cc/proto/layer.proto30
2 files changed, 31 insertions, 0 deletions
diff --git a/cc/proto/BUILD.gn b/cc/proto/BUILD.gn
index dcd4214..31d3cd5 100644
--- a/cc/proto/BUILD.gn
+++ b/cc/proto/BUILD.gn
@@ -30,6 +30,7 @@ proto_library("proto_internal") {
# TODO(dtrainor): Move protos to their correct packages once it's possible
# to include protos from other directories/targets (crbug.com/542423).
"display_item.proto",
+ "layer.proto",
"point.proto",
"pointf.proto",
"rect.proto",
diff --git a/cc/proto/layer.proto b/cc/proto/layer.proto
new file mode 100644
index 0000000..74a243b
--- /dev/null
+++ b/cc/proto/layer.proto
@@ -0,0 +1,30 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+syntax = "proto2";
+
+package cc.proto;
+
+option optimize_for = LITE_RUNTIME;
+
+// Identifies the type of cc:Layer a LayerNode represents. It is used to
+// facilitate reconstruction of a Layer of the correct type on the client.
+enum LayerType {
+ Base = 1;
+
+ // TODO(nyquist): Add the rest of the necessary LayerTypes.
+};
+
+// Hierarchical structure for serializing the Layer tree.
+message LayerNode {
+ // required
+ optional int32 id = 1;
+ // required
+ optional LayerType type = 2;
+ optional int32 parent_id = 3;
+ // A List of all the children of the current LayerNode.
+ repeated LayerNode children = 4;
+ optional LayerNode mask_layer = 5;
+ optional LayerNode replica_layer = 6;
+}