| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 host_impl_->ScrollEnd(EndState().get()); | 2099 host_impl_->ScrollEnd(EndState().get()); |
| 2100 | 2100 |
| 2101 EXPECT_VECTOR_EQ(gfx::Vector2dF(100, 100), | 2101 EXPECT_VECTOR_EQ(gfx::Vector2dF(100, 100), |
| 2102 outer_scroll_layer->CurrentScrollOffset()); | 2102 outer_scroll_layer->CurrentScrollOffset()); |
| 2103 EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50), | 2103 EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50), |
| 2104 inner_scroll_layer->CurrentScrollOffset()); | 2104 inner_scroll_layer->CurrentScrollOffset()); |
| 2105 } | 2105 } |
| 2106 | 2106 |
| 2107 TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) { | 2107 TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) { |
| 2108 ui::LatencyInfo latency_info; | 2108 ui::LatencyInfo latency_info; |
| 2109 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 2109 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0); |
| 2110 1234); | |
| 2111 std::unique_ptr<SwapPromise> swap_promise( | 2110 std::unique_ptr<SwapPromise> swap_promise( |
| 2112 new LatencyInfoSwapPromise(latency_info)); | 2111 new LatencyInfoSwapPromise(latency_info)); |
| 2113 | 2112 |
| 2114 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 2113 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 2115 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 2114 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 2116 host_impl_ | 2115 host_impl_ |
| 2117 ->ScrollBegin(BeginState(gfx::Point()).get(), | 2116 ->ScrollBegin(BeginState(gfx::Point()).get(), |
| 2118 InputHandler::TOUCHSCREEN) | 2117 InputHandler::TOUCHSCREEN) |
| 2119 .thread); | 2118 .thread); |
| 2120 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); | 2119 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); |
| (...skipping 7120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9241 root->test_properties()->force_render_surface = true; | 9240 root->test_properties()->force_render_surface = true; |
| 9242 | 9241 |
| 9243 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); | 9242 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); |
| 9244 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 9243 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| 9245 | 9244 |
| 9246 FakeCompositorFrameSink* fake_compositor_frame_sink = | 9245 FakeCompositorFrameSink* fake_compositor_frame_sink = |
| 9247 static_cast<FakeCompositorFrameSink*>( | 9246 static_cast<FakeCompositorFrameSink*>( |
| 9248 host_impl_->compositor_frame_sink()); | 9247 host_impl_->compositor_frame_sink()); |
| 9249 | 9248 |
| 9250 ui::LatencyInfo latency_info; | 9249 ui::LatencyInfo latency_info; |
| 9251 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 9250 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0); |
| 9252 0); | |
| 9253 std::unique_ptr<SwapPromise> swap_promise( | 9251 std::unique_ptr<SwapPromise> swap_promise( |
| 9254 new LatencyInfoSwapPromise(latency_info)); | 9252 new LatencyInfoSwapPromise(latency_info)); |
| 9255 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); | 9253 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); |
| 9256 | 9254 |
| 9257 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); | 9255 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); |
| 9258 TestFrameData frame; | 9256 TestFrameData frame; |
| 9259 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 9257 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 9260 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); | 9258 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); |
| 9261 host_impl_->DidDrawAllLayers(frame); | 9259 host_impl_->DidDrawAllLayers(frame); |
| 9262 | 9260 |
| (...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12665 // layer should be prioritized over the hidden layer. | 12663 // layer should be prioritized over the hidden layer. |
| 12666 hidden_layer->set_contributes_to_drawn_render_surface(false); | 12664 hidden_layer->set_contributes_to_drawn_render_surface(false); |
| 12667 hidden_layer->set_raster_even_if_not_drawn(true); | 12665 hidden_layer->set_raster_even_if_not_drawn(true); |
| 12668 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, | 12666 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, |
| 12669 RasterTilePriorityQueue::Type::ALL); | 12667 RasterTilePriorityQueue::Type::ALL); |
| 12670 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); | 12668 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); |
| 12671 } | 12669 } |
| 12672 | 12670 |
| 12673 } // namespace | 12671 } // namespace |
| 12674 } // namespace cc | 12672 } // namespace cc |
| OLD | NEW |