| 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 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 | 2103 |
| 2104 EXPECT_VECTOR_EQ(gfx::Vector2dF(100, 100), | 2104 EXPECT_VECTOR_EQ(gfx::Vector2dF(100, 100), |
| 2105 outer_scroll_layer->CurrentScrollOffset()); | 2105 outer_scroll_layer->CurrentScrollOffset()); |
| 2106 EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50), | 2106 EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50), |
| 2107 inner_scroll_layer->CurrentScrollOffset()); | 2107 inner_scroll_layer->CurrentScrollOffset()); |
| 2108 } | 2108 } |
| 2109 | 2109 |
| 2110 TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) { | 2110 TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) { |
| 2111 ui::LatencyInfo latency_info; | 2111 ui::LatencyInfo latency_info; |
| 2112 latency_info.set_trace_id(5); | 2112 latency_info.set_trace_id(5); |
| 2113 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 2113 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0); |
| 2114 1234); | 2114 |
| 2115 std::unique_ptr<SwapPromise> swap_promise( | 2115 std::unique_ptr<SwapPromise> swap_promise( |
| 2116 new LatencyInfoSwapPromise(latency_info)); | 2116 new LatencyInfoSwapPromise(latency_info)); |
| 2117 | 2117 |
| 2118 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 2118 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 2119 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 2119 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 2120 host_impl_ | 2120 host_impl_ |
| 2121 ->ScrollBegin(BeginState(gfx::Point()).get(), | 2121 ->ScrollBegin(BeginState(gfx::Point()).get(), |
| 2122 InputHandler::TOUCHSCREEN) | 2122 InputHandler::TOUCHSCREEN) |
| 2123 .thread); | 2123 .thread); |
| 2124 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); | 2124 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); |
| (...skipping 7033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9158 root->test_properties()->force_render_surface = true; | 9158 root->test_properties()->force_render_surface = true; |
| 9159 | 9159 |
| 9160 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); | 9160 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); |
| 9161 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 9161 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| 9162 | 9162 |
| 9163 auto* fake_layer_tree_frame_sink = | 9163 auto* fake_layer_tree_frame_sink = |
| 9164 static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); | 9164 static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); |
| 9165 | 9165 |
| 9166 ui::LatencyInfo latency_info; | 9166 ui::LatencyInfo latency_info; |
| 9167 latency_info.set_trace_id(5); | 9167 latency_info.set_trace_id(5); |
| 9168 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 9168 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0); |
| 9169 0); | |
| 9170 std::unique_ptr<SwapPromise> swap_promise( | 9169 std::unique_ptr<SwapPromise> swap_promise( |
| 9171 new LatencyInfoSwapPromise(latency_info)); | 9170 new LatencyInfoSwapPromise(latency_info)); |
| 9172 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); | 9171 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); |
| 9173 | 9172 |
| 9174 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); | 9173 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); |
| 9175 TestFrameData frame; | 9174 TestFrameData frame; |
| 9176 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 9175 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 9177 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); | 9176 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); |
| 9178 host_impl_->DidDrawAllLayers(frame); | 9177 host_impl_->DidDrawAllLayers(frame); |
| 9179 | 9178 |
| (...skipping 3478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12658 // layer should be prioritized over the hidden layer. | 12657 // layer should be prioritized over the hidden layer. |
| 12659 hidden_layer->set_contributes_to_drawn_render_surface(false); | 12658 hidden_layer->set_contributes_to_drawn_render_surface(false); |
| 12660 hidden_layer->set_raster_even_if_not_drawn(true); | 12659 hidden_layer->set_raster_even_if_not_drawn(true); |
| 12661 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, | 12660 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, |
| 12662 RasterTilePriorityQueue::Type::ALL); | 12661 RasterTilePriorityQueue::Type::ALL); |
| 12663 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); | 12662 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); |
| 12664 } | 12663 } |
| 12665 | 12664 |
| 12666 } // namespace | 12665 } // namespace |
| 12667 } // namespace cc | 12666 } // namespace cc |
| OLD | NEW |