| 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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 void BeginTest() override { | 917 void BeginTest() override { |
| 918 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset( | 918 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset( |
| 919 initial_scroll_); | 919 initial_scroll_); |
| 920 PostSetNeedsCommitToMainThread(); | 920 PostSetNeedsCommitToMainThread(); |
| 921 } | 921 } |
| 922 | 922 |
| 923 void WillCommit() override { | 923 void WillCommit() override { |
| 924 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); | 924 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); |
| 925 switch (layer_tree_host()->source_frame_number()) { | 925 switch (layer_tree_host()->source_frame_number()) { |
| 926 case 0: | 926 case 0: |
| 927 EXPECT_TRUE(scroll_layer->needs_push_properties()); | 927 EXPECT_TRUE( |
| 928 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 929 scroll_layer)); |
| 928 break; | 930 break; |
| 929 case 1: | 931 case 1: |
| 930 // Even if this layer doesn't need push properties, it should | 932 // Even if this layer doesn't need push properties, it should |
| 931 // still pick up scrolls that happen on the active layer during | 933 // still pick up scrolls that happen on the active layer during |
| 932 // commit. | 934 // commit. |
| 933 EXPECT_FALSE(scroll_layer->needs_push_properties()); | 935 EXPECT_FALSE( |
| 936 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 937 scroll_layer)); |
| 934 break; | 938 break; |
| 935 } | 939 } |
| 936 } | 940 } |
| 937 | 941 |
| 938 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { | 942 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { |
| 939 // Scroll after the 2nd commit has started. | 943 // Scroll after the 2nd commit has started. |
| 940 if (impl->active_tree()->source_frame_number() == 0) { | 944 if (impl->active_tree()->source_frame_number() == 0) { |
| 941 LayerImpl* active_root = impl->active_tree()->root_layer(); | 945 LayerImpl* active_root = impl->active_tree()->root_layer(); |
| 942 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer(); | 946 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer(); |
| 943 ASSERT_TRUE(active_root); | 947 ASSERT_TRUE(active_root); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 RunTest(CompositorMode::THREADED, false); | 1380 RunTest(CompositorMode::THREADED, false); |
| 1377 } | 1381 } |
| 1378 | 1382 |
| 1379 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1383 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
| 1380 scroll_destroy_whole_tree_ = true; | 1384 scroll_destroy_whole_tree_ = true; |
| 1381 RunTest(CompositorMode::THREADED, false); | 1385 RunTest(CompositorMode::THREADED, false); |
| 1382 } | 1386 } |
| 1383 | 1387 |
| 1384 } // namespace | 1388 } // namespace |
| 1385 } // namespace cc | 1389 } // namespace cc |
| OLD | NEW |