| 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 7088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9230 root->SetDrawsContent(true); | 9231 root->SetDrawsContent(true); |
| 9231 root->test_properties()->force_render_surface = true; | 9232 root->test_properties()->force_render_surface = true; |
| 9232 | 9233 |
| 9233 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); | 9234 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); |
| 9234 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 9235 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| 9235 | 9236 |
| 9236 auto* fake_layer_tree_frame_sink = | 9237 auto* fake_layer_tree_frame_sink = |
| 9237 static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); | 9238 static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); |
| 9238 | 9239 |
| 9239 ui::LatencyInfo latency_info; | 9240 ui::LatencyInfo latency_info; |
| 9241 latency_info.set_trace_id(5); |
| 9240 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 9242 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, |
| 9241 0); | 9243 0); |
| 9242 std::unique_ptr<SwapPromise> swap_promise( | 9244 std::unique_ptr<SwapPromise> swap_promise( |
| 9243 new LatencyInfoSwapPromise(latency_info)); | 9245 new LatencyInfoSwapPromise(latency_info)); |
| 9244 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); | 9246 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); |
| 9245 | 9247 |
| 9246 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); | 9248 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); |
| 9247 TestFrameData frame; | 9249 TestFrameData frame; |
| 9248 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 9250 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 9249 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); | 9251 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); |
| (...skipping 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12662 // layer should be prioritized over the hidden layer. | 12664 // layer should be prioritized over the hidden layer. |
| 12663 hidden_layer->set_contributes_to_drawn_render_surface(false); | 12665 hidden_layer->set_contributes_to_drawn_render_surface(false); |
| 12664 hidden_layer->set_raster_even_if_not_drawn(true); | 12666 hidden_layer->set_raster_even_if_not_drawn(true); |
| 12665 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, | 12667 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, |
| 12666 RasterTilePriorityQueue::Type::ALL); | 12668 RasterTilePriorityQueue::Type::ALL); |
| 12667 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); | 12669 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); |
| 12668 } | 12670 } |
| 12669 | 12671 |
| 12670 } // namespace | 12672 } // namespace |
| 12671 } // namespace cc | 12673 } // namespace cc |
| OLD | NEW |