summaryrefslogtreecommitdiffstats
path: root/cc/proto
diff options
context:
space:
mode:
authorsunxd <sunxd@chromium.org>2016-03-03 14:31:10 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-03 22:32:28 +0000
commitc36713a0336c00a0971fe33514adc01f4df693fa (patch)
tree8e9b76bd9b79b76e1418aecaab20960597fe8c33 /cc/proto
parent1f8acc51c0c5d9fea66917884b927eff8f3e570e (diff)
downloadchromium_src-c36713a0336c00a0971fe33514adc01f4df693fa.zip
chromium_src-c36713a0336c00a0971fe33514adc01f4df693fa.tar.gz
chromium_src-c36713a0336c00a0971fe33514adc01f4df693fa.tar.bz2
cc: Move SyncedScrollOffset to scroll tree
Now updating scrolling information on impl side can be independent of layer impl. There are still some left-over changes corresponding to NoteLayerPropertiesChanged. SyncedScrollOffset of scrollable layers are now stored in property trees instead of layer impl. The main thread property tree has one copy while pending and active share one. BUG=568830 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1736073002 Cr-Commit-Position: refs/heads/master@{#379116}
Diffstat (limited to 'cc/proto')
-rw-r--r--cc/proto/BUILD.gn1
-rw-r--r--cc/proto/property_tree.proto11
-rw-r--r--cc/proto/synced_property.proto29
-rw-r--r--cc/proto/synced_property_conversions.cc26
-rw-r--r--cc/proto/synced_property_conversions.h26
-rw-r--r--cc/proto/synced_property_conversions_unittest.cc30
6 files changed, 122 insertions, 1 deletions
diff --git a/cc/proto/BUILD.gn b/cc/proto/BUILD.gn
index f06e869..4387941 100644
--- a/cc/proto/BUILD.gn
+++ b/cc/proto/BUILD.gn
@@ -58,6 +58,7 @@ proto_library("proto_internal") {
"skregion.proto",
"skrrect.proto",
"skxfermode.proto",
+ "synced_property.proto",
"transform.proto",
"vector2d.proto",
"vector2df.proto",
diff --git a/cc/proto/property_tree.proto b/cc/proto/property_tree.proto
index a91824c..d8e8fae 100644
--- a/cc/proto/property_tree.proto
+++ b/cc/proto/property_tree.proto
@@ -7,6 +7,7 @@ syntax = "proto2";
import "rectf.proto";
import "scroll_offset.proto";
import "size.proto";
+import "synced_property.proto";
import "transform.proto";
import "vector2df.proto";
@@ -156,9 +157,15 @@ message PropertyTree {
optional ScrollTreeData scroll_tree_data = 1001;
}
+message ScrollOffsetMapEntry {
+ required int64 layer_id = 1;
+ optional SyncedProperty scroll_offset = 2;
+}
+
// Proto for data members of class ScrollTree
message ScrollTreeData {
optional int64 currently_scrolling_node_id = 1;
+ repeated ScrollOffsetMapEntry layer_id_to_scroll_offset_map = 2;
}
// Proto for data members of class TransformTree.
@@ -174,7 +181,7 @@ message TransformTreeData {
}
// Proto for class PropertyTrees.
-// NEXT ID: 13
+// NEXT ID: 14
message PropertyTrees {
optional PropertyTree transform_tree = 1;
optional PropertyTree effect_tree = 2;
@@ -186,6 +193,8 @@ message PropertyTrees {
optional bool changed = 11;
optional bool full_tree_damaged = 12;
optional int64 sequence_number = 6;
+ optional bool is_main_thread = 13;
+ optional bool is_active = 14;
optional Vector2dF inner_viewport_container_bounds_delta = 8;
optional Vector2dF outer_viewport_container_bounds_delta = 9;
diff --git a/cc/proto/synced_property.proto b/cc/proto/synced_property.proto
new file mode 100644
index 0000000..5b8658f
--- /dev/null
+++ b/cc/proto/synced_property.proto
@@ -0,0 +1,29 @@
+// Copyright 2016 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";
+
+import "scroll_offset.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+package cc.proto;
+
+// Since plumbing SyncedScrollOffset is only used by PropertyTree, and can only
+// travel from main thread to impl thread one way, the From/To protobuf function
+// for SyncedProperty only needs to care the current base, because main thread
+// does not have pending/active tree or scroll offset deltas.
+message ScrollOffsetGroup {
+ optional ScrollOffset pending_base = 1;
+ optional ScrollOffset pending_delta = 2;
+ optional ScrollOffset active_base = 3;
+ optional ScrollOffset active_delta = 4;
+ optional ScrollOffset sent_delta = 5;
+}
+
+message SyncedProperty {
+ optional bool clobber_active_value = 1;
+
+ optional ScrollOffsetGroup scroll_offset_group = 1001;
+}
diff --git a/cc/proto/synced_property_conversions.cc b/cc/proto/synced_property_conversions.cc
new file mode 100644
index 0000000..09c8be2
--- /dev/null
+++ b/cc/proto/synced_property_conversions.cc
@@ -0,0 +1,26 @@
+// Copyright 2016 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.
+
+#include "cc/proto/synced_property_conversions.h"
+
+#include "cc/proto/gfx_conversions.h"
+#include "cc/proto/synced_property.pb.h"
+
+namespace cc {
+
+void SyncedScrollOffsetToProto(const SyncedScrollOffset& synced_scroll_offset,
+ proto::SyncedProperty* proto) {
+ proto::ScrollOffsetGroup* data = proto->mutable_scroll_offset_group();
+ ScrollOffsetToProto(synced_scroll_offset.PendingBase(),
+ data->mutable_pending_base());
+}
+
+void ProtoToSyncedScrollOffset(const proto::SyncedProperty& proto,
+ SyncedScrollOffset* synced_scroll_offset) {
+ const proto::ScrollOffsetGroup& data = proto.scroll_offset_group();
+ synced_scroll_offset->PushFromMainThread(
+ ProtoToScrollOffset(data.pending_base()));
+}
+
+} // namespace cc
diff --git a/cc/proto/synced_property_conversions.h b/cc/proto/synced_property_conversions.h
new file mode 100644
index 0000000..7f3c623
--- /dev/null
+++ b/cc/proto/synced_property_conversions.h
@@ -0,0 +1,26 @@
+// Copyright 2016 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.
+
+#ifndef CC_PROTO_SYNCED_PROPERTY_CONVERSIONS_H_
+#define CC_PROTO_SYNCED_PROPERTY_CONVERSIONS_H_
+
+#include "cc/base/cc_export.h"
+#include "cc/trees/property_tree.h"
+
+namespace cc {
+
+namespace proto {
+class SyncedProperty;
+} // namespace proto
+
+CC_EXPORT void SyncedScrollOffsetToProto(
+ const SyncedScrollOffset& synced_scroll_offset,
+ proto::SyncedProperty* proto);
+CC_EXPORT void ProtoToSyncedScrollOffset(
+ const proto::SyncedProperty& proto,
+ SyncedScrollOffset* synced_scroll_offset);
+
+} // namespace cc
+
+#endif // CC_PROTO_SYNCED_PROPERTY_CONVERSIONS_H_
diff --git a/cc/proto/synced_property_conversions_unittest.cc b/cc/proto/synced_property_conversions_unittest.cc
new file mode 100644
index 0000000..bf2a4fd
--- /dev/null
+++ b/cc/proto/synced_property_conversions_unittest.cc
@@ -0,0 +1,30 @@
+// Copyright 2016 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.
+
+#include "cc/proto/synced_property_conversions.h"
+
+#include "cc/proto/synced_property.pb.h"
+#include "cc/trees/property_tree.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace cc {
+namespace {
+
+TEST(SyncedPropertyConversionTest, SerializeDeserializeSyncedScrollOffset) {
+ scoped_refptr<SyncedScrollOffset> synced_scroll_offset =
+ new SyncedScrollOffset();
+ synced_scroll_offset->PushFromMainThread(gfx::ScrollOffset(1, 2));
+ proto::SyncedProperty proto;
+ scoped_refptr<SyncedScrollOffset> serialized_synced_scroll_offset =
+ new SyncedScrollOffset();
+ SyncedScrollOffsetToProto(*synced_scroll_offset.get(), &proto);
+ ProtoToSyncedScrollOffset(proto, serialized_synced_scroll_offset.get());
+ EXPECT_EQ(synced_scroll_offset.get()->PendingBase(),
+ serialized_synced_scroll_offset.get()->PendingBase());
+ EXPECT_EQ(synced_scroll_offset.get()->PendingBase(),
+ serialized_synced_scroll_offset.get()->PendingBase());
+}
+
+} // namespace
+} // namespace cc