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

Side by Side Diff: cc/trees/layer_tree_host_unittest_scroll.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, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 case 0: { 691 case 0: {
692 // GESTURE scroll on impl thread. Also tests that the last scrolled 692 // GESTURE scroll on impl thread. Also tests that the last scrolled
693 // layer id is stored even after the scrolling ends. 693 // layer id is stored even after the scrolling ends.
694 gfx::Point scroll_point = 694 gfx::Point scroll_point =
695 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - 695 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
696 gfx::Vector2dF(0.5f, 0.5f)); 696 gfx::Vector2dF(0.5f, 0.5f));
697 InputHandler::ScrollStatus status = impl->ScrollBegin( 697 InputHandler::ScrollStatus status = impl->ScrollBegin(
698 BeginState(scroll_point).get(), InputHandler::TOUCHSCREEN); 698 BeginState(scroll_point).get(), InputHandler::TOUCHSCREEN);
699 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 699 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
700 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get()); 700 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get());
701 LayerImpl* scrolling_layer = impl->CurrentlyScrollingLayer(); 701 auto* scrolling_node = impl->CurrentlyScrollingNode();
702 CHECK(scrolling_layer); 702 CHECK(scrolling_node);
703 impl->ScrollEnd(EndState().get()); 703 impl->ScrollEnd(EndState().get());
704 CHECK(!impl->CurrentlyScrollingLayer()); 704 CHECK(!impl->CurrentlyScrollingNode());
705 EXPECT_EQ(scrolling_layer->id(), 705 EXPECT_EQ(scrolling_node->id,
706 impl->active_tree()->LastScrolledLayerId()); 706 impl->active_tree()->LastScrolledScrollNodeIndex());
707 707
708 // Check the scroll is applied as a delta. 708 // Check the scroll is applied as a delta.
709 EXPECT_VECTOR_EQ(initial_offset_, 709 EXPECT_VECTOR_EQ(initial_offset_,
710 ScrollTreeForLayer(expected_scroll_layer_impl) 710 ScrollTreeForLayer(expected_scroll_layer_impl)
711 ->GetScrollOffsetBaseForTesting( 711 ->GetScrollOffsetBaseForTesting(
712 expected_scroll_layer_impl->id())); 712 expected_scroll_layer_impl->id()));
713 EXPECT_VECTOR_EQ(scroll_amount_, 713 EXPECT_VECTOR_EQ(scroll_amount_,
714 ScrollDelta(expected_scroll_layer_impl)); 714 ScrollDelta(expected_scroll_layer_impl));
715 break; 715 break;
716 } 716 }
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 CompletionEvent* impl_side_invalidation_event_ = nullptr; 2236 CompletionEvent* impl_side_invalidation_event_ = nullptr;
2237 2237
2238 // Main thread. 2238 // Main thread.
2239 int num_of_deltas_ = 0; 2239 int num_of_deltas_ = 0;
2240 }; 2240 };
2241 2241
2242 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplSideInvalidation); 2242 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplSideInvalidation);
2243 2243
2244 } // namespace 2244 } // namespace
2245 } // namespace cc 2245 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698