| 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 void BeginTest() override { | 942 void BeginTest() override { |
| 943 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset( | 943 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset( |
| 944 initial_scroll_); | 944 initial_scroll_); |
| 945 PostSetNeedsCommitToMainThread(); | 945 PostSetNeedsCommitToMainThread(); |
| 946 } | 946 } |
| 947 | 947 |
| 948 void WillCommit() override { | 948 void WillCommit() override { |
| 949 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); | 949 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); |
| 950 switch (layer_tree_host()->source_frame_number()) { | 950 switch (layer_tree_host()->source_frame_number()) { |
| 951 case 0: | 951 case 0: |
| 952 EXPECT_TRUE(scroll_layer->needs_push_properties()); | 952 EXPECT_TRUE( |
| 953 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 954 scroll_layer)); |
| 953 break; | 955 break; |
| 954 case 1: | 956 case 1: |
| 955 // Even if this layer doesn't need push properties, it should | 957 // Even if this layer doesn't need push properties, it should |
| 956 // still pick up scrolls that happen on the active layer during | 958 // still pick up scrolls that happen on the active layer during |
| 957 // commit. | 959 // commit. |
| 958 EXPECT_FALSE(scroll_layer->needs_push_properties()); | 960 EXPECT_FALSE( |
| 961 scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 962 scroll_layer)); |
| 959 break; | 963 break; |
| 960 } | 964 } |
| 961 } | 965 } |
| 962 | 966 |
| 963 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { | 967 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { |
| 964 // Scroll after the 2nd commit has started. | 968 // Scroll after the 2nd commit has started. |
| 965 if (impl->active_tree()->source_frame_number() == 0) { | 969 if (impl->active_tree()->source_frame_number() == 0) { |
| 966 LayerImpl* active_root = impl->active_tree()->root_layer(); | 970 LayerImpl* active_root = impl->active_tree()->root_layer(); |
| 967 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer(); | 971 LayerImpl* active_scroll_layer = impl->OuterViewportScrollLayer(); |
| 968 ASSERT_TRUE(active_root); | 972 ASSERT_TRUE(active_root); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 RunTest(CompositorMode::THREADED, false); | 1424 RunTest(CompositorMode::THREADED, false); |
| 1421 } | 1425 } |
| 1422 | 1426 |
| 1423 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1427 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
| 1424 scroll_destroy_whole_tree_ = true; | 1428 scroll_destroy_whole_tree_ = true; |
| 1425 RunTest(CompositorMode::THREADED, false); | 1429 RunTest(CompositorMode::THREADED, false); |
| 1426 } | 1430 } |
| 1427 | 1431 |
| 1428 } // namespace | 1432 } // namespace |
| 1429 } // namespace cc | 1433 } // namespace cc |
| OLD | NEW |