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

Unified Diff: cc/trees/tree_synchronizer_unittest.cc

Issue 2720183003: Track the currently scrolling ScrollNode instead of the scrolling layer (Closed)
Patch Set: Ali did forsee a use-after-free with no stable id Created 3 years, 10 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
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/tree_synchronizer_unittest.cc
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc
index b51d8eade7d8cf0f843b101c78dbe844eb23c301..11b68ad4e779225e128e47beb7d600d494e0b1fe 100644
--- a/cc/trees/tree_synchronizer_unittest.cc
+++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -25,6 +25,7 @@
#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/effect_node.h"
#include "cc/trees/layer_tree_host_common.h"
+#include "cc/trees/scroll_node.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/task_runner_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -504,8 +505,10 @@ TEST_F(TreeSynchronizerTest, SynchronizeCurrentlyScrollingNode) {
host_impl->active_tree()->root_layer_for_testing(),
host_impl->active_tree());
- host_impl->active_tree()->SetCurrentlyScrollingLayer(
- host_impl->active_tree()->LayerById(scroll_layer->id()));
+ ScrollNode* scroll_node =
+ host_impl->active_tree()->property_trees()->scroll_tree.Node(
+ scroll_layer->scroll_tree_index());
+ host_impl->active_tree()->SetCurrentlyScrollingNode(scroll_node);
transient_scroll_layer->SetScrollClipLayerId(Layer::INVALID_ID);
host_->BuildPropertyTreesForTesting();
@@ -513,8 +516,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeCurrentlyScrollingNode) {
host_->CommitAndCreatePendingTree();
host_impl->ActivateSyncTree();
- EXPECT_EQ(scroll_layer->id(),
- host_impl->active_tree()->CurrentlyScrollingLayer()->id());
+ EXPECT_EQ(scroll_layer->scroll_tree_index(),
+ host_impl->active_tree()->CurrentlyScrollingNode()->id);
}
TEST_F(TreeSynchronizerTest, SynchronizeScrollTreeScrollOffsetMap) {
@@ -597,7 +600,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollTreeScrollOffsetMap) {
// More update to ScrollOffset active delta: gfx::ScrollOffset(20, 20)
scroll_tree.SetScrollOffset(scroll_layer_impl->id(),
gfx::ScrollOffset(40, 50));
- host_impl->active_tree()->SetCurrentlyScrollingLayer(scroll_layer_impl);
+ host_impl->active_tree()->SetCurrentlyScrollingNode(
+ scroll_tree.Node(scroll_layer_impl->scroll_tree_index()));
// Make one layer unscrollable so that scroll tree topology changes
transient_scroll_layer->SetScrollClipLayerId(Layer::INVALID_ID);
@@ -607,8 +611,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollTreeScrollOffsetMap) {
host_->CommitAndCreatePendingTree();
host_impl->ActivateSyncTree();
- EXPECT_EQ(scroll_layer->id(),
- host_impl->active_tree()->CurrentlyScrollingLayer()->id());
+ EXPECT_EQ(scroll_layer->scroll_tree_index(),
+ host_impl->active_tree()->CurrentlyScrollingNode()->id);
scroll_layer_offset->SetCurrent(gfx::ScrollOffset(20, 30));
scroll_layer_offset->PullDeltaForMainThread();
scroll_layer_offset->SetCurrent(gfx::ScrollOffset(40, 50));
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698