| OLD | NEW |
| 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/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 void BeginTest() override { | 995 void BeginTest() override { |
| 996 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset( | 996 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset( |
| 997 initial_scroll_); | 997 initial_scroll_); |
| 998 PostSetNeedsCommitToMainThread(); | 998 PostSetNeedsCommitToMainThread(); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 void WillCommit() override { | 1001 void WillCommit() override { |
| 1002 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); | 1002 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); |
| 1003 switch (layer_tree_host()->source_frame_number()) { | 1003 switch (layer_tree_host()->source_frame_number()) { |
| 1004 case 0: | 1004 case 0: |
| 1005 EXPECT_TRUE( | 1005 EXPECT_TRUE(scroll_layer->layer_tree_host() |
| 1006 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 1006 ->GetLayerTree() |
| 1007 scroll_layer)); | 1007 ->LayerNeedsPushPropertiesForTesting(scroll_layer)); |
| 1008 break; | 1008 break; |
| 1009 case 1: | 1009 case 1: |
| 1010 // Even if this layer doesn't need push properties, it should | 1010 // Even if this layer doesn't need push properties, it should |
| 1011 // still pick up scrolls that happen on the active layer during | 1011 // still pick up scrolls that happen on the active layer during |
| 1012 // commit. | 1012 // commit. |
| 1013 EXPECT_FALSE( | 1013 EXPECT_FALSE(scroll_layer->layer_tree_host() |
| 1014 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 1014 ->GetLayerTree() |
| 1015 scroll_layer)); | 1015 ->LayerNeedsPushPropertiesForTesting(scroll_layer)); |
| 1016 break; | 1016 break; |
| 1017 } | 1017 } |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { | 1020 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { |
| 1021 // Scroll after the 2nd commit has started. | 1021 // Scroll after the 2nd commit has started. |
| 1022 if (impl->active_tree()->source_frame_number() == 0) { | 1022 if (impl->active_tree()->source_frame_number() == 0) { |
| 1023 LayerImpl* active_root = impl->active_tree()->root_layer_for_testing(); | 1023 LayerImpl* active_root = impl->active_tree()->root_layer_for_testing(); |
| 1024 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer(); | 1024 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer(); |
| 1025 ASSERT_TRUE(active_root); | 1025 ASSERT_TRUE(active_root); |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 int num_impl_commits_; | 1851 int num_impl_commits_; |
| 1852 int num_aborted_commits_; | 1852 int num_aborted_commits_; |
| 1853 int num_impl_scrolls_; | 1853 int num_impl_scrolls_; |
| 1854 int num_draws_; | 1854 int num_draws_; |
| 1855 }; | 1855 }; |
| 1856 | 1856 |
| 1857 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA); | 1857 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA); |
| 1858 | 1858 |
| 1859 } // namespace | 1859 } // namespace |
| 1860 } // namespace cc | 1860 } // namespace cc |
| OLD | NEW |