| 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 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 host_impl_->ScrollEnd(EndState().get()); | 2122 host_impl_->ScrollEnd(EndState().get()); |
| 2123 | 2123 |
| 2124 EXPECT_VECTOR_EQ(gfx::Vector2dF(100, 100), | 2124 EXPECT_VECTOR_EQ(gfx::Vector2dF(100, 100), |
| 2125 outer_scroll_layer->CurrentScrollOffset()); | 2125 outer_scroll_layer->CurrentScrollOffset()); |
| 2126 EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50), | 2126 EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50), |
| 2127 inner_scroll_layer->CurrentScrollOffset()); | 2127 inner_scroll_layer->CurrentScrollOffset()); |
| 2128 } | 2128 } |
| 2129 | 2129 |
| 2130 TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) { | 2130 TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) { |
| 2131 ui::LatencyInfo latency_info; | 2131 ui::LatencyInfo latency_info; |
| 2132 latency_info.set_trace_id(5); |
| 2132 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 2133 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, |
| 2133 1234); | 2134 1234); |
| 2134 std::unique_ptr<SwapPromise> swap_promise( | 2135 std::unique_ptr<SwapPromise> swap_promise( |
| 2135 new LatencyInfoSwapPromise(latency_info)); | 2136 new LatencyInfoSwapPromise(latency_info)); |
| 2136 | 2137 |
| 2137 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 2138 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 2138 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 2139 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 2139 host_impl_ | 2140 host_impl_ |
| 2140 ->ScrollBegin(BeginState(gfx::Point()).get(), | 2141 ->ScrollBegin(BeginState(gfx::Point()).get(), |
| 2141 InputHandler::TOUCHSCREEN) | 2142 InputHandler::TOUCHSCREEN) |
| (...skipping 7093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9235 root->SetDrawsContent(true); | 9236 root->SetDrawsContent(true); |
| 9236 root->test_properties()->force_render_surface = true; | 9237 root->test_properties()->force_render_surface = true; |
| 9237 | 9238 |
| 9238 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); | 9239 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); |
| 9239 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 9240 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| 9240 | 9241 |
| 9241 auto* fake_layer_tree_frame_sink = | 9242 auto* fake_layer_tree_frame_sink = |
| 9242 static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); | 9243 static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); |
| 9243 | 9244 |
| 9244 ui::LatencyInfo latency_info; | 9245 ui::LatencyInfo latency_info; |
| 9246 latency_info.set_trace_id(5); |
| 9245 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 9247 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, |
| 9246 0); | 9248 0); |
| 9247 std::unique_ptr<SwapPromise> swap_promise( | 9249 std::unique_ptr<SwapPromise> swap_promise( |
| 9248 new LatencyInfoSwapPromise(latency_info)); | 9250 new LatencyInfoSwapPromise(latency_info)); |
| 9249 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); | 9251 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); |
| 9250 | 9252 |
| 9251 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); | 9253 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); |
| 9252 TestFrameData frame; | 9254 TestFrameData frame; |
| 9253 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 9255 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 9254 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); | 9256 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); |
| (...skipping 3423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12678 // layer should be prioritized over the hidden layer. | 12680 // layer should be prioritized over the hidden layer. |
| 12679 hidden_layer->set_contributes_to_drawn_render_surface(false); | 12681 hidden_layer->set_contributes_to_drawn_render_surface(false); |
| 12680 hidden_layer->set_raster_even_if_not_drawn(true); | 12682 hidden_layer->set_raster_even_if_not_drawn(true); |
| 12681 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, | 12683 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, |
| 12682 RasterTilePriorityQueue::Type::ALL); | 12684 RasterTilePriorityQueue::Type::ALL); |
| 12683 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); | 12685 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); |
| 12684 } | 12686 } |
| 12685 | 12687 |
| 12686 } // namespace | 12688 } // namespace |
| 12687 } // namespace cc | 12689 } // namespace cc |
| OLD | NEW |