Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: android-vulkan Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 #include "cc/output/gl_renderer.h" 41 #include "cc/output/gl_renderer.h"
42 #include "cc/output/latency_info_swap_promise.h" 42 #include "cc/output/latency_info_swap_promise.h"
43 #include "cc/quads/render_pass_draw_quad.h" 43 #include "cc/quads/render_pass_draw_quad.h"
44 #include "cc/quads/solid_color_draw_quad.h" 44 #include "cc/quads/solid_color_draw_quad.h"
45 #include "cc/quads/texture_draw_quad.h" 45 #include "cc/quads/texture_draw_quad.h"
46 #include "cc/quads/tile_draw_quad.h" 46 #include "cc/quads/tile_draw_quad.h"
47 #include "cc/resources/ui_resource_bitmap.h" 47 #include "cc/resources/ui_resource_bitmap.h"
48 #include "cc/resources/ui_resource_manager.h" 48 #include "cc/resources/ui_resource_manager.h"
49 #include "cc/test/animation_test_common.h" 49 #include "cc/test/animation_test_common.h"
50 #include "cc/test/begin_frame_args_test.h" 50 #include "cc/test/begin_frame_args_test.h"
51 #include "cc/test/fake_compositor_frame_sink.h"
51 #include "cc/test/fake_layer_tree_host_impl.h" 52 #include "cc/test/fake_layer_tree_host_impl.h"
52 #include "cc/test/fake_mask_layer_impl.h" 53 #include "cc/test/fake_mask_layer_impl.h"
53 #include "cc/test/fake_output_surface.h" 54 #include "cc/test/fake_output_surface.h"
54 #include "cc/test/fake_output_surface_client.h"
55 #include "cc/test/fake_picture_layer_impl.h" 55 #include "cc/test/fake_picture_layer_impl.h"
56 #include "cc/test/fake_raster_source.h" 56 #include "cc/test/fake_raster_source.h"
57 #include "cc/test/fake_video_frame_provider.h" 57 #include "cc/test/fake_video_frame_provider.h"
58 #include "cc/test/geometry_test_utils.h" 58 #include "cc/test/geometry_test_utils.h"
59 #include "cc/test/gpu_rasterization_enabled_settings.h" 59 #include "cc/test/gpu_rasterization_enabled_settings.h"
60 #include "cc/test/layer_test_common.h" 60 #include "cc/test/layer_test_common.h"
61 #include "cc/test/layer_tree_test.h" 61 #include "cc/test/layer_tree_test.h"
62 #include "cc/test/test_delegating_output_surface.h" 62 #include "cc/test/test_compositor_frame_sink.h"
63 #include "cc/test/test_gpu_memory_buffer_manager.h" 63 #include "cc/test/test_gpu_memory_buffer_manager.h"
64 #include "cc/test/test_shared_bitmap_manager.h" 64 #include "cc/test/test_shared_bitmap_manager.h"
65 #include "cc/test/test_task_graph_runner.h" 65 #include "cc/test/test_task_graph_runner.h"
66 #include "cc/test/test_web_graphics_context_3d.h" 66 #include "cc/test/test_web_graphics_context_3d.h"
67 #include "cc/trees/effect_node.h" 67 #include "cc/trees/effect_node.h"
68 #include "cc/trees/layer_tree_host_common.h" 68 #include "cc/trees/layer_tree_host_common.h"
69 #include "cc/trees/layer_tree_impl.h" 69 #include "cc/trees/layer_tree_impl.h"
70 #include "cc/trees/single_thread_proxy.h" 70 #include "cc/trees/single_thread_proxy.h"
71 #include "cc/trees/transform_node.h" 71 #include "cc/trees/transform_node.h"
72 #include "media/base/media.h" 72 #include "media/base/media.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 settings.renderer_settings.texture_id_allocation_chunk_size = 1; 116 settings.renderer_settings.texture_id_allocation_chunk_size = 1;
117 settings.gpu_rasterization_enabled = true; 117 settings.gpu_rasterization_enabled = true;
118 settings.verify_clip_tree_calculations = true; 118 settings.verify_clip_tree_calculations = true;
119 settings.verify_transform_tree_calculations = true; 119 settings.verify_transform_tree_calculations = true;
120 settings.renderer_settings.buffer_to_texture_target_map = 120 settings.renderer_settings.buffer_to_texture_target_map =
121 DefaultBufferToTextureTargetMapForTesting(); 121 DefaultBufferToTextureTargetMapForTesting();
122 return settings; 122 return settings;
123 } 123 }
124 124
125 void SetUp() override { 125 void SetUp() override {
126 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); 126 CreateHostImpl(DefaultSettings(), CreateCompositorFrameSink());
127 } 127 }
128 128
129 void TearDown() override { 129 void TearDown() override {
130 if (host_impl_) 130 if (host_impl_)
131 host_impl_->ReleaseOutputSurface(); 131 host_impl_->ReleaseCompositorFrameSink();
132 } 132 }
133 133
134 void DidLoseOutputSurfaceOnImplThread() override {} 134 void DidLoseCompositorFrameSinkOnImplThread() override {}
135 void SetBeginFrameSource(BeginFrameSource* source) override {} 135 void SetBeginFrameSource(BeginFrameSource* source) override {}
136 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override {} 136 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override {}
137 void DidSwapBuffersCompleteOnImplThread() override {} 137 void DidSwapBuffersCompleteOnImplThread() override {}
138 void OnCanDrawStateChanged(bool can_draw) override { 138 void OnCanDrawStateChanged(bool can_draw) override {
139 on_can_draw_state_changed_called_ = true; 139 on_can_draw_state_changed_called_ = true;
140 } 140 }
141 void NotifyReadyToActivate() override { 141 void NotifyReadyToActivate() override {
142 did_notify_ready_to_activate_ = true; 142 did_notify_ready_to_activate_ = true;
143 host_impl_->ActivateSyncTree(); 143 host_impl_->ActivateSyncTree();
144 } 144 }
(...skipping 18 matching lines...) Expand all
163 base::TimeDelta delay) override { 163 base::TimeDelta delay) override {
164 animation_task_ = task; 164 animation_task_ = task;
165 requested_animation_delay_ = delay; 165 requested_animation_delay_ = delay;
166 } 166 }
167 void DidActivateSyncTree() override {} 167 void DidActivateSyncTree() override {}
168 void WillPrepareTiles() override {} 168 void WillPrepareTiles() override {}
169 void DidPrepareTiles() override {} 169 void DidPrepareTiles() override {}
170 void DidCompletePageScaleAnimationOnImplThread() override { 170 void DidCompletePageScaleAnimationOnImplThread() override {
171 did_complete_page_scale_animation_ = true; 171 did_complete_page_scale_animation_ = true;
172 } 172 }
173 void OnDrawForOutputSurface(bool resourceless_software_draw) override { 173 void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override {
174 std::unique_ptr<LayerTreeHostImpl::FrameData> frame( 174 std::unique_ptr<LayerTreeHostImpl::FrameData> frame(
175 new LayerTreeHostImpl::FrameData); 175 new LayerTreeHostImpl::FrameData);
176 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(frame.get())); 176 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(frame.get()));
177 last_on_draw_render_passes_.clear(); 177 last_on_draw_render_passes_.clear();
178 RenderPass::CopyAll(frame->render_passes, &last_on_draw_render_passes_); 178 RenderPass::CopyAll(frame->render_passes, &last_on_draw_render_passes_);
179 host_impl_->DrawLayers(frame.get()); 179 host_impl_->DrawLayers(frame.get());
180 host_impl_->DidDrawAllLayers(*frame); 180 host_impl_->DidDrawAllLayers(*frame);
181 last_on_draw_frame_ = std::move(frame); 181 last_on_draw_frame_ = std::move(frame);
182 } 182 }
183 183
184 void set_reduce_memory_result(bool reduce_memory_result) { 184 void set_reduce_memory_result(bool reduce_memory_result) {
185 reduce_memory_result_ = reduce_memory_result; 185 reduce_memory_result_ = reduce_memory_result;
186 } 186 }
187 187
188 virtual bool CreateHostImpl(const LayerTreeSettings& settings, 188 virtual bool CreateHostImpl(
189 std::unique_ptr<OutputSurface> output_surface) { 189 const LayerTreeSettings& settings,
190 std::unique_ptr<CompositorFrameSink> compositor_frame_sink) {
190 return CreateHostImplWithTaskRunnerProvider( 191 return CreateHostImplWithTaskRunnerProvider(
191 settings, std::move(output_surface), &task_runner_provider_); 192 settings, std::move(compositor_frame_sink), &task_runner_provider_);
192 } 193 }
193 194
194 virtual bool CreateHostImplWithTaskRunnerProvider( 195 virtual bool CreateHostImplWithTaskRunnerProvider(
195 const LayerTreeSettings& settings, 196 const LayerTreeSettings& settings,
196 std::unique_ptr<OutputSurface> output_surface, 197 std::unique_ptr<CompositorFrameSink> compositor_frame_sink,
197 TaskRunnerProvider* task_runner_provider) { 198 TaskRunnerProvider* task_runner_provider) {
198 if (host_impl_) 199 if (host_impl_)
199 host_impl_->ReleaseOutputSurface(); 200 host_impl_->ReleaseCompositorFrameSink();
200 host_impl_ = LayerTreeHostImpl::Create( 201 host_impl_ = LayerTreeHostImpl::Create(
201 settings, this, task_runner_provider, &stats_instrumentation_, 202 settings, this, task_runner_provider, &stats_instrumentation_,
202 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, 203 &shared_bitmap_manager_, &gpu_memory_buffer_manager_,
203 &task_graph_runner_, 204 &task_graph_runner_,
204 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0); 205 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0);
205 output_surface_ = std::move(output_surface); 206 compositor_frame_sink_ = std::move(compositor_frame_sink);
206 host_impl_->SetVisible(true); 207 host_impl_->SetVisible(true);
207 bool init = host_impl_->InitializeRenderer(output_surface_.get()); 208 bool init = host_impl_->InitializeRenderer(compositor_frame_sink_.get());
208 host_impl_->SetViewportSize(gfx::Size(10, 10)); 209 host_impl_->SetViewportSize(gfx::Size(10, 10));
209 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 210 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
210 // Set the BeginFrameArgs so that methods which use it are able to. 211 // Set the BeginFrameArgs so that methods which use it are able to.
211 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting( 212 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting(
212 BEGINFRAME_FROM_HERE, 213 BEGINFRAME_FROM_HERE,
213 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1))); 214 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1)));
214 host_impl_->DidFinishImplFrame(); 215 host_impl_->DidFinishImplFrame();
215 216
216 timeline_ = 217 timeline_ =
217 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 218 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 void pinch_zoom_pan_viewport_test(float device_scale_factor); 463 void pinch_zoom_pan_viewport_test(float device_scale_factor);
463 void pinch_zoom_pan_viewport_and_scroll_test(float device_scale_factor); 464 void pinch_zoom_pan_viewport_and_scroll_test(float device_scale_factor);
464 void pinch_zoom_pan_viewport_and_scroll_boundary_test( 465 void pinch_zoom_pan_viewport_and_scroll_boundary_test(
465 float device_scale_factor); 466 float device_scale_factor);
466 467
467 void SetupMouseMoveAtWithDeviceScale(float device_scale_factor); 468 void SetupMouseMoveAtWithDeviceScale(float device_scale_factor);
468 469
469 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } 470 scoped_refptr<AnimationTimeline> timeline() { return timeline_; }
470 471
471 protected: 472 protected:
472 virtual std::unique_ptr<OutputSurface> CreateOutputSurface() { 473 virtual std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() {
473 return FakeOutputSurface::CreateDelegating3d(); 474 return FakeCompositorFrameSink::Create3d();
474 } 475 }
475 476
476 void DrawOneFrame() { 477 void DrawOneFrame() {
477 LayerTreeHostImpl::FrameData frame_data; 478 LayerTreeHostImpl::FrameData frame_data;
478 host_impl_->PrepareToDraw(&frame_data); 479 host_impl_->PrepareToDraw(&frame_data);
479 host_impl_->DidDrawAllLayers(frame_data); 480 host_impl_->DidDrawAllLayers(frame_data);
480 } 481 }
481 482
482 static void SetScrollOffsetDelta(LayerImpl* layer_impl, 483 static void SetScrollOffsetDelta(LayerImpl* layer_impl,
483 const gfx::Vector2dF& delta) { 484 const gfx::Vector2dF& delta) {
(...skipping 13 matching lines...) Expand all
497 host_impl_->UpdateAnimationState(true); 498 host_impl_->UpdateAnimationState(true);
498 host_impl_->DidFinishImplFrame(); 499 host_impl_->DidFinishImplFrame();
499 } 500 }
500 501
501 FakeImplTaskRunnerProvider task_runner_provider_; 502 FakeImplTaskRunnerProvider task_runner_provider_;
502 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; 503 DebugScopedSetMainThreadBlocked always_main_thread_blocked_;
503 504
504 TestSharedBitmapManager shared_bitmap_manager_; 505 TestSharedBitmapManager shared_bitmap_manager_;
505 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; 506 TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
506 TestTaskGraphRunner task_graph_runner_; 507 TestTaskGraphRunner task_graph_runner_;
507 std::unique_ptr<OutputSurface> output_surface_; 508 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_;
508 std::unique_ptr<LayerTreeHostImpl> host_impl_; 509 std::unique_ptr<LayerTreeHostImpl> host_impl_;
509 FakeRenderingStatsInstrumentation stats_instrumentation_; 510 FakeRenderingStatsInstrumentation stats_instrumentation_;
510 bool on_can_draw_state_changed_called_; 511 bool on_can_draw_state_changed_called_;
511 bool did_notify_ready_to_activate_; 512 bool did_notify_ready_to_activate_;
512 bool did_request_commit_; 513 bool did_request_commit_;
513 bool did_request_redraw_; 514 bool did_request_redraw_;
514 bool did_request_next_frame_; 515 bool did_request_next_frame_;
515 bool did_request_prepare_tiles_; 516 bool did_request_prepare_tiles_;
516 bool did_complete_page_scale_animation_; 517 bool did_complete_page_scale_animation_;
517 bool reduce_memory_result_; 518 bool reduce_memory_result_;
518 base::Closure animation_task_; 519 base::Closure animation_task_;
519 base::TimeDelta requested_animation_delay_; 520 base::TimeDelta requested_animation_delay_;
520 std::unique_ptr<LayerTreeHostImpl::FrameData> last_on_draw_frame_; 521 std::unique_ptr<LayerTreeHostImpl::FrameData> last_on_draw_frame_;
521 RenderPassList last_on_draw_render_passes_; 522 RenderPassList last_on_draw_render_passes_;
522 scoped_refptr<AnimationTimeline> timeline_; 523 scoped_refptr<AnimationTimeline> timeline_;
523 }; 524 };
524 525
525 // A test fixture for new animation timelines tests. 526 // A test fixture for new animation timelines tests.
526 class LayerTreeHostImplTimelinesTest : public LayerTreeHostImplTest { 527 class LayerTreeHostImplTimelinesTest : public LayerTreeHostImplTest {
527 public: 528 public:
528 void SetUp() override { 529 void SetUp() override {
529 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); 530 CreateHostImpl(DefaultSettings(), CreateCompositorFrameSink());
530 } 531 }
531 }; 532 };
532 533
533 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { 534 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
534 // Note: It is not possible to disable the renderer once it has been set, 535 // Note: It is not possible to disable the renderer once it has been set,
535 // so we do not need to test that disabling the renderer notifies us 536 // so we do not need to test that disabling the renderer notifies us
536 // that can_draw changed. 537 // that can_draw changed.
537 EXPECT_FALSE(host_impl_->CanDraw()); 538 EXPECT_FALSE(host_impl_->CanDraw());
538 on_can_draw_state_changed_called_ = false; 539 on_can_draw_state_changed_called_ = false;
539 540
(...skipping 21 matching lines...) Expand all
561 EXPECT_TRUE(on_can_draw_state_changed_called_); 562 EXPECT_TRUE(on_can_draw_state_changed_called_);
562 on_can_draw_state_changed_called_ = false; 563 on_can_draw_state_changed_called_ = false;
563 564
564 host_impl_->SetViewportSize(gfx::Size(100, 100)); 565 host_impl_->SetViewportSize(gfx::Size(100, 100));
565 EXPECT_TRUE(host_impl_->CanDraw()); 566 EXPECT_TRUE(host_impl_->CanDraw());
566 EXPECT_TRUE(on_can_draw_state_changed_called_); 567 EXPECT_TRUE(on_can_draw_state_changed_called_);
567 on_can_draw_state_changed_called_ = false; 568 on_can_draw_state_changed_called_ = false;
568 } 569 }
569 570
570 TEST_F(LayerTreeHostImplTest, ResourcelessDrawWithEmptyViewport) { 571 TEST_F(LayerTreeHostImplTest, ResourcelessDrawWithEmptyViewport) {
571 CreateHostImpl(DefaultSettings(), 572 CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::CreateSoftware());
572 FakeOutputSurface::CreateDelegatingSoftware());
573 SetupScrollAndContentsLayers(gfx::Size(100, 100)); 573 SetupScrollAndContentsLayers(gfx::Size(100, 100));
574 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 574 host_impl_->active_tree()->BuildPropertyTreesForTesting();
575 575
576 EXPECT_TRUE(host_impl_->CanDraw()); 576 EXPECT_TRUE(host_impl_->CanDraw());
577 host_impl_->SetViewportSize(gfx::Size()); 577 host_impl_->SetViewportSize(gfx::Size());
578 EXPECT_FALSE(host_impl_->CanDraw()); 578 EXPECT_FALSE(host_impl_->CanDraw());
579 579
580 FakeOutputSurface* fake_output_surface = 580 FakeCompositorFrameSink* fake_compositor_frame_sink =
581 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); 581 static_cast<FakeCompositorFrameSink*>(
582 EXPECT_EQ(fake_output_surface->num_sent_frames(), 0u); 582 host_impl_->compositor_frame_sink());
583 EXPECT_EQ(fake_compositor_frame_sink->num_sent_frames(), 0u);
583 gfx::Transform identity; 584 gfx::Transform identity;
584 gfx::Rect viewport(100, 100); 585 gfx::Rect viewport(100, 100);
585 const bool resourceless_software_draw = true; 586 const bool resourceless_software_draw = true;
586 host_impl_->OnDraw(identity, viewport, resourceless_software_draw); 587 host_impl_->OnDraw(identity, viewport, resourceless_software_draw);
587 ASSERT_EQ(fake_output_surface->num_sent_frames(), 1u); 588 ASSERT_EQ(fake_compositor_frame_sink->num_sent_frames(), 1u);
588 EXPECT_EQ(gfx::SizeF(100.f, 100.f), 589 EXPECT_EQ(
589 fake_output_surface->last_sent_frame()->metadata.root_layer_size); 590 gfx::SizeF(100.f, 100.f),
591 fake_compositor_frame_sink->last_sent_frame()->metadata.root_layer_size);
590 } 592 }
591 593
592 TEST_F(LayerTreeHostImplTest, ScrollDeltaNoLayers) { 594 TEST_F(LayerTreeHostImplTest, ScrollDeltaNoLayers) {
593 ASSERT_FALSE(host_impl_->active_tree()->root_layer_for_testing()); 595 ASSERT_FALSE(host_impl_->active_tree()->root_layer_for_testing());
594 596
595 std::unique_ptr<ScrollAndScaleSet> scroll_info = 597 std::unique_ptr<ScrollAndScaleSet> scroll_info =
596 host_impl_->ProcessScrollDeltas(); 598 host_impl_->ProcessScrollDeltas();
597 ASSERT_EQ(scroll_info->scrolls.size(), 0u); 599 ASSERT_EQ(scroll_info->scrolls.size(), 0u);
598 } 600 }
599 601
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 730 }
729 731
730 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { 732 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) {
731 std::unique_ptr<TestWebGraphicsContext3D> context_owned = 733 std::unique_ptr<TestWebGraphicsContext3D> context_owned =
732 TestWebGraphicsContext3D::Create(); 734 TestWebGraphicsContext3D::Create();
733 context_owned->set_context_lost(true); 735 context_owned->set_context_lost(true);
734 736
735 // Initialization will fail. 737 // Initialization will fail.
736 EXPECT_FALSE(CreateHostImpl( 738 EXPECT_FALSE(CreateHostImpl(
737 DefaultSettings(), 739 DefaultSettings(),
738 FakeOutputSurface::CreateDelegating3d(std::move(context_owned)))); 740 FakeCompositorFrameSink::Create3d(std::move(context_owned))));
739 741
740 SetupScrollAndContentsLayers(gfx::Size(100, 100)); 742 SetupScrollAndContentsLayers(gfx::Size(100, 100));
741 743
742 // We should not crash when trying to scroll after the renderer initialization 744 // We should not crash when trying to scroll after the renderer initialization
743 // fails. 745 // fails.
744 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( 746 InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
745 BeginState(gfx::Point()).get(), InputHandler::WHEEL); 747 BeginState(gfx::Point()).get(), InputHandler::WHEEL);
746 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 748 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
747 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 749 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
748 status.main_thread_scrolling_reasons); 750 status.main_thread_scrolling_reasons);
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 // An animation exists on the active layer. Doing Animate() requests another 1412 // An animation exists on the active layer. Doing Animate() requests another
1411 // frame after the current one. 1413 // frame after the current one.
1412 EXPECT_TRUE(did_request_next_frame_); 1414 EXPECT_TRUE(did_request_next_frame_);
1413 // The animation should cause us to draw at the frame's deadline. 1415 // The animation should cause us to draw at the frame's deadline.
1414 EXPECT_TRUE(did_request_redraw_); 1416 EXPECT_TRUE(did_request_redraw_);
1415 EXPECT_FALSE(did_request_commit_); 1417 EXPECT_FALSE(did_request_commit_);
1416 } 1418 }
1417 1419
1418 TEST_F(LayerTreeHostImplTest, AnimationSchedulingCommitToActiveTree) { 1420 TEST_F(LayerTreeHostImplTest, AnimationSchedulingCommitToActiveTree) {
1419 FakeImplTaskRunnerProvider provider(nullptr); 1421 FakeImplTaskRunnerProvider provider(nullptr);
1420 CreateHostImplWithTaskRunnerProvider(DefaultSettings(), CreateOutputSurface(), 1422 CreateHostImplWithTaskRunnerProvider(DefaultSettings(),
1421 &provider); 1423 CreateCompositorFrameSink(), &provider);
1422 EXPECT_TRUE(host_impl_->CommitToActiveTree()); 1424 EXPECT_TRUE(host_impl_->CommitToActiveTree());
1423 1425
1424 host_impl_->SetViewportSize(gfx::Size(50, 50)); 1426 host_impl_->SetViewportSize(gfx::Size(50, 50));
1425 1427
1426 auto root_owned = LayerImpl::Create(host_impl_->active_tree(), 1); 1428 auto root_owned = LayerImpl::Create(host_impl_->active_tree(), 1);
1427 auto* root = root_owned.get(); 1429 auto* root = root_owned.get();
1428 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_owned)); 1430 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_owned));
1429 root->SetBounds(gfx::Size(50, 50)); 1431 root->SetBounds(gfx::Size(50, 50));
1430 root->SetHasRenderSurface(true); 1432 root->SetHasRenderSurface(true);
1431 1433
(...skipping 22 matching lines...) Expand all
1454 1456
1455 host_impl_->CommitComplete(); 1457 host_impl_->CommitComplete();
1456 1458
1457 // Animations on the active tree should be started and ticked, and a new frame 1459 // Animations on the active tree should be started and ticked, and a new frame
1458 // should be requested to continue ticking them. 1460 // should be requested to continue ticking them.
1459 EXPECT_TRUE(did_request_next_frame_); 1461 EXPECT_TRUE(did_request_next_frame_);
1460 EXPECT_TRUE(did_request_redraw_); 1462 EXPECT_TRUE(did_request_redraw_);
1461 EXPECT_FALSE(did_request_commit_); 1463 EXPECT_FALSE(did_request_commit_);
1462 1464
1463 // Delete the LayerTreeHostImpl before the TaskRunnerProvider goes away. 1465 // Delete the LayerTreeHostImpl before the TaskRunnerProvider goes away.
1464 host_impl_->ReleaseOutputSurface(); 1466 host_impl_->ReleaseCompositorFrameSink();
1465 host_impl_ = nullptr; 1467 host_impl_ = nullptr;
1466 } 1468 }
1467 1469
1468 TEST_F(LayerTreeHostImplTest, AnimationSchedulingOnLayerDestruction) { 1470 TEST_F(LayerTreeHostImplTest, AnimationSchedulingOnLayerDestruction) {
1469 host_impl_->SetViewportSize(gfx::Size(50, 50)); 1471 host_impl_->SetViewportSize(gfx::Size(50, 50));
1470 1472
1471 host_impl_->active_tree()->SetRootLayerForTesting( 1473 host_impl_->active_tree()->SetRootLayerForTesting(
1472 LayerImpl::Create(host_impl_->active_tree(), 1)); 1474 LayerImpl::Create(host_impl_->active_tree(), 1));
1473 LayerImpl* root = *host_impl_->active_tree()->begin(); 1475 LayerImpl* root = *host_impl_->active_tree()->begin();
1474 root->SetBounds(gfx::Size(50, 50)); 1476 root->SetBounds(gfx::Size(50, 50));
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 std::unique_ptr<ScrollAndScaleSet> scroll_info = 1698 std::unique_ptr<ScrollAndScaleSet> scroll_info =
1697 host_impl_->ProcessScrollDeltas(); 1699 host_impl_->ProcessScrollDeltas();
1698 EXPECT_TRUE(ScrollInfoContains( 1700 EXPECT_TRUE(ScrollInfoContains(
1699 *scroll_info.get(), scroll_layer->id(), 1701 *scroll_info.get(), scroll_layer->id(),
1700 gfx::Vector2d(0, scroll_delta.y() / page_scale_delta))); 1702 gfx::Vector2d(0, scroll_delta.y() / page_scale_delta)));
1701 } 1703 }
1702 } 1704 }
1703 1705
1704 TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) { 1706 TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
1705 LayerTreeSettings settings = DefaultSettings(); 1707 LayerTreeSettings settings = DefaultSettings();
1706 CreateHostImpl(settings, 1708 CreateHostImpl(settings, CreateCompositorFrameSink());
1707 CreateOutputSurface());
1708 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.25f, 4.f); 1709 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.25f, 4.f);
1709 1710
1710 const gfx::Size content_size(1000, 1000); 1711 const gfx::Size content_size(1000, 1000);
1711 const gfx::Size viewport_size(500, 500); 1712 const gfx::Size viewport_size(500, 500);
1712 CreateBasicVirtualViewportLayers(viewport_size, content_size); 1713 CreateBasicVirtualViewportLayers(viewport_size, content_size);
1713 1714
1714 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer(); 1715 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer();
1715 outer_scroll_layer->SetDrawsContent(true); 1716 outer_scroll_layer->SetDrawsContent(true);
1716 LayerImpl* inner_scroll_layer = host_impl_->InnerViewportScrollLayer(); 1717 LayerImpl* inner_scroll_layer = host_impl_->InnerViewportScrollLayer();
1717 inner_scroll_layer->SetDrawsContent(true); 1718 inner_scroll_layer->SetDrawsContent(true);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 inner_scroll_layer->CurrentScrollOffset()); 1764 inner_scroll_layer->CurrentScrollOffset());
1764 EXPECT_VECTOR_EQ( 1765 EXPECT_VECTOR_EQ(
1765 gfx::Vector2dF(300, 300), 1766 gfx::Vector2dF(300, 300),
1766 outer_scroll_layer->CurrentScrollOffset()); 1767 outer_scroll_layer->CurrentScrollOffset());
1767 } 1768 }
1768 1769
1769 // Make sure scrolls smaller than a unit applied to the viewport don't get 1770 // Make sure scrolls smaller than a unit applied to the viewport don't get
1770 // dropped. crbug.com/539334. 1771 // dropped. crbug.com/539334.
1771 TEST_F(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) { 1772 TEST_F(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) {
1772 LayerTreeSettings settings = DefaultSettings(); 1773 LayerTreeSettings settings = DefaultSettings();
1773 CreateHostImpl(settings, CreateOutputSurface()); 1774 CreateHostImpl(settings, CreateCompositorFrameSink());
1774 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f); 1775 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f);
1775 1776
1776 const gfx::Size content_size(1000, 1000); 1777 const gfx::Size content_size(1000, 1000);
1777 const gfx::Size viewport_size(500, 500); 1778 const gfx::Size viewport_size(500, 500);
1778 CreateBasicVirtualViewportLayers(viewport_size, content_size); 1779 CreateBasicVirtualViewportLayers(viewport_size, content_size);
1779 1780
1780 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer(); 1781 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer();
1781 outer_scroll_layer->SetDrawsContent(true); 1782 outer_scroll_layer->SetDrawsContent(true);
1782 LayerImpl* inner_scroll_layer = host_impl_->InnerViewportScrollLayer(); 1783 LayerImpl* inner_scroll_layer = host_impl_->InnerViewportScrollLayer();
1783 inner_scroll_layer->SetDrawsContent(true); 1784 inner_scroll_layer->SetDrawsContent(true);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 gfx::Vector2dF(0.25f, 0.25f), 1818 gfx::Vector2dF(0.25f, 0.25f),
1818 inner_scroll_layer->CurrentScrollOffset()); 1819 inner_scroll_layer->CurrentScrollOffset());
1819 host_impl_->ScrollEnd(EndState().get()); 1820 host_impl_->ScrollEnd(EndState().get());
1820 } 1821 }
1821 1822
1822 // Tests that scrolls during a pinch gesture (i.e. "two-finger" scrolls) work 1823 // Tests that scrolls during a pinch gesture (i.e. "two-finger" scrolls) work
1823 // as expected. That is, scrolling during a pinch should bubble from the inner 1824 // as expected. That is, scrolling during a pinch should bubble from the inner
1824 // to the outer viewport. 1825 // to the outer viewport.
1825 TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) { 1826 TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) {
1826 LayerTreeSettings settings = DefaultSettings(); 1827 LayerTreeSettings settings = DefaultSettings();
1827 CreateHostImpl(settings, 1828 CreateHostImpl(settings, CreateCompositorFrameSink());
1828 CreateOutputSurface());
1829 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f); 1829 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f);
1830 1830
1831 const gfx::Size content_size(1000, 1000); 1831 const gfx::Size content_size(1000, 1000);
1832 const gfx::Size viewport_size(500, 500); 1832 const gfx::Size viewport_size(500, 500);
1833 CreateBasicVirtualViewportLayers(viewport_size, content_size); 1833 CreateBasicVirtualViewportLayers(viewport_size, content_size);
1834 1834
1835 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer(); 1835 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer();
1836 outer_scroll_layer->SetDrawsContent(true); 1836 outer_scroll_layer->SetDrawsContent(true);
1837 LayerImpl* inner_scroll_layer = host_impl_->InnerViewportScrollLayer(); 1837 LayerImpl* inner_scroll_layer = host_impl_->InnerViewportScrollLayer();
1838 inner_scroll_layer->SetDrawsContent(true); 1838 inner_scroll_layer->SetDrawsContent(true);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 1879
1880 host_impl_->PinchGestureEnd(); 1880 host_impl_->PinchGestureEnd();
1881 host_impl_->ScrollEnd(EndState().get()); 1881 host_impl_->ScrollEnd(EndState().get());
1882 } 1882 }
1883 1883
1884 // Tests the "snapping" of pinch-zoom gestures to the screen edge. That is, when 1884 // Tests the "snapping" of pinch-zoom gestures to the screen edge. That is, when
1885 // a pinch zoom is anchored within a certain margin of the screen edge, we 1885 // a pinch zoom is anchored within a certain margin of the screen edge, we
1886 // should assume the user means to scroll into the edge of the screen. 1886 // should assume the user means to scroll into the edge of the screen.
1887 TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) { 1887 TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) {
1888 LayerTreeSettings settings = DefaultSettings(); 1888 LayerTreeSettings settings = DefaultSettings();
1889 CreateHostImpl(settings, 1889 CreateHostImpl(settings, CreateCompositorFrameSink());
1890 CreateOutputSurface());
1891 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f); 1890 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f);
1892 1891
1893 const gfx::Size content_size(1000, 1000); 1892 const gfx::Size content_size(1000, 1000);
1894 const gfx::Size viewport_size(500, 500); 1893 const gfx::Size viewport_size(500, 500);
1895 CreateBasicVirtualViewportLayers(viewport_size, content_size); 1894 CreateBasicVirtualViewportLayers(viewport_size, content_size);
1896 1895
1897 int offsetFromEdge = Viewport::kPinchZoomSnapMarginDips - 5; 1896 int offsetFromEdge = Viewport::kPinchZoomSnapMarginDips - 5;
1898 gfx::Point anchor(viewport_size.width() - offsetFromEdge, 1897 gfx::Point anchor(viewport_size.width() - offsetFromEdge,
1899 viewport_size.height() - offsetFromEdge); 1898 viewport_size.height() - offsetFromEdge);
1900 1899
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 fake_current_physical_time_ = fake_now; 2722 fake_current_physical_time_ = fake_now;
2724 } 2723 }
2725 2724
2726 private: 2725 private:
2727 base::TimeTicks fake_current_physical_time_; 2726 base::TimeTicks fake_current_physical_time_;
2728 }; 2727 };
2729 2728
2730 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { 2729 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
2731 protected: 2730 protected:
2732 void SetupLayers(LayerTreeSettings settings) { 2731 void SetupLayers(LayerTreeSettings settings) {
2733 host_impl_->ReleaseOutputSurface(); 2732 host_impl_->ReleaseCompositorFrameSink();
2734 host_impl_ = nullptr; 2733 host_impl_ = nullptr;
2735 2734
2736 gfx::Size content_size(100, 100); 2735 gfx::Size content_size(100, 100);
2737 2736
2738 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = 2737 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time =
2739 new LayerTreeHostImplOverridePhysicalTime( 2738 new LayerTreeHostImplOverridePhysicalTime(
2740 settings, this, &task_runner_provider_, &shared_bitmap_manager_, 2739 settings, this, &task_runner_provider_, &shared_bitmap_manager_,
2741 &task_graph_runner_, &stats_instrumentation_); 2740 &task_graph_runner_, &stats_instrumentation_);
2742 host_impl_ = base::WrapUnique(host_impl_override_time); 2741 host_impl_ = base::WrapUnique(host_impl_override_time);
2743 output_surface_ = CreateOutputSurface(); 2742 compositor_frame_sink_ = CreateCompositorFrameSink();
2744 host_impl_->SetVisible(true); 2743 host_impl_->SetVisible(true);
2745 host_impl_->InitializeRenderer(output_surface_.get()); 2744 host_impl_->InitializeRenderer(compositor_frame_sink_.get());
2746 2745
2747 SetupScrollAndContentsLayers(content_size); 2746 SetupScrollAndContentsLayers(content_size);
2748 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); 2747 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
2749 host_impl_->SetViewportSize( 2748 host_impl_->SetViewportSize(
2750 gfx::Size(content_size.width() / 2, content_size.height() / 2)); 2749 gfx::Size(content_size.width() / 2, content_size.height() / 2));
2751 2750
2752 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2751 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2753 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, 2752 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400,
2754 VERTICAL, 10, 0, false, true); 2753 VERTICAL, 10, 0, false, true);
2755 scrollbar->test_properties()->opacity = 0.f; 2754 scrollbar->test_properties()->opacity = 0.f;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) { 2960 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) {
2962 LayerTreeSettings settings = DefaultSettings(); 2961 LayerTreeSettings settings = DefaultSettings();
2963 settings.scrollbar_animator = animator; 2962 settings.scrollbar_animator = animator;
2964 settings.scrollbar_fade_delay_ms = 20; 2963 settings.scrollbar_fade_delay_ms = 20;
2965 settings.scrollbar_fade_duration_ms = 20; 2964 settings.scrollbar_fade_duration_ms = 20;
2966 gfx::Size content_size(100, 100); 2965 gfx::Size content_size(100, 100);
2967 2966
2968 // If no animator is set, scrollbar won't show and no animation is expected. 2967 // If no animator is set, scrollbar won't show and no animation is expected.
2969 bool expecting_animations = animator != LayerTreeSettings::NO_ANIMATOR; 2968 bool expecting_animations = animator != LayerTreeSettings::NO_ANIMATOR;
2970 2969
2971 CreateHostImpl(settings, CreateOutputSurface()); 2970 CreateHostImpl(settings, CreateCompositorFrameSink());
2972 host_impl_->CreatePendingTree(); 2971 host_impl_->CreatePendingTree();
2973 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); 2972 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size);
2974 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2973 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2975 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400, 2974 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400,
2976 VERTICAL, 10, 0, false, true); 2975 VERTICAL, 10, 0, false, true);
2977 scrollbar->test_properties()->opacity = 0.f; 2976 scrollbar->test_properties()->opacity = 0.f;
2978 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer(); 2977 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer();
2979 LayerImpl* container = 2978 LayerImpl* container =
2980 host_impl_->pending_tree()->InnerViewportContainerLayer(); 2979 host_impl_->pending_tree()->InnerViewportContainerLayer();
2981 scrollbar->SetScrollLayerId(scroll->id()); 2980 scrollbar->SetScrollLayerId(scroll->id());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3050 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) { 3049 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) {
3051 RunTest(LayerTreeSettings::THINNING); 3050 RunTest(LayerTreeSettings::THINNING);
3052 } 3051 }
3053 3052
3054 TEST_F(LayerTreeHostImplTestScrollbarOpacity, NoAnimator) { 3053 TEST_F(LayerTreeHostImplTestScrollbarOpacity, NoAnimator) {
3055 RunTest(LayerTreeSettings::NO_ANIMATOR); 3054 RunTest(LayerTreeSettings::NO_ANIMATOR);
3056 } 3055 }
3057 3056
3058 TEST_F(LayerTreeHostImplTest, ScrollbarInnerLargerThanOuter) { 3057 TEST_F(LayerTreeHostImplTest, ScrollbarInnerLargerThanOuter) {
3059 LayerTreeSettings settings = DefaultSettings(); 3058 LayerTreeSettings settings = DefaultSettings();
3060 CreateHostImpl(settings, CreateOutputSurface()); 3059 CreateHostImpl(settings, CreateCompositorFrameSink());
3061 3060
3062 gfx::Size inner_viewport_size(315, 200); 3061 gfx::Size inner_viewport_size(315, 200);
3063 gfx::Size outer_viewport_size(300, 200); 3062 gfx::Size outer_viewport_size(300, 200);
3064 gfx::Size content_size(1000, 1000); 3063 gfx::Size content_size(1000, 1000);
3065 3064
3066 const int horiz_id = 11; 3065 const int horiz_id = 11;
3067 const int child_clip_id = 14; 3066 const int child_clip_id = 14;
3068 const int child_scroll_id = 15; 3067 const int child_scroll_id = 15;
3069 3068
3070 CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size); 3069 CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size);
(...skipping 16 matching lines...) Expand all
3087 horiz_scrollbar->SetScrollLayerId(root_scroll->id()); 3086 horiz_scrollbar->SetScrollLayerId(root_scroll->id());
3088 3087
3089 EXPECT_EQ(300, horiz_scrollbar->clip_layer_length()); 3088 EXPECT_EQ(300, horiz_scrollbar->clip_layer_length());
3090 } 3089 }
3091 3090
3092 TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) { 3091 TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) {
3093 LayerTreeSettings settings = DefaultSettings(); 3092 LayerTreeSettings settings = DefaultSettings();
3094 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE; 3093 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
3095 settings.scrollbar_fade_delay_ms = 20; 3094 settings.scrollbar_fade_delay_ms = 20;
3096 settings.scrollbar_fade_duration_ms = 20; 3095 settings.scrollbar_fade_duration_ms = 20;
3097 CreateHostImpl(settings, CreateOutputSurface()); 3096 CreateHostImpl(settings, CreateCompositorFrameSink());
3098 3097
3099 gfx::Size viewport_size(300, 200); 3098 gfx::Size viewport_size(300, 200);
3100 gfx::Size content_size(1000, 1000); 3099 gfx::Size content_size(1000, 1000);
3101 3100
3102 const int vert_1_id = 10; 3101 const int vert_1_id = 10;
3103 const int horiz_1_id = 11; 3102 const int horiz_1_id = 11;
3104 const int vert_2_id = 12; 3103 const int vert_2_id = 12;
3105 const int horiz_2_id = 13; 3104 const int horiz_2_id = 13;
3106 const int child_clip_id = 14; 3105 const int child_clip_id = 14;
3107 const int child_scroll_id = 15; 3106 const int child_scroll_id = 15;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3215 settings.scrollbar_fade_delay_ms = 500; 3214 settings.scrollbar_fade_delay_ms = 500;
3216 settings.scrollbar_fade_duration_ms = 300; 3215 settings.scrollbar_fade_duration_ms = 300;
3217 settings.scrollbar_animator = LayerTreeSettings::THINNING; 3216 settings.scrollbar_animator = LayerTreeSettings::THINNING;
3218 3217
3219 gfx::Size viewport_size(300, 200); 3218 gfx::Size viewport_size(300, 200);
3220 gfx::Size device_viewport_size = 3219 gfx::Size device_viewport_size =
3221 gfx::ScaleToFlooredSize(viewport_size, device_scale_factor); 3220 gfx::ScaleToFlooredSize(viewport_size, device_scale_factor);
3222 gfx::Size content_size(1000, 1000); 3221 gfx::Size content_size(1000, 1000);
3223 gfx::Size scrollbar_size(gfx::Size(15, viewport_size.height())); 3222 gfx::Size scrollbar_size(gfx::Size(15, viewport_size.height()));
3224 3223
3225 CreateHostImpl(settings, CreateOutputSurface()); 3224 CreateHostImpl(settings, CreateCompositorFrameSink());
3226 host_impl_->active_tree()->SetDeviceScaleFactor(device_scale_factor); 3225 host_impl_->active_tree()->SetDeviceScaleFactor(device_scale_factor);
3227 host_impl_->SetViewportSize(device_viewport_size); 3226 host_impl_->SetViewportSize(device_viewport_size);
3228 3227
3229 CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size); 3228 CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size);
3230 host_impl_->active_tree()->InnerViewportContainerLayer()->SetBounds( 3229 host_impl_->active_tree()->InnerViewportContainerLayer()->SetBounds(
3231 viewport_size); 3230 viewport_size);
3232 LayerImpl* root_scroll = 3231 LayerImpl* root_scroll =
3233 host_impl_->active_tree()->OuterViewportScrollLayer(); 3232 host_impl_->active_tree()->OuterViewportScrollLayer();
3234 // The scrollbar is on the left side. 3233 // The scrollbar is on the left side.
3235 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 3234 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
3832 3831
3833 LayerTreeHostImpl::FrameData frame; 3832 LayerTreeHostImpl::FrameData frame;
3834 EXPECT_EQ(testcase.expected_result, host_impl_->PrepareToDraw(&frame)); 3833 EXPECT_EQ(testcase.expected_result, host_impl_->PrepareToDraw(&frame));
3835 host_impl_->DrawLayers(&frame); 3834 host_impl_->DrawLayers(&frame);
3836 host_impl_->DidDrawAllLayers(frame); 3835 host_impl_->DidDrawAllLayers(frame);
3837 } 3836 }
3838 } 3837 }
3839 3838
3840 TEST_F(LayerTreeHostImplTest, 3839 TEST_F(LayerTreeHostImplTest,
3841 PrepareToDrawWhenDrawAndSwapFullViewportEveryFrame) { 3840 PrepareToDrawWhenDrawAndSwapFullViewportEveryFrame) {
3842 CreateHostImpl(DefaultSettings(), 3841 CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::CreateSoftware());
3843 FakeOutputSurface::CreateDelegatingSoftware());
3844 3842
3845 const gfx::Transform external_transform; 3843 const gfx::Transform external_transform;
3846 const gfx::Rect external_viewport; 3844 const gfx::Rect external_viewport;
3847 const bool resourceless_software_draw = true; 3845 const bool resourceless_software_draw = true;
3848 host_impl_->SetExternalTilePriorityConstraints(external_viewport, 3846 host_impl_->SetExternalTilePriorityConstraints(external_viewport,
3849 external_transform); 3847 external_transform);
3850 3848
3851 std::vector<PrepareToDrawSuccessTestCase> cases; 3849 std::vector<PrepareToDrawSuccessTestCase> cases;
3852 3850
3853 // 0. Default case. 3851 // 0. Default case.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3949 LayerTreeHostImplTopControlsTest() 3947 LayerTreeHostImplTopControlsTest()
3950 // Make the clip size the same as the layer (content) size so the layer is 3948 // Make the clip size the same as the layer (content) size so the layer is
3951 // non-scrollable. 3949 // non-scrollable.
3952 : layer_size_(10, 10), 3950 : layer_size_(10, 10),
3953 clip_size_(layer_size_), 3951 clip_size_(layer_size_),
3954 top_controls_height_(50) { 3952 top_controls_height_(50) {
3955 viewport_size_ = gfx::Size(clip_size_.width(), 3953 viewport_size_ = gfx::Size(clip_size_.width(),
3956 clip_size_.height() + top_controls_height_); 3954 clip_size_.height() + top_controls_height_);
3957 } 3955 }
3958 3956
3959 bool CreateHostImpl(const LayerTreeSettings& settings, 3957 bool CreateHostImpl(
3960 std::unique_ptr<OutputSurface> output_surface) override { 3958 const LayerTreeSettings& settings,
3959 std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override {
3961 bool init = LayerTreeHostImplTest::CreateHostImpl( 3960 bool init = LayerTreeHostImplTest::CreateHostImpl(
3962 settings, std::move(output_surface)); 3961 settings, std::move(compositor_frame_sink));
3963 if (init) { 3962 if (init) {
3964 host_impl_->active_tree()->set_top_controls_height(top_controls_height_); 3963 host_impl_->active_tree()->set_top_controls_height(top_controls_height_);
3965 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f); 3964 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f);
3966 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 3965 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
3967 } 3966 }
3968 return init; 3967 return init;
3969 } 3968 }
3970 3969
3971 void SetupTopControlsAndScrollLayerWithVirtualViewport( 3970 void SetupTopControlsAndScrollLayerWithVirtualViewport(
3972 const gfx::Size& inner_viewport_size, 3971 const gfx::Size& inner_viewport_size,
3973 const gfx::Size& outer_viewport_size, 3972 const gfx::Size& outer_viewport_size,
3974 const gfx::Size& scroll_layer_size) { 3973 const gfx::Size& scroll_layer_size) {
3975 settings_ = DefaultSettings(); 3974 settings_ = DefaultSettings();
3976 CreateHostImpl(settings_, CreateOutputSurface()); 3975 CreateHostImpl(settings_, CreateCompositorFrameSink());
3977 SetupTopControlsAndScrollLayerWithVirtualViewport( 3976 SetupTopControlsAndScrollLayerWithVirtualViewport(
3978 host_impl_->active_tree(), inner_viewport_size, outer_viewport_size, 3977 host_impl_->active_tree(), inner_viewport_size, outer_viewport_size,
3979 scroll_layer_size); 3978 scroll_layer_size);
3980 } 3979 }
3981 3980
3982 void SetupTopControlsAndScrollLayerWithVirtualViewport( 3981 void SetupTopControlsAndScrollLayerWithVirtualViewport(
3983 LayerTreeImpl* tree_impl, 3982 LayerTreeImpl* tree_impl,
3984 const gfx::Size& inner_viewport_size, 3983 const gfx::Size& inner_viewport_size,
3985 const gfx::Size& outer_viewport_size, 3984 const gfx::Size& outer_viewport_size,
3986 const gfx::Size& scroll_layer_size) { 3985 const gfx::Size& scroll_layer_size) {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
4377 // Top controls should be hidden 4376 // Top controls should be hidden
4378 EXPECT_EQ(scroll_delta.y(), 4377 EXPECT_EQ(scroll_delta.y(),
4379 top_controls_height_ - 4378 top_controls_height_ -
4380 host_impl_->top_controls_manager()->ContentTopOffset()); 4379 host_impl_->top_controls_manager()->ContentTopOffset());
4381 } 4380 }
4382 4381
4383 // Ensure setting the top controls position explicitly using the setters on the 4382 // Ensure setting the top controls position explicitly using the setters on the
4384 // TreeImpl correctly affects the top controls manager and viewport bounds. 4383 // TreeImpl correctly affects the top controls manager and viewport bounds.
4385 TEST_F(LayerTreeHostImplTopControlsTest, PositionTopControlsExplicitly) { 4384 TEST_F(LayerTreeHostImplTopControlsTest, PositionTopControlsExplicitly) {
4386 settings_ = DefaultSettings(); 4385 settings_ = DefaultSettings();
4387 CreateHostImpl(settings_, CreateOutputSurface()); 4386 CreateHostImpl(settings_, CreateCompositorFrameSink());
4388 SetupTopControlsAndScrollLayerWithVirtualViewport( 4387 SetupTopControlsAndScrollLayerWithVirtualViewport(
4389 layer_size_, layer_size_, layer_size_); 4388 layer_size_, layer_size_, layer_size_);
4390 DrawFrame(); 4389 DrawFrame();
4391 4390
4392 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(0.f); 4391 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(0.f);
4393 host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread( 4392 host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread(
4394 30.f / top_controls_height_); 4393 30.f / top_controls_height_);
4395 host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive(); 4394 host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive();
4396 EXPECT_FLOAT_EQ(30.f, host_impl_->top_controls_manager()->ContentTopOffset()); 4395 EXPECT_FLOAT_EQ(30.f, host_impl_->top_controls_manager()->ContentTopOffset());
4397 EXPECT_FLOAT_EQ(-20.f, 4396 EXPECT_FLOAT_EQ(-20.f,
(...skipping 12 matching lines...) Expand all
4410 ->parent->test_properties() 4409 ->parent->test_properties()
4411 ->parent; 4410 ->parent;
4412 EXPECT_EQ(viewport_size_, inner_clip_ptr->bounds()); 4411 EXPECT_EQ(viewport_size_, inner_clip_ptr->bounds());
4413 } 4412 }
4414 4413
4415 // Test that the top_controls delta and sent delta are appropriately 4414 // Test that the top_controls delta and sent delta are appropriately
4416 // applied on sync tree activation. The total top controls offset shouldn't 4415 // applied on sync tree activation. The total top controls offset shouldn't
4417 // change after the activation. 4416 // change after the activation.
4418 TEST_F(LayerTreeHostImplTopControlsTest, ApplyDeltaOnTreeActivation) { 4417 TEST_F(LayerTreeHostImplTopControlsTest, ApplyDeltaOnTreeActivation) {
4419 settings_ = DefaultSettings(); 4418 settings_ = DefaultSettings();
4420 CreateHostImpl(settings_, CreateOutputSurface()); 4419 CreateHostImpl(settings_, CreateCompositorFrameSink());
4421 SetupTopControlsAndScrollLayerWithVirtualViewport( 4420 SetupTopControlsAndScrollLayerWithVirtualViewport(
4422 layer_size_, layer_size_, layer_size_); 4421 layer_size_, layer_size_, layer_size_);
4423 DrawFrame(); 4422 DrawFrame();
4424 4423
4425 host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread( 4424 host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread(
4426 20.f / top_controls_height_); 4425 20.f / top_controls_height_);
4427 host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive(); 4426 host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive();
4428 host_impl_->active_tree()->SetCurrentTopControlsShownRatio( 4427 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(
4429 15.f / top_controls_height_); 4428 15.f / top_controls_height_);
4430 host_impl_->active_tree() 4429 host_impl_->active_tree()
(...skipping 28 matching lines...) Expand all
4459 host_impl_->active_tree()->top_controls_shown_ratio()->ActiveBase() * 4458 host_impl_->active_tree()->top_controls_shown_ratio()->ActiveBase() *
4460 top_controls_height_); 4459 top_controls_height_);
4461 } 4460 }
4462 4461
4463 // Test that changing the top controls layout height is correctly applied to 4462 // Test that changing the top controls layout height is correctly applied to
4464 // the inner viewport container bounds. That is, the top controls layout 4463 // the inner viewport container bounds. That is, the top controls layout
4465 // height is the amount that the inner viewport container was shrunk outside 4464 // height is the amount that the inner viewport container was shrunk outside
4466 // the compositor to accommodate the top controls. 4465 // the compositor to accommodate the top controls.
4467 TEST_F(LayerTreeHostImplTopControlsTest, TopControlsLayoutHeightChanged) { 4466 TEST_F(LayerTreeHostImplTopControlsTest, TopControlsLayoutHeightChanged) {
4468 settings_ = DefaultSettings(); 4467 settings_ = DefaultSettings();
4469 CreateHostImpl(settings_, CreateOutputSurface()); 4468 CreateHostImpl(settings_, CreateCompositorFrameSink());
4470 SetupTopControlsAndScrollLayerWithVirtualViewport( 4469 SetupTopControlsAndScrollLayerWithVirtualViewport(
4471 layer_size_, layer_size_, layer_size_); 4470 layer_size_, layer_size_, layer_size_);
4472 DrawFrame(); 4471 DrawFrame();
4473 4472
4474 host_impl_->sync_tree()->PushTopControlsFromMainThread(1.f); 4473 host_impl_->sync_tree()->PushTopControlsFromMainThread(1.f);
4475 host_impl_->sync_tree()->set_top_controls_shrink_blink_size(true); 4474 host_impl_->sync_tree()->set_top_controls_shrink_blink_size(true);
4476 4475
4477 host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread( 4476 host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread(
4478 1.f); 4477 1.f);
4479 host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive(); 4478 host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
4691 EXPECT_FLOAT_EQ( 4690 EXPECT_FLOAT_EQ(
4692 inner_viewport_offset.y() + (scroll_delta.y() + top_controls_height_), 4691 inner_viewport_offset.y() + (scroll_delta.y() + top_controls_height_),
4693 ScrollDelta(host_impl_->InnerViewportScrollLayer()).y()); 4692 ScrollDelta(host_impl_->InnerViewportScrollLayer()).y());
4694 4693
4695 host_impl_->ScrollEnd(EndState().get()); 4694 host_impl_->ScrollEnd(EndState().get());
4696 } 4695 }
4697 4696
4698 TEST_F(LayerTreeHostImplTopControlsTest, 4697 TEST_F(LayerTreeHostImplTopControlsTest,
4699 ScrollNonScrollableRootWithTopControls) { 4698 ScrollNonScrollableRootWithTopControls) {
4700 settings_ = DefaultSettings(); 4699 settings_ = DefaultSettings();
4701 CreateHostImpl(settings_, CreateOutputSurface()); 4700 CreateHostImpl(settings_, CreateCompositorFrameSink());
4702 SetupTopControlsAndScrollLayerWithVirtualViewport( 4701 SetupTopControlsAndScrollLayerWithVirtualViewport(
4703 layer_size_, layer_size_, layer_size_); 4702 layer_size_, layer_size_, layer_size_);
4704 DrawFrame(); 4703 DrawFrame();
4705 4704
4706 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, 4705 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
4707 host_impl_ 4706 host_impl_
4708 ->ScrollBegin(BeginState(gfx::Point()).get(), 4707 ->ScrollBegin(BeginState(gfx::Point()).get(),
4709 InputHandler::TOUCHSCREEN) 4708 InputHandler::TOUCHSCREEN)
4710 .thread); 4709 .thread);
4711 4710
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
5954 // sees the correct size of the new tree. 5953 // sees the correct size of the new tree.
5955 gfx::Size new_size(42, 24); 5954 gfx::Size new_size(42, 24);
5956 host_impl_->CreatePendingTree(); 5955 host_impl_->CreatePendingTree();
5957 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 5956 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
5958 CreateScrollAndContentsLayers(host_impl_->pending_tree(), new_size); 5957 CreateScrollAndContentsLayers(host_impl_->pending_tree(), new_size);
5959 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); 5958 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
5960 host_impl_->ActivateSyncTree(); 5959 host_impl_->ActivateSyncTree();
5961 EXPECT_EQ(gfx::SizeF(new_size), scroll_watcher.scrollable_size()); 5960 EXPECT_EQ(gfx::SizeF(new_size), scroll_watcher.scrollable_size());
5962 5961
5963 // Tear down the LayerTreeHostImpl before the InputHandlerClient. 5962 // Tear down the LayerTreeHostImpl before the InputHandlerClient.
5964 host_impl_->ReleaseOutputSurface(); 5963 host_impl_->ReleaseCompositorFrameSink();
5965 host_impl_ = nullptr; 5964 host_impl_ = nullptr;
5966 } 5965 }
5967 5966
5968 void CheckLayerScrollDelta(LayerImpl* layer, gfx::Vector2dF scroll_delta) { 5967 void CheckLayerScrollDelta(LayerImpl* layer, gfx::Vector2dF scroll_delta) {
5969 const gfx::Transform target_space_transform = 5968 const gfx::Transform target_space_transform =
5970 layer->draw_properties().target_space_transform; 5969 layer->draw_properties().target_space_transform;
5971 EXPECT_TRUE(target_space_transform.IsScaleOrTranslation()); 5970 EXPECT_TRUE(target_space_transform.IsScaleOrTranslation());
5972 gfx::Point translated_point; 5971 gfx::Point translated_point;
5973 target_space_transform.TransformPoint(&translated_point); 5972 target_space_transform.TransformPoint(&translated_point);
5974 gfx::Point expected_point = gfx::Point() - ToRoundedVector2d(scroll_delta); 5973 gfx::Point expected_point = gfx::Point() - ToRoundedVector2d(scroll_delta);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
6249 EXPECT_FALSE(scroll_result.did_scroll); 6248 EXPECT_FALSE(scroll_result.did_scroll);
6250 EXPECT_TRUE(scroll_result.did_overscroll_root); 6249 EXPECT_TRUE(scroll_result.did_overscroll_root);
6251 EXPECT_EQ(gfx::Vector2dF(0, 14), host_impl_->accumulated_root_overscroll()); 6250 EXPECT_EQ(gfx::Vector2dF(0, 14), host_impl_->accumulated_root_overscroll());
6252 host_impl_->ScrollEnd(EndState().get()); 6251 host_impl_->ScrollEnd(EndState().get());
6253 } 6252 }
6254 } 6253 }
6255 6254
6256 TEST_F(LayerTreeHostImplTest, OverscrollAlways) { 6255 TEST_F(LayerTreeHostImplTest, OverscrollAlways) {
6257 InputHandlerScrollResult scroll_result; 6256 InputHandlerScrollResult scroll_result;
6258 LayerTreeSettings settings = DefaultSettings(); 6257 LayerTreeSettings settings = DefaultSettings();
6259 CreateHostImpl(settings, CreateOutputSurface()); 6258 CreateHostImpl(settings, CreateCompositorFrameSink());
6260 6259
6261 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(50, 50)); 6260 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(50, 50));
6262 LayerImpl* clip_layer = 6261 LayerImpl* clip_layer =
6263 scroll_layer->test_properties()->parent->test_properties()->parent; 6262 scroll_layer->test_properties()->parent->test_properties()->parent;
6264 6263
6265 clip_layer->SetBounds(gfx::Size(50, 50)); 6264 clip_layer->SetBounds(gfx::Size(50, 50));
6266 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 6265 host_impl_->active_tree()->BuildPropertyTreesForTesting();
6267 6266
6268 host_impl_->SetViewportSize(gfx::Size(50, 50)); 6267 host_impl_->SetViewportSize(gfx::Size(50, 50));
6269 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); 6268 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6343 EXPECT_FALSE(scroll_result.did_overscroll_root); 6342 EXPECT_FALSE(scroll_result.did_overscroll_root);
6344 EXPECT_EQ(gfx::Vector2dF().ToString(), 6343 EXPECT_EQ(gfx::Vector2dF().ToString(),
6345 host_impl_->accumulated_root_overscroll().ToString()); 6344 host_impl_->accumulated_root_overscroll().ToString());
6346 host_impl_->ScrollEnd(EndState().get()); 6345 host_impl_->ScrollEnd(EndState().get());
6347 } 6346 }
6348 } 6347 }
6349 6348
6350 TEST_F(LayerTreeHostImplTest, OverscrollOnMainThread) { 6349 TEST_F(LayerTreeHostImplTest, OverscrollOnMainThread) {
6351 InputHandlerScrollResult scroll_result; 6350 InputHandlerScrollResult scroll_result;
6352 LayerTreeSettings settings = DefaultSettings(); 6351 LayerTreeSettings settings = DefaultSettings();
6353 CreateHostImpl(settings, CreateOutputSurface()); 6352 CreateHostImpl(settings, CreateCompositorFrameSink());
6354 6353
6355 const gfx::Size content_size(50, 50); 6354 const gfx::Size content_size(50, 50);
6356 const gfx::Size viewport_size(50, 50); 6355 const gfx::Size viewport_size(50, 50);
6357 CreateBasicVirtualViewportLayers(viewport_size, content_size); 6356 CreateBasicVirtualViewportLayers(viewport_size, content_size);
6358 6357
6359 LayerImpl* scroll_layer = 6358 LayerImpl* scroll_layer =
6360 host_impl_->active_tree()->InnerViewportScrollLayer(); 6359 host_impl_->active_tree()->InnerViewportScrollLayer();
6361 scroll_layer->set_main_thread_scrolling_reasons( 6360 scroll_layer->set_main_thread_scrolling_reasons(
6362 MainThreadScrollingReason::kThreadedScrollingDisabled); 6361 MainThreadScrollingReason::kThreadedScrollingDisabled);
6363 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 6362 host_impl_->active_tree()->BuildPropertyTreesForTesting();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
6511 EXPECT_VECTOR_EQ(gfx::Vector2dF(0.f, 0.f), 6510 EXPECT_VECTOR_EQ(gfx::Vector2dF(0.f, 0.f),
6512 outer_scroll_layer->CurrentScrollOffset()); 6511 outer_scroll_layer->CurrentScrollOffset());
6513 EXPECT_VECTOR_EQ(gfx::Vector2dF(50.f, 50.f), 6512 EXPECT_VECTOR_EQ(gfx::Vector2dF(50.f, 50.f),
6514 scroll_layer->CurrentScrollOffset()); 6513 scroll_layer->CurrentScrollOffset());
6515 } 6514 }
6516 } 6515 }
6517 6516
6518 TEST_F(LayerTreeHostImplTest, OverscrollOnImplThread) { 6517 TEST_F(LayerTreeHostImplTest, OverscrollOnImplThread) {
6519 InputHandlerScrollResult scroll_result; 6518 InputHandlerScrollResult scroll_result;
6520 LayerTreeSettings settings = DefaultSettings(); 6519 LayerTreeSettings settings = DefaultSettings();
6521 CreateHostImpl(settings, CreateOutputSurface()); 6520 CreateHostImpl(settings, CreateCompositorFrameSink());
6522 6521
6523 const gfx::Size content_size(50, 50); 6522 const gfx::Size content_size(50, 50);
6524 const gfx::Size viewport_size(50, 50); 6523 const gfx::Size viewport_size(50, 50);
6525 CreateBasicVirtualViewportLayers(viewport_size, content_size); 6524 CreateBasicVirtualViewportLayers(viewport_size, content_size);
6526 6525
6527 // By default, no main thread scrolling reasons should exist. 6526 // By default, no main thread scrolling reasons should exist.
6528 LayerImpl* scroll_layer = 6527 LayerImpl* scroll_layer =
6529 host_impl_->active_tree()->InnerViewportScrollLayer(); 6528 host_impl_->active_tree()->InnerViewportScrollLayer();
6530 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 6529 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
6531 scroll_layer->main_thread_scrolling_reasons()); 6530 scroll_layer->main_thread_scrolling_reasons());
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
6932 EXPECT_TRUE(MayContainVideoBitSetOnFrameData(host_impl_.get())); 6931 EXPECT_TRUE(MayContainVideoBitSetOnFrameData(host_impl_.get()));
6933 } 6932 }
6934 6933
6935 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { 6934 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
6936 protected: 6935 protected:
6937 LayerTreeHostImplViewportCoveredTest() : 6936 LayerTreeHostImplViewportCoveredTest() :
6938 gutter_quad_material_(DrawQuad::SOLID_COLOR), 6937 gutter_quad_material_(DrawQuad::SOLID_COLOR),
6939 child_(NULL), 6938 child_(NULL),
6940 did_activate_pending_tree_(false) {} 6939 did_activate_pending_tree_(false) {}
6941 6940
6942 std::unique_ptr<OutputSurface> CreateFakeOutputSurface(bool software) { 6941 std::unique_ptr<CompositorFrameSink> CreateFakeCompositorFrameSink(
6942 bool software) {
6943 if (software) 6943 if (software)
6944 return FakeOutputSurface::CreateDelegatingSoftware(); 6944 return FakeCompositorFrameSink::CreateSoftware();
6945 return FakeOutputSurface::CreateDelegating3d(); 6945 return FakeCompositorFrameSink::Create3d();
6946 } 6946 }
6947 6947
6948 void SetupActiveTreeLayers() { 6948 void SetupActiveTreeLayers() {
6949 host_impl_->active_tree()->set_background_color(SK_ColorGRAY); 6949 host_impl_->active_tree()->set_background_color(SK_ColorGRAY);
6950 host_impl_->active_tree()->SetRootLayerForTesting( 6950 host_impl_->active_tree()->SetRootLayerForTesting(
6951 LayerImpl::Create(host_impl_->active_tree(), 1)); 6951 LayerImpl::Create(host_impl_->active_tree(), 1));
6952 host_impl_->active_tree() 6952 host_impl_->active_tree()
6953 ->root_layer_for_testing() 6953 ->root_layer_for_testing()
6954 ->test_properties() 6954 ->test_properties()
6955 ->force_render_surface = true; 6955 ->force_render_surface = true;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
7151 gfx::Size gutter_texture_size_; 7151 gfx::Size gutter_texture_size_;
7152 gfx::Size viewport_size_; 7152 gfx::Size viewport_size_;
7153 BlendStateCheckLayer* child_; 7153 BlendStateCheckLayer* child_;
7154 bool did_activate_pending_tree_; 7154 bool did_activate_pending_tree_;
7155 }; 7155 };
7156 7156
7157 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCovered) { 7157 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCovered) {
7158 viewport_size_ = gfx::Size(1000, 1000); 7158 viewport_size_ = gfx::Size(1000, 1000);
7159 7159
7160 bool software = false; 7160 bool software = false;
7161 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(software)); 7161 CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software));
7162 7162
7163 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); 7163 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_));
7164 SetupActiveTreeLayers(); 7164 SetupActiveTreeLayers();
7165 EXPECT_SCOPED(TestLayerCoversFullViewport()); 7165 EXPECT_SCOPED(TestLayerCoversFullViewport());
7166 EXPECT_SCOPED(TestEmptyLayer()); 7166 EXPECT_SCOPED(TestEmptyLayer());
7167 EXPECT_SCOPED(TestLayerInMiddleOfViewport()); 7167 EXPECT_SCOPED(TestLayerInMiddleOfViewport());
7168 EXPECT_SCOPED(TestLayerIsLargerThanViewport()); 7168 EXPECT_SCOPED(TestLayerIsLargerThanViewport());
7169 } 7169 }
7170 7170
7171 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredScaled) { 7171 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredScaled) {
7172 viewport_size_ = gfx::Size(1000, 1000); 7172 viewport_size_ = gfx::Size(1000, 1000);
7173 7173
7174 bool software = false; 7174 bool software = false;
7175 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(software)); 7175 CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software));
7176 7176
7177 host_impl_->active_tree()->SetDeviceScaleFactor(2.f); 7177 host_impl_->active_tree()->SetDeviceScaleFactor(2.f);
7178 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); 7178 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_));
7179 SetupActiveTreeLayers(); 7179 SetupActiveTreeLayers();
7180 EXPECT_SCOPED(TestLayerCoversFullViewport()); 7180 EXPECT_SCOPED(TestLayerCoversFullViewport());
7181 EXPECT_SCOPED(TestEmptyLayer()); 7181 EXPECT_SCOPED(TestEmptyLayer());
7182 EXPECT_SCOPED(TestLayerInMiddleOfViewport()); 7182 EXPECT_SCOPED(TestLayerInMiddleOfViewport());
7183 EXPECT_SCOPED(TestLayerIsLargerThanViewport()); 7183 EXPECT_SCOPED(TestLayerIsLargerThanViewport());
7184 } 7184 }
7185 7185
7186 TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeGrowViewportInvalid) { 7186 TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeGrowViewportInvalid) {
7187 viewport_size_ = gfx::Size(1000, 1000); 7187 viewport_size_ = gfx::Size(1000, 1000);
7188 7188
7189 bool software = true; 7189 bool software = true;
7190 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(software)); 7190 CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software));
7191 7191
7192 // Pending tree to force active_tree size invalid. Not used otherwise. 7192 // Pending tree to force active_tree size invalid. Not used otherwise.
7193 host_impl_->CreatePendingTree(); 7193 host_impl_->CreatePendingTree();
7194 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); 7194 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_));
7195 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid()); 7195 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid());
7196 7196
7197 SetupActiveTreeLayers(); 7197 SetupActiveTreeLayers();
7198 EXPECT_SCOPED(TestEmptyLayerWithOnDraw()); 7198 EXPECT_SCOPED(TestEmptyLayerWithOnDraw());
7199 EXPECT_SCOPED(TestLayerInMiddleOfViewportWithOnDraw()); 7199 EXPECT_SCOPED(TestLayerInMiddleOfViewportWithOnDraw());
7200 EXPECT_SCOPED(TestLayerIsLargerThanViewportWithOnDraw()); 7200 EXPECT_SCOPED(TestLayerIsLargerThanViewportWithOnDraw());
7201 } 7201 }
7202 7202
7203 TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeShrinkViewportInvalid) { 7203 TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeShrinkViewportInvalid) {
7204 viewport_size_ = gfx::Size(1000, 1000); 7204 viewport_size_ = gfx::Size(1000, 1000);
7205 7205
7206 bool software = true; 7206 bool software = true;
7207 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(software)); 7207 CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software));
7208 7208
7209 // Set larger viewport and activate it to active tree. 7209 // Set larger viewport and activate it to active tree.
7210 host_impl_->CreatePendingTree(); 7210 host_impl_->CreatePendingTree();
7211 gfx::Size larger_viewport(viewport_size_.width() + 100, 7211 gfx::Size larger_viewport(viewport_size_.width() + 100,
7212 viewport_size_.height() + 100); 7212 viewport_size_.height() + 100);
7213 host_impl_->SetViewportSize(DipSizeToPixelSize(larger_viewport)); 7213 host_impl_->SetViewportSize(DipSizeToPixelSize(larger_viewport));
7214 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid()); 7214 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid());
7215 host_impl_->ActivateSyncTree(); 7215 host_impl_->ActivateSyncTree();
7216 EXPECT_TRUE(did_activate_pending_tree_); 7216 EXPECT_TRUE(did_activate_pending_tree_);
7217 EXPECT_FALSE(host_impl_->active_tree()->ViewportSizeInvalid()); 7217 EXPECT_FALSE(host_impl_->active_tree()->ViewportSizeInvalid());
(...skipping 20 matching lines...) Expand all
7238 }; 7238 };
7239 7239
7240 // Make sure damage tracking propagates all the way to the graphics context, 7240 // Make sure damage tracking propagates all the way to the graphics context,
7241 // where it should request to swap only the sub-buffer that is damaged. 7241 // where it should request to swap only the sub-buffer that is damaged.
7242 TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) { 7242 TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
7243 scoped_refptr<TestContextProvider> context_provider( 7243 scoped_refptr<TestContextProvider> context_provider(
7244 TestContextProvider::Create()); 7244 TestContextProvider::Create());
7245 context_provider->BindToCurrentThread(); 7245 context_provider->BindToCurrentThread();
7246 context_provider->TestContext3d()->set_have_post_sub_buffer(true); 7246 context_provider->TestContext3d()->set_have_post_sub_buffer(true);
7247 7247
7248 std::unique_ptr<FakeOutputSurface> output_surface( 7248 std::unique_ptr<FakeCompositorFrameSink> compositor_frame_sink(
7249 FakeOutputSurface::CreateDelegating3d(context_provider)); 7249 FakeCompositorFrameSink::Create3d(context_provider));
7250 FakeOutputSurface* fake_output_surface = output_surface.get(); 7250 FakeCompositorFrameSink* fake_compositor_frame_sink =
7251 compositor_frame_sink.get();
7251 7252
7252 // This test creates its own LayerTreeHostImpl, so 7253 // This test creates its own LayerTreeHostImpl, so
7253 // that we can force partial swap enabled. 7254 // that we can force partial swap enabled.
7254 LayerTreeSettings settings = DefaultSettings(); 7255 LayerTreeSettings settings = DefaultSettings();
7255 settings.renderer_settings.partial_swap_enabled = true; 7256 settings.renderer_settings.partial_swap_enabled = true;
7256 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl = 7257 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl =
7257 LayerTreeHostImpl::Create( 7258 LayerTreeHostImpl::Create(
7258 settings, this, &task_runner_provider_, &stats_instrumentation_, 7259 settings, this, &task_runner_provider_, &stats_instrumentation_,
7259 &shared_bitmap_manager_, NULL, &task_graph_runner_, 7260 &shared_bitmap_manager_, NULL, &task_graph_runner_,
7260 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0); 7261 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0);
7261 layer_tree_host_impl->SetVisible(true); 7262 layer_tree_host_impl->SetVisible(true);
7262 layer_tree_host_impl->InitializeRenderer(output_surface.get()); 7263 layer_tree_host_impl->InitializeRenderer(compositor_frame_sink.get());
7263 layer_tree_host_impl->WillBeginImplFrame( 7264 layer_tree_host_impl->WillBeginImplFrame(
7264 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 7265 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
7265 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); 7266 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500));
7266 7267
7267 std::unique_ptr<LayerImpl> root = 7268 std::unique_ptr<LayerImpl> root =
7268 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); 7269 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1);
7269 root->test_properties()->force_render_surface = true; 7270 root->test_properties()->force_render_surface = true;
7270 std::unique_ptr<LayerImpl> child = 7271 std::unique_ptr<LayerImpl> child =
7271 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); 7272 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2);
7272 child->SetPosition(gfx::PointF(12.f, 13.f)); 7273 child->SetPosition(gfx::PointF(12.f, 13.f));
7273 child->SetBounds(gfx::Size(14, 15)); 7274 child->SetBounds(gfx::Size(14, 15));
7274 child->SetDrawsContent(true); 7275 child->SetDrawsContent(true);
7275 root->SetBounds(gfx::Size(500, 500)); 7276 root->SetBounds(gfx::Size(500, 500));
7276 root->SetDrawsContent(true); 7277 root->SetDrawsContent(true);
7277 root->test_properties()->AddChild(std::move(child)); 7278 root->test_properties()->AddChild(std::move(child));
7278 layer_tree_host_impl->active_tree()->SetRootLayerForTesting(std::move(root)); 7279 layer_tree_host_impl->active_tree()->SetRootLayerForTesting(std::move(root));
7279 layer_tree_host_impl->active_tree()->BuildPropertyTreesForTesting(); 7280 layer_tree_host_impl->active_tree()->BuildPropertyTreesForTesting();
7280 7281
7281 LayerTreeHostImpl::FrameData frame; 7282 LayerTreeHostImpl::FrameData frame;
7282 7283
7283 // First frame, the entire screen should get swapped. 7284 // First frame, the entire screen should get swapped.
7284 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); 7285 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame));
7285 layer_tree_host_impl->DrawLayers(&frame); 7286 layer_tree_host_impl->DrawLayers(&frame);
7286 layer_tree_host_impl->DidDrawAllLayers(frame); 7287 layer_tree_host_impl->DidDrawAllLayers(frame);
7287 gfx::Rect expected_swap_rect(500, 500); 7288 gfx::Rect expected_swap_rect(500, 500);
7288 EXPECT_EQ(expected_swap_rect.ToString(), 7289 EXPECT_EQ(expected_swap_rect.ToString(),
7289 fake_output_surface->last_swap_rect().ToString()); 7290 fake_compositor_frame_sink->last_swap_rect().ToString());
7290 7291
7291 // Second frame, only the damaged area should get swapped. Damage should be 7292 // Second frame, only the damaged area should get swapped. Damage should be
7292 // the union of old and new child rects: gfx::Rect(26, 28). 7293 // the union of old and new child rects: gfx::Rect(26, 28).
7293 layer_tree_host_impl->active_tree() 7294 layer_tree_host_impl->active_tree()
7294 ->root_layer_for_testing() 7295 ->root_layer_for_testing()
7295 ->test_properties() 7296 ->test_properties()
7296 ->children[0] 7297 ->children[0]
7297 ->SetPosition(gfx::PointF()); 7298 ->SetPosition(gfx::PointF());
7298 layer_tree_host_impl->active_tree() 7299 layer_tree_host_impl->active_tree()
7299 ->root_layer_for_testing() 7300 ->root_layer_for_testing()
7300 ->test_properties() 7301 ->test_properties()
7301 ->children[0] 7302 ->children[0]
7302 ->NoteLayerPropertyChanged(); 7303 ->NoteLayerPropertyChanged();
7303 layer_tree_host_impl->active_tree()->BuildPropertyTreesForTesting(); 7304 layer_tree_host_impl->active_tree()->BuildPropertyTreesForTesting();
7304 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); 7305 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame));
7305 layer_tree_host_impl->DrawLayers(&frame); 7306 layer_tree_host_impl->DrawLayers(&frame);
7306 host_impl_->DidDrawAllLayers(frame); 7307 host_impl_->DidDrawAllLayers(frame);
7307 7308
7308 expected_swap_rect = gfx::Rect(26, 28); 7309 expected_swap_rect = gfx::Rect(26, 28);
7309 EXPECT_EQ(expected_swap_rect.ToString(), 7310 EXPECT_EQ(expected_swap_rect.ToString(),
7310 fake_output_surface->last_swap_rect().ToString()); 7311 fake_compositor_frame_sink->last_swap_rect().ToString());
7311 7312
7312 layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10)); 7313 layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10));
7313 // This will damage everything. 7314 // This will damage everything.
7314 layer_tree_host_impl->active_tree() 7315 layer_tree_host_impl->active_tree()
7315 ->root_layer_for_testing() 7316 ->root_layer_for_testing()
7316 ->SetBackgroundColor(SK_ColorBLACK); 7317 ->SetBackgroundColor(SK_ColorBLACK);
7317 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); 7318 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame));
7318 layer_tree_host_impl->DrawLayers(&frame); 7319 layer_tree_host_impl->DrawLayers(&frame);
7319 host_impl_->DidDrawAllLayers(frame); 7320 host_impl_->DidDrawAllLayers(frame);
7320 7321
7321 expected_swap_rect = gfx::Rect(10, 10); 7322 expected_swap_rect = gfx::Rect(10, 10);
7322 EXPECT_EQ(expected_swap_rect.ToString(), 7323 EXPECT_EQ(expected_swap_rect.ToString(),
7323 fake_output_surface->last_swap_rect().ToString()); 7324 fake_compositor_frame_sink->last_swap_rect().ToString());
7324 7325
7325 layer_tree_host_impl->ReleaseOutputSurface(); 7326 layer_tree_host_impl->ReleaseCompositorFrameSink();
7326 } 7327 }
7327 7328
7328 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { 7329 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) {
7329 std::unique_ptr<LayerImpl> root = 7330 std::unique_ptr<LayerImpl> root =
7330 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); 7331 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1);
7331 std::unique_ptr<LayerImpl> child = 7332 std::unique_ptr<LayerImpl> child =
7332 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 2); 7333 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 2);
7333 child->SetBounds(gfx::Size(10, 10)); 7334 child->SetBounds(gfx::Size(10, 10));
7334 child->SetDrawsContent(true); 7335 child->SetDrawsContent(true);
7335 root->SetBounds(gfx::Size(10, 10)); 7336 root->SetBounds(gfx::Size(10, 10));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
7375 }; 7376 };
7376 7377
7377 static std::unique_ptr<LayerTreeHostImpl> SetupLayersForOpacity( 7378 static std::unique_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
7378 LayerTreeSettings settings, 7379 LayerTreeSettings settings,
7379 bool partial_swap, 7380 bool partial_swap,
7380 LayerTreeHostImplClient* client, 7381 LayerTreeHostImplClient* client,
7381 TaskRunnerProvider* task_runner_provider, 7382 TaskRunnerProvider* task_runner_provider,
7382 SharedBitmapManager* manager, 7383 SharedBitmapManager* manager,
7383 TaskGraphRunner* task_graph_runner, 7384 TaskGraphRunner* task_graph_runner,
7384 RenderingStatsInstrumentation* stats_instrumentation, 7385 RenderingStatsInstrumentation* stats_instrumentation,
7385 OutputSurface* output_surface) { 7386 CompositorFrameSink* compositor_frame_sink) {
7386 settings.renderer_settings.partial_swap_enabled = partial_swap; 7387 settings.renderer_settings.partial_swap_enabled = partial_swap;
7387 std::unique_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create( 7388 std::unique_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create(
7388 settings, client, task_runner_provider, stats_instrumentation, manager, 7389 settings, client, task_runner_provider, stats_instrumentation, manager,
7389 nullptr, task_graph_runner, 7390 nullptr, task_graph_runner,
7390 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0); 7391 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0);
7391 my_host_impl->SetVisible(true); 7392 my_host_impl->SetVisible(true);
7392 my_host_impl->InitializeRenderer(output_surface); 7393 my_host_impl->InitializeRenderer(compositor_frame_sink);
7393 my_host_impl->WillBeginImplFrame( 7394 my_host_impl->WillBeginImplFrame(
7394 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 7395 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
7395 my_host_impl->SetViewportSize(gfx::Size(100, 100)); 7396 my_host_impl->SetViewportSize(gfx::Size(100, 100));
7396 7397
7397 /* 7398 /*
7398 Layers are created as follows: 7399 Layers are created as follows:
7399 7400
7400 +--------------------+ 7401 +--------------------+
7401 | 1 | 7402 | 1 |
7402 | +-----------+ | 7403 | +-----------+ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
7448 my_host_impl->active_tree()->BuildPropertyTreesForTesting(); 7449 my_host_impl->active_tree()->BuildPropertyTreesForTesting();
7449 return my_host_impl; 7450 return my_host_impl;
7450 } 7451 }
7451 7452
7452 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { 7453 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
7453 TestSharedBitmapManager shared_bitmap_manager; 7454 TestSharedBitmapManager shared_bitmap_manager;
7454 TestTaskGraphRunner task_graph_runner; 7455 TestTaskGraphRunner task_graph_runner;
7455 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); 7456 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create());
7456 provider->BindToCurrentThread(); 7457 provider->BindToCurrentThread();
7457 provider->TestContext3d()->set_have_post_sub_buffer(true); 7458 provider->TestContext3d()->set_have_post_sub_buffer(true);
7458 std::unique_ptr<OutputSurface> output_surface( 7459 std::unique_ptr<CompositorFrameSink> compositor_frame_sink(
7459 FakeOutputSurface::CreateDelegating3d(provider)); 7460 FakeCompositorFrameSink::Create3d(provider));
7460 std::unique_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( 7461 std::unique_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity(
7461 DefaultSettings(), true, this, &task_runner_provider_, 7462 DefaultSettings(), true, this, &task_runner_provider_,
7462 &shared_bitmap_manager, &task_graph_runner, &stats_instrumentation_, 7463 &shared_bitmap_manager, &task_graph_runner, &stats_instrumentation_,
7463 output_surface.get()); 7464 compositor_frame_sink.get());
7464 { 7465 {
7465 LayerTreeHostImpl::FrameData frame; 7466 LayerTreeHostImpl::FrameData frame;
7466 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); 7467 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
7467 7468
7468 // Verify all quads have been computed 7469 // Verify all quads have been computed
7469 ASSERT_EQ(2U, frame.render_passes.size()); 7470 ASSERT_EQ(2U, frame.render_passes.size());
7470 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 7471 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
7471 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 7472 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
7472 EXPECT_EQ(DrawQuad::SOLID_COLOR, 7473 EXPECT_EQ(DrawQuad::SOLID_COLOR,
7473 frame.render_passes[0]->quad_list.front()->material); 7474 frame.render_passes[0]->quad_list.front()->material);
7474 EXPECT_EQ(DrawQuad::RENDER_PASS, 7475 EXPECT_EQ(DrawQuad::RENDER_PASS,
7475 frame.render_passes[1]->quad_list.front()->material); 7476 frame.render_passes[1]->quad_list.front()->material);
7476 7477
7477 my_host_impl->DrawLayers(&frame); 7478 my_host_impl->DrawLayers(&frame);
7478 my_host_impl->DidDrawAllLayers(frame); 7479 my_host_impl->DidDrawAllLayers(frame);
7479 } 7480 }
7480 my_host_impl->ReleaseOutputSurface(); 7481 my_host_impl->ReleaseCompositorFrameSink();
7481 } 7482 }
7482 7483
7483 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { 7484 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) {
7484 TestSharedBitmapManager shared_bitmap_manager; 7485 TestSharedBitmapManager shared_bitmap_manager;
7485 TestTaskGraphRunner task_graph_runner; 7486 TestTaskGraphRunner task_graph_runner;
7486 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); 7487 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create());
7487 provider->BindToCurrentThread(); 7488 provider->BindToCurrentThread();
7488 provider->TestContext3d()->set_have_post_sub_buffer(true); 7489 provider->TestContext3d()->set_have_post_sub_buffer(true);
7489 std::unique_ptr<OutputSurface> output_surface( 7490 std::unique_ptr<CompositorFrameSink> compositor_frame_sink(
7490 FakeOutputSurface::CreateDelegating3d(provider)); 7491 FakeCompositorFrameSink::Create3d(provider));
7491 std::unique_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( 7492 std::unique_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity(
7492 DefaultSettings(), false, this, &task_runner_provider_, 7493 DefaultSettings(), false, this, &task_runner_provider_,
7493 &shared_bitmap_manager, &task_graph_runner, &stats_instrumentation_, 7494 &shared_bitmap_manager, &task_graph_runner, &stats_instrumentation_,
7494 output_surface.get()); 7495 compositor_frame_sink.get());
7495 { 7496 {
7496 LayerTreeHostImpl::FrameData frame; 7497 LayerTreeHostImpl::FrameData frame;
7497 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); 7498 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
7498 7499
7499 // Verify all quads have been computed 7500 // Verify all quads have been computed
7500 ASSERT_EQ(2U, frame.render_passes.size()); 7501 ASSERT_EQ(2U, frame.render_passes.size());
7501 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 7502 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
7502 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 7503 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
7503 EXPECT_EQ(DrawQuad::SOLID_COLOR, 7504 EXPECT_EQ(DrawQuad::SOLID_COLOR,
7504 frame.render_passes[0]->quad_list.front()->material); 7505 frame.render_passes[0]->quad_list.front()->material);
7505 EXPECT_EQ(DrawQuad::RENDER_PASS, 7506 EXPECT_EQ(DrawQuad::RENDER_PASS,
7506 frame.render_passes[1]->quad_list.front()->material); 7507 frame.render_passes[1]->quad_list.front()->material);
7507 7508
7508 my_host_impl->DrawLayers(&frame); 7509 my_host_impl->DrawLayers(&frame);
7509 my_host_impl->DidDrawAllLayers(frame); 7510 my_host_impl->DidDrawAllLayers(frame);
7510 } 7511 }
7511 my_host_impl->ReleaseOutputSurface(); 7512 my_host_impl->ReleaseCompositorFrameSink();
7512 } 7513 }
7513 7514
7514 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { 7515 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
7515 std::unique_ptr<TestWebGraphicsContext3D> context = 7516 std::unique_ptr<TestWebGraphicsContext3D> context =
7516 TestWebGraphicsContext3D::Create(); 7517 TestWebGraphicsContext3D::Create();
7517 TestWebGraphicsContext3D* context3d = context.get(); 7518 TestWebGraphicsContext3D* context3d = context.get();
7518 std::unique_ptr<OutputSurface> output_surface( 7519 std::unique_ptr<CompositorFrameSink> compositor_frame_sink(
7519 FakeOutputSurface::CreateDelegating3d(std::move(context))); 7520 FakeCompositorFrameSink::Create3d(std::move(context)));
7520 CreateHostImpl(DefaultSettings(), std::move(output_surface)); 7521 CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink));
7521 7522
7522 std::unique_ptr<LayerImpl> root_layer = 7523 std::unique_ptr<LayerImpl> root_layer =
7523 LayerImpl::Create(host_impl_->active_tree(), 1); 7524 LayerImpl::Create(host_impl_->active_tree(), 1);
7524 root_layer->SetBounds(gfx::Size(10, 10)); 7525 root_layer->SetBounds(gfx::Size(10, 10));
7525 root_layer->test_properties()->force_render_surface = true; 7526 root_layer->test_properties()->force_render_surface = true;
7526 7527
7527 scoped_refptr<VideoFrame> softwareFrame = 7528 scoped_refptr<VideoFrame> softwareFrame =
7528 media::VideoFrame::CreateColorFrame( 7529 media::VideoFrame::CreateColorFrame(
7529 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); 7530 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
7530 FakeVideoFrameProvider provider; 7531 FakeVideoFrameProvider provider;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
7588 host_impl_->SetFullViewportDamage(); 7589 host_impl_->SetFullViewportDamage();
7589 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 7590 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
7590 { 7591 {
7591 const auto& root_pass = frame.render_passes.back(); 7592 const auto& root_pass = frame.render_passes.back();
7592 ASSERT_EQ(0u, root_pass->quad_list.size()); 7593 ASSERT_EQ(0u, root_pass->quad_list.size());
7593 } 7594 }
7594 host_impl_->DrawLayers(&frame); 7595 host_impl_->DrawLayers(&frame);
7595 host_impl_->DidDrawAllLayers(frame); 7596 host_impl_->DidDrawAllLayers(frame);
7596 } 7597 }
7597 7598
7598 class LayerTreeHostImplTestWithDelegatingRenderer 7599 class LayerTreeHostImplTestDrawAndTestDamage : public LayerTreeHostImplTest {
7599 : public LayerTreeHostImplTest {
7600 protected: 7600 protected:
7601 std::unique_ptr<OutputSurface> CreateOutputSurface() override { 7601 std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override {
7602 return FakeOutputSurface::CreateDelegating3d(); 7602 return FakeCompositorFrameSink::Create3d();
7603 } 7603 }
7604 7604
7605 void DrawFrameAndTestDamage(const gfx::Rect& expected_damage) { 7605 void DrawFrameAndTestDamage(const gfx::Rect& expected_damage) {
7606 bool expect_to_draw = !expected_damage.IsEmpty(); 7606 bool expect_to_draw = !expected_damage.IsEmpty();
7607 7607
7608 LayerTreeHostImpl::FrameData frame; 7608 LayerTreeHostImpl::FrameData frame;
7609 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 7609 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
7610 7610
7611 if (!expect_to_draw) { 7611 if (!expect_to_draw) {
7612 // With no damage, we don't draw, and no quads are created. 7612 // With no damage, we don't draw, and no quads are created.
(...skipping 21 matching lines...) Expand all
7634 gfx::Rect expected_root_visible_rect(root->bounds()); 7634 gfx::Rect expected_root_visible_rect(root->bounds());
7635 EXPECT_EQ(expected_root_visible_rect, 7635 EXPECT_EQ(expected_root_visible_rect,
7636 root_render_pass->quad_list.ElementAt(1)->visible_rect); 7636 root_render_pass->quad_list.ElementAt(1)->visible_rect);
7637 } 7637 }
7638 7638
7639 EXPECT_EQ(expect_to_draw, host_impl_->DrawLayers(&frame)); 7639 EXPECT_EQ(expect_to_draw, host_impl_->DrawLayers(&frame));
7640 host_impl_->DidDrawAllLayers(frame); 7640 host_impl_->DidDrawAllLayers(frame);
7641 } 7641 }
7642 }; 7642 };
7643 7643
7644 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { 7644 TEST_F(LayerTreeHostImplTestDrawAndTestDamage, FrameIncludesDamageRect) {
7645 std::unique_ptr<SolidColorLayerImpl> root = 7645 std::unique_ptr<SolidColorLayerImpl> root =
7646 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); 7646 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
7647 root->SetPosition(gfx::PointF()); 7647 root->SetPosition(gfx::PointF());
7648 root->SetBounds(gfx::Size(10, 10)); 7648 root->SetBounds(gfx::Size(10, 10));
7649 root->SetDrawsContent(true); 7649 root->SetDrawsContent(true);
7650 root->test_properties()->force_render_surface = true; 7650 root->test_properties()->force_render_surface = true;
7651 7651
7652 // Child layer is in the bottom right corner. 7652 // Child layer is in the bottom right corner.
7653 std::unique_ptr<SolidColorLayerImpl> child = 7653 std::unique_ptr<SolidColorLayerImpl> child =
7654 SolidColorLayerImpl::Create(host_impl_->active_tree(), 2); 7654 SolidColorLayerImpl::Create(host_impl_->active_tree(), 2);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
7796 ++frames_ended_; 7796 ++frames_ended_;
7797 } 7797 }
7798 7798
7799 int frames_began_, frames_ended_; 7799 int frames_began_, frames_ended_;
7800 }; 7800 };
7801 7801
7802 TEST_F(LayerTreeHostImplTest, 7802 TEST_F(LayerTreeHostImplTest,
7803 ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) { 7803 ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) {
7804 set_reduce_memory_result(false); 7804 set_reduce_memory_result(false);
7805 EXPECT_TRUE(CreateHostImpl(DefaultSettings(), 7805 EXPECT_TRUE(CreateHostImpl(DefaultSettings(),
7806 FakeOutputSurface::CreateDelegatingSoftware())); 7806 FakeCompositorFrameSink::CreateSoftware()));
7807 7807
7808 const gfx::Transform external_transform; 7808 const gfx::Transform external_transform;
7809 const gfx::Rect external_viewport; 7809 const gfx::Rect external_viewport;
7810 const bool resourceless_software_draw = true; 7810 const bool resourceless_software_draw = true;
7811 host_impl_->SetExternalTilePriorityConstraints(external_viewport, 7811 host_impl_->SetExternalTilePriorityConstraints(external_viewport,
7812 external_transform); 7812 external_transform);
7813 7813
7814 // SolidColorLayerImpl will be drawn. 7814 // SolidColorLayerImpl will be drawn.
7815 std::unique_ptr<SolidColorLayerImpl> root_layer = 7815 std::unique_ptr<SolidColorLayerImpl> root_layer =
7816 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); 7816 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
(...skipping 11 matching lines...) Expand all
7828 host_impl_->OnDraw(external_transform, external_viewport, 7828 host_impl_->OnDraw(external_transform, external_viewport,
7829 resourceless_software_draw); 7829 resourceless_software_draw);
7830 7830
7831 EXPECT_EQ(1u, last_on_draw_frame_->will_draw_layers.size()); 7831 EXPECT_EQ(1u, last_on_draw_frame_->will_draw_layers.size());
7832 EXPECT_EQ(host_impl_->active_tree()->root_layer_for_testing(), 7832 EXPECT_EQ(host_impl_->active_tree()->root_layer_for_testing(),
7833 last_on_draw_frame_->will_draw_layers[0]); 7833 last_on_draw_frame_->will_draw_layers[0]);
7834 } 7834 }
7835 7835
7836 // Checks that we use the memory limits provided. 7836 // Checks that we use the memory limits provided.
7837 TEST_F(LayerTreeHostImplTest, MemoryLimits) { 7837 TEST_F(LayerTreeHostImplTest, MemoryLimits) {
7838 host_impl_->ReleaseOutputSurface(); 7838 host_impl_->ReleaseCompositorFrameSink();
7839 host_impl_ = nullptr; 7839 host_impl_ = nullptr;
7840 7840
7841 const size_t kGpuByteLimit = 1234321; 7841 const size_t kGpuByteLimit = 1234321;
7842 const size_t kSoftwareByteLimit = 4321234; 7842 const size_t kSoftwareByteLimit = 4321234;
7843 const size_t kGpuResourceLimit = 2345432; 7843 const size_t kGpuResourceLimit = 2345432;
7844 const size_t kSoftwareResourceLimit = 5432345; 7844 const size_t kSoftwareResourceLimit = 5432345;
7845 const gpu::MemoryAllocation::PriorityCutoff kGpuCutoff = 7845 const gpu::MemoryAllocation::PriorityCutoff kGpuCutoff =
7846 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING; 7846 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING;
7847 const gpu::MemoryAllocation::PriorityCutoff kSoftwareCutoff = 7847 const gpu::MemoryAllocation::PriorityCutoff kSoftwareCutoff =
7848 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 7848 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
(...skipping 13 matching lines...) Expand all
7862 settings.gpu_memory_policy = 7862 settings.gpu_memory_policy =
7863 ManagedMemoryPolicy(kGpuByteLimit, kGpuCutoff, kGpuResourceLimit); 7863 ManagedMemoryPolicy(kGpuByteLimit, kGpuCutoff, kGpuResourceLimit);
7864 settings.software_memory_policy = ManagedMemoryPolicy( 7864 settings.software_memory_policy = ManagedMemoryPolicy(
7865 kSoftwareByteLimit, kSoftwareCutoff, kSoftwareResourceLimit); 7865 kSoftwareByteLimit, kSoftwareCutoff, kSoftwareResourceLimit);
7866 host_impl_ = LayerTreeHostImpl::Create( 7866 host_impl_ = LayerTreeHostImpl::Create(
7867 settings, this, &task_runner_provider_, &stats_instrumentation_, 7867 settings, this, &task_runner_provider_, &stats_instrumentation_,
7868 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, &task_graph_runner_, 7868 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, &task_graph_runner_,
7869 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0); 7869 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0);
7870 7870
7871 // Gpu compositing. 7871 // Gpu compositing.
7872 output_surface_ = 7872 compositor_frame_sink_ =
7873 FakeOutputSurface::CreateDelegating3d(TestWebGraphicsContext3D::Create()); 7873 FakeCompositorFrameSink::Create3d(TestWebGraphicsContext3D::Create());
7874 host_impl_->SetVisible(true); 7874 host_impl_->SetVisible(true);
7875 host_impl_->InitializeRenderer(output_surface_.get()); 7875 host_impl_->InitializeRenderer(compositor_frame_sink_.get());
7876 { 7876 {
7877 const auto& state = host_impl_->global_tile_state(); 7877 const auto& state = host_impl_->global_tile_state();
7878 EXPECT_EQ(kGpuByteLimit, state.hard_memory_limit_in_bytes); 7878 EXPECT_EQ(kGpuByteLimit, state.hard_memory_limit_in_bytes);
7879 EXPECT_EQ(kGpuResourceLimit, state.num_resources_limit); 7879 EXPECT_EQ(kGpuResourceLimit, state.num_resources_limit);
7880 EXPECT_EQ(kGpuTileCutoff, state.memory_limit_policy); 7880 EXPECT_EQ(kGpuTileCutoff, state.memory_limit_policy);
7881 } 7881 }
7882 7882
7883 // Not visible, drops to 0. 7883 // Not visible, drops to 0.
7884 host_impl_->SetVisible(false); 7884 host_impl_->SetVisible(false);
7885 { 7885 {
7886 const auto& state = host_impl_->global_tile_state(); 7886 const auto& state = host_impl_->global_tile_state();
7887 EXPECT_EQ(0u, state.hard_memory_limit_in_bytes); 7887 EXPECT_EQ(0u, state.hard_memory_limit_in_bytes);
7888 EXPECT_EQ(kGpuResourceLimit, state.num_resources_limit); 7888 EXPECT_EQ(kGpuResourceLimit, state.num_resources_limit);
7889 EXPECT_EQ(kNothingTileCutoff, state.memory_limit_policy); 7889 EXPECT_EQ(kNothingTileCutoff, state.memory_limit_policy);
7890 } 7890 }
7891 7891
7892 // Visible, is the gpu limit again. 7892 // Visible, is the gpu limit again.
7893 host_impl_->SetVisible(true); 7893 host_impl_->SetVisible(true);
7894 { 7894 {
7895 const auto& state = host_impl_->global_tile_state(); 7895 const auto& state = host_impl_->global_tile_state();
7896 EXPECT_EQ(kGpuByteLimit, state.hard_memory_limit_in_bytes); 7896 EXPECT_EQ(kGpuByteLimit, state.hard_memory_limit_in_bytes);
7897 EXPECT_EQ(kGpuResourceLimit, state.num_resources_limit); 7897 EXPECT_EQ(kGpuResourceLimit, state.num_resources_limit);
7898 } 7898 }
7899 7899
7900 // Software compositing. 7900 // Software compositing.
7901 host_impl_->ReleaseOutputSurface(); 7901 host_impl_->ReleaseCompositorFrameSink();
7902 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware(); 7902 compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware();
7903 host_impl_->InitializeRenderer(output_surface_.get()); 7903 host_impl_->InitializeRenderer(compositor_frame_sink_.get());
7904 { 7904 {
7905 const auto& state = host_impl_->global_tile_state(); 7905 const auto& state = host_impl_->global_tile_state();
7906 EXPECT_EQ(kSoftwareByteLimit, state.hard_memory_limit_in_bytes); 7906 EXPECT_EQ(kSoftwareByteLimit, state.hard_memory_limit_in_bytes);
7907 EXPECT_EQ(kSoftwareResourceLimit, state.num_resources_limit); 7907 EXPECT_EQ(kSoftwareResourceLimit, state.num_resources_limit);
7908 EXPECT_EQ(kSoftwareTileCutoff, state.memory_limit_policy); 7908 EXPECT_EQ(kSoftwareTileCutoff, state.memory_limit_policy);
7909 } 7909 }
7910 7910
7911 // Not visible, drops to 0. 7911 // Not visible, drops to 0.
7912 host_impl_->SetVisible(false); 7912 host_impl_->SetVisible(false);
7913 { 7913 {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
7977 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); 7977 EXPECT_TRUE(host_impl_->RequiresHighResToDraw());
7978 } 7978 }
7979 7979
7980 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { 7980 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest {
7981 public: 7981 public:
7982 void SetUp() override { 7982 void SetUp() override {
7983 fake_host_impl_ = 7983 fake_host_impl_ =
7984 new FakeLayerTreeHostImpl(LayerTreeSettings(), &task_runner_provider_, 7984 new FakeLayerTreeHostImpl(LayerTreeSettings(), &task_runner_provider_,
7985 &shared_bitmap_manager_, &task_graph_runner_); 7985 &shared_bitmap_manager_, &task_graph_runner_);
7986 host_impl_.reset(fake_host_impl_); 7986 host_impl_.reset(fake_host_impl_);
7987 output_surface_ = CreateOutputSurface(); 7987 compositor_frame_sink_ = CreateCompositorFrameSink();
7988 host_impl_->SetVisible(true); 7988 host_impl_->SetVisible(true);
7989 host_impl_->InitializeRenderer(output_surface_.get()); 7989 host_impl_->InitializeRenderer(compositor_frame_sink_.get());
7990 host_impl_->SetViewportSize(gfx::Size(10, 10)); 7990 host_impl_->SetViewportSize(gfx::Size(10, 10));
7991 } 7991 }
7992 7992
7993 FakeLayerTreeHostImpl* fake_host_impl_; 7993 FakeLayerTreeHostImpl* fake_host_impl_;
7994 }; 7994 };
7995 7995
7996 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { 7996 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) {
7997 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); 7997 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed());
7998 host_impl_->SetVisible(false); 7998 host_impl_->SetVisible(false);
7999 EXPECT_FALSE(fake_host_impl_->prepare_tiles_needed()); 7999 EXPECT_FALSE(fake_host_impl_->prepare_tiles_needed());
8000 host_impl_->SetVisible(true); 8000 host_impl_->SetVisible(true);
8001 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); 8001 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed());
8002 } 8002 }
8003 8003
8004 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { 8004 TEST_F(LayerTreeHostImplTest, UIResourceManagement) {
8005 std::unique_ptr<TestWebGraphicsContext3D> context = 8005 std::unique_ptr<TestWebGraphicsContext3D> context =
8006 TestWebGraphicsContext3D::Create(); 8006 TestWebGraphicsContext3D::Create();
8007 TestWebGraphicsContext3D* context3d = context.get(); 8007 TestWebGraphicsContext3D* context3d = context.get();
8008 std::unique_ptr<FakeOutputSurface> output_surface = 8008 std::unique_ptr<FakeCompositorFrameSink> compositor_frame_sink =
8009 FakeOutputSurface::CreateDelegating3d(); 8009 FakeCompositorFrameSink::Create3d();
8010 CreateHostImpl(DefaultSettings(), std::move(output_surface)); 8010 CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink));
8011 8011
8012 EXPECT_EQ(0u, context3d->NumTextures()); 8012 EXPECT_EQ(0u, context3d->NumTextures());
8013 8013
8014 UIResourceId ui_resource_id = 1; 8014 UIResourceId ui_resource_id = 1;
8015 bool is_opaque = false; 8015 bool is_opaque = false;
8016 UIResourceBitmap bitmap(gfx::Size(1, 1), is_opaque); 8016 UIResourceBitmap bitmap(gfx::Size(1, 1), is_opaque);
8017 host_impl_->CreateUIResource(ui_resource_id, bitmap); 8017 host_impl_->CreateUIResource(ui_resource_id, bitmap);
8018 EXPECT_EQ(1u, context3d->NumTextures()); 8018 EXPECT_EQ(1u, context3d->NumTextures());
8019 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id); 8019 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id);
8020 EXPECT_NE(0u, id1); 8020 EXPECT_NE(0u, id1);
(...skipping 21 matching lines...) Expand all
8042 8042
8043 // Should not change state for multiple deletion on one UIResourceId 8043 // Should not change state for multiple deletion on one UIResourceId
8044 host_impl_->DeleteUIResource(ui_resource_id); 8044 host_impl_->DeleteUIResource(ui_resource_id);
8045 EXPECT_EQ(0u, context3d->NumTextures()); 8045 EXPECT_EQ(0u, context3d->NumTextures());
8046 } 8046 }
8047 8047
8048 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) { 8048 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) {
8049 std::unique_ptr<TestWebGraphicsContext3D> context = 8049 std::unique_ptr<TestWebGraphicsContext3D> context =
8050 TestWebGraphicsContext3D::Create(); 8050 TestWebGraphicsContext3D::Create();
8051 TestWebGraphicsContext3D* context3d = context.get(); 8051 TestWebGraphicsContext3D* context3d = context.get();
8052 CreateHostImpl(DefaultSettings(), FakeOutputSurface::CreateDelegating3d()); 8052 CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::Create3d());
8053 8053
8054 EXPECT_EQ(0u, context3d->NumTextures()); 8054 EXPECT_EQ(0u, context3d->NumTextures());
8055 8055
8056 gfx::Size size(4, 4); 8056 gfx::Size size(4, 4);
8057 // SkImageInfo has no support for ETC1. The |info| below contains the right 8057 // SkImageInfo has no support for ETC1. The |info| below contains the right
8058 // total pixel size for the bitmap but not the right height and width. The 8058 // total pixel size for the bitmap but not the right height and width. The
8059 // correct width/height are passed directly to UIResourceBitmap. 8059 // correct width/height are passed directly to UIResourceBitmap.
8060 SkImageInfo info = 8060 SkImageInfo info =
8061 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType); 8061 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType);
8062 sk_sp<SkPixelRef> pixel_ref(SkMallocPixelRef::NewAllocate(info, 0, 0)); 8062 sk_sp<SkPixelRef> pixel_ref(SkMallocPixelRef::NewAllocate(info, 0, 0));
8063 pixel_ref->setImmutable(); 8063 pixel_ref->setImmutable();
8064 UIResourceBitmap bitmap(std::move(pixel_ref), size); 8064 UIResourceBitmap bitmap(std::move(pixel_ref), size);
8065 UIResourceId ui_resource_id = 1; 8065 UIResourceId ui_resource_id = 1;
8066 host_impl_->CreateUIResource(ui_resource_id, bitmap); 8066 host_impl_->CreateUIResource(ui_resource_id, bitmap);
8067 EXPECT_EQ(1u, context3d->NumTextures()); 8067 EXPECT_EQ(1u, context3d->NumTextures());
8068 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id); 8068 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id);
8069 EXPECT_NE(0u, id1); 8069 EXPECT_NE(0u, id1);
8070 } 8070 }
8071 8071
8072 void ShutdownReleasesContext_Callback( 8072 void ShutdownReleasesContext_Callback(
8073 std::unique_ptr<CopyOutputResult> result) {} 8073 std::unique_ptr<CopyOutputResult> result) {}
8074 8074
8075 TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) { 8075 TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) {
8076 scoped_refptr<TestContextProvider> context_provider = 8076 scoped_refptr<TestContextProvider> context_provider =
8077 TestContextProvider::Create(); 8077 TestContextProvider::Create();
8078 8078
8079 CreateHostImpl( 8079 CreateHostImpl(
8080 DefaultSettings(), 8080 DefaultSettings(),
8081 base::MakeUnique<TestDelegatingOutputSurface>( 8081 base::MakeUnique<TestCompositorFrameSink>(
8082 context_provider, TestContextProvider::CreateWorker(), 8082 context_provider, TestContextProvider::CreateWorker(),
8083 FakeOutputSurface::Create3d(context_provider), nullptr, nullptr, 8083 FakeOutputSurface::Create3d(context_provider), nullptr, nullptr,
8084 RendererSettings(), base::ThreadTaskRunnerHandle::Get().get(), 8084 RendererSettings(), base::ThreadTaskRunnerHandle::Get().get(),
8085 true /* synchronous_composite */, 8085 true /* synchronous_composite */,
8086 false /* force_disable_reclaim_resources */)); 8086 false /* force_disable_reclaim_resources */));
8087 8087
8088 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); 8088 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
8089 8089
8090 LayerImpl* root = host_impl_->active_tree()->root_layer_for_testing(); 8090 LayerImpl* root = host_impl_->active_tree()->root_layer_for_testing();
8091 root->test_properties()->copy_requests.push_back( 8091 root->test_properties()->copy_requests.push_back(
8092 CopyOutputRequest::CreateRequest( 8092 CopyOutputRequest::CreateRequest(
8093 base::Bind(&ShutdownReleasesContext_Callback))); 8093 base::Bind(&ShutdownReleasesContext_Callback)));
8094 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 8094 host_impl_->active_tree()->BuildPropertyTreesForTesting();
8095 8095
8096 LayerTreeHostImpl::FrameData frame; 8096 LayerTreeHostImpl::FrameData frame;
8097 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 8097 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
8098 host_impl_->DrawLayers(&frame); 8098 host_impl_->DrawLayers(&frame);
8099 host_impl_->DidDrawAllLayers(frame); 8099 host_impl_->DidDrawAllLayers(frame);
8100 8100
8101 // The CopyOutputResult's callback has a ref on the ContextProvider and a 8101 // The CopyOutputResult's callback has a ref on the ContextProvider and a
8102 // texture in a texture mailbox. 8102 // texture in a texture mailbox.
8103 EXPECT_FALSE(context_provider->HasOneRef()); 8103 EXPECT_FALSE(context_provider->HasOneRef());
8104 EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures()); 8104 EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures());
8105 8105
8106 host_impl_->ReleaseOutputSurface(); 8106 host_impl_->ReleaseCompositorFrameSink();
8107 host_impl_ = nullptr; 8107 host_impl_ = nullptr;
8108 8108
8109 // The CopyOutputResult's callback was cancelled, the CopyOutputResult 8109 // The CopyOutputResult's callback was cancelled, the CopyOutputResult
8110 // released, and the texture deleted. 8110 // released, and the texture deleted.
8111 EXPECT_TRUE(context_provider->HasOneRef()); 8111 EXPECT_TRUE(context_provider->HasOneRef());
8112 EXPECT_EQ(0u, context_provider->TestContext3d()->NumTextures()); 8112 EXPECT_EQ(0u, context_provider->TestContext3d()->NumTextures());
8113 } 8113 }
8114 8114
8115 TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) { 8115 TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) {
8116 // When flinging via touch, only the child should scroll (we should not 8116 // When flinging via touch, only the child should scroll (we should not
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
8527 std::unique_ptr<SolidColorLayerImpl> root = 8527 std::unique_ptr<SolidColorLayerImpl> root =
8528 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); 8528 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
8529 root->SetPosition(gfx::PointF()); 8529 root->SetPosition(gfx::PointF());
8530 root->SetBounds(gfx::Size(10, 10)); 8530 root->SetBounds(gfx::Size(10, 10));
8531 root->SetDrawsContent(true); 8531 root->SetDrawsContent(true);
8532 root->test_properties()->force_render_surface = true; 8532 root->test_properties()->force_render_surface = true;
8533 8533
8534 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); 8534 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root));
8535 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 8535 host_impl_->active_tree()->BuildPropertyTreesForTesting();
8536 8536
8537 FakeOutputSurface* fake_output_surface = 8537 FakeCompositorFrameSink* fake_compositor_frame_sink =
8538 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); 8538 static_cast<FakeCompositorFrameSink*>(
8539 host_impl_->compositor_frame_sink());
8539 8540
8540 ui::LatencyInfo latency_info; 8541 ui::LatencyInfo latency_info;
8541 latency_info.AddLatencyNumber( 8542 latency_info.AddLatencyNumber(
8542 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0); 8543 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0);
8543 std::unique_ptr<SwapPromise> swap_promise( 8544 std::unique_ptr<SwapPromise> swap_promise(
8544 new LatencyInfoSwapPromise(latency_info)); 8545 new LatencyInfoSwapPromise(latency_info));
8545 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); 8546 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise));
8546 8547
8547 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); 8548 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
8548 LayerTreeHostImpl::FrameData frame; 8549 LayerTreeHostImpl::FrameData frame;
8549 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 8550 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
8550 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); 8551 EXPECT_TRUE(host_impl_->DrawLayers(&frame));
8551 host_impl_->DidDrawAllLayers(frame); 8552 host_impl_->DidDrawAllLayers(frame);
8552 8553
8553 const std::vector<ui::LatencyInfo>& metadata_latency_after = 8554 const std::vector<ui::LatencyInfo>& metadata_latency_after =
8554 fake_output_surface->last_sent_frame()->metadata.latency_info; 8555 fake_compositor_frame_sink->last_sent_frame()->metadata.latency_info;
8555 EXPECT_EQ(1u, metadata_latency_after.size()); 8556 EXPECT_EQ(1u, metadata_latency_after.size());
8556 EXPECT_TRUE(metadata_latency_after[0].FindLatency( 8557 EXPECT_TRUE(metadata_latency_after[0].FindLatency(
8557 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); 8558 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
8558 } 8559 }
8559 8560
8560 TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) { 8561 TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
8561 int root_layer_id = 1; 8562 int root_layer_id = 1;
8562 std::unique_ptr<SolidColorLayerImpl> root = 8563 std::unique_ptr<SolidColorLayerImpl> root =
8563 SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id); 8564 SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id);
8564 root->SetPosition(gfx::PointF()); 8565 root->SetPosition(gfx::PointF());
8565 root->SetBounds(gfx::Size(10, 10)); 8566 root->SetBounds(gfx::Size(10, 10));
8566 root->SetDrawsContent(true); 8567 root->SetDrawsContent(true);
8567 root->test_properties()->force_render_surface = true; 8568 root->test_properties()->force_render_surface = true;
8568 8569
8569 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); 8570 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root));
8570 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 8571 host_impl_->active_tree()->BuildPropertyTreesForTesting();
8571 8572
8572 // Ensure the default frame selection bounds are empty. 8573 // Ensure the default frame selection bounds are empty.
8573 FakeOutputSurface* fake_output_surface = 8574 FakeCompositorFrameSink* fake_compositor_frame_sink =
8574 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); 8575 static_cast<FakeCompositorFrameSink*>(
8576 host_impl_->compositor_frame_sink());
8575 8577
8576 // Plumb the layer-local selection bounds. 8578 // Plumb the layer-local selection bounds.
8577 gfx::Point selection_top(5, 0); 8579 gfx::Point selection_top(5, 0);
8578 gfx::Point selection_bottom(5, 5); 8580 gfx::Point selection_bottom(5, 5);
8579 LayerSelection selection; 8581 LayerSelection selection;
8580 selection.start.type = gfx::SelectionBound::CENTER; 8582 selection.start.type = gfx::SelectionBound::CENTER;
8581 selection.start.layer_id = root_layer_id; 8583 selection.start.layer_id = root_layer_id;
8582 selection.start.edge_bottom = selection_bottom; 8584 selection.start.edge_bottom = selection_bottom;
8583 selection.start.edge_top = selection_top; 8585 selection.start.edge_top = selection_top;
8584 selection.end = selection.start; 8586 selection.end = selection.start;
8585 host_impl_->active_tree()->RegisterSelection(selection); 8587 host_impl_->active_tree()->RegisterSelection(selection);
8586 8588
8587 // Trigger a draw-swap sequence. 8589 // Trigger a draw-swap sequence.
8588 host_impl_->SetNeedsRedraw(); 8590 host_impl_->SetNeedsRedraw();
8589 8591
8590 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); 8592 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
8591 LayerTreeHostImpl::FrameData frame; 8593 LayerTreeHostImpl::FrameData frame;
8592 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 8594 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
8593 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); 8595 EXPECT_TRUE(host_impl_->DrawLayers(&frame));
8594 host_impl_->DidDrawAllLayers(frame); 8596 host_impl_->DidDrawAllLayers(frame);
8595 8597
8596 // Ensure the selection bounds have propagated to the frame metadata. 8598 // Ensure the selection bounds have propagated to the frame metadata.
8597 const Selection<gfx::SelectionBound>& selection_after = 8599 const Selection<gfx::SelectionBound>& selection_after =
8598 fake_output_surface->last_sent_frame()->metadata.selection; 8600 fake_compositor_frame_sink->last_sent_frame()->metadata.selection;
8599 EXPECT_EQ(selection.start.type, selection_after.start.type()); 8601 EXPECT_EQ(selection.start.type, selection_after.start.type());
8600 EXPECT_EQ(selection.end.type, selection_after.end.type()); 8602 EXPECT_EQ(selection.end.type, selection_after.end.type());
8601 EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom()); 8603 EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom());
8602 EXPECT_EQ(gfx::PointF(selection_top), selection_after.start.edge_top()); 8604 EXPECT_EQ(gfx::PointF(selection_top), selection_after.start.edge_top());
8603 EXPECT_TRUE(selection_after.start.visible()); 8605 EXPECT_TRUE(selection_after.start.visible());
8604 EXPECT_TRUE(selection_after.start.visible()); 8606 EXPECT_TRUE(selection_after.start.visible());
8605 } 8607 }
8606 8608
8607 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { 8609 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
8608 public: 8610 public:
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
8724 EXPECT_EQ(0, set_needs_commit_count); 8726 EXPECT_EQ(0, set_needs_commit_count);
8725 EXPECT_EQ(2, set_needs_redraw_count); 8727 EXPECT_EQ(2, set_needs_redraw_count);
8726 EXPECT_EQ(1, forward_to_main_count); 8728 EXPECT_EQ(1, forward_to_main_count);
8727 } 8729 }
8728 } 8730 }
8729 8731
8730 class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest { 8732 class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest {
8731 public: 8733 public:
8732 void SetUp() override { 8734 void SetUp() override {
8733 LayerTreeSettings settings = DefaultSettings(); 8735 LayerTreeSettings settings = DefaultSettings();
8734 CreateHostImpl(settings, CreateOutputSurface()); 8736 CreateHostImpl(settings, CreateCompositorFrameSink());
8735 host_impl_->active_tree()->set_top_controls_height(top_controls_height_); 8737 host_impl_->active_tree()->set_top_controls_height(top_controls_height_);
8736 host_impl_->sync_tree()->set_top_controls_height(top_controls_height_); 8738 host_impl_->sync_tree()->set_top_controls_height(top_controls_height_);
8737 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f); 8739 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f);
8738 } 8740 }
8739 8741
8740 protected: 8742 protected:
8741 static const int top_controls_height_; 8743 static const int top_controls_height_;
8742 }; 8744 };
8743 8745
8744 const int LayerTreeHostImplWithTopControlsTest::top_controls_height_ = 50; 8746 const int LayerTreeHostImplWithTopControlsTest::top_controls_height_ = 50;
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
9635 // When inner viewport is unscrollable, a fling gives zero overscroll. 9637 // When inner viewport is unscrollable, a fling gives zero overscroll.
9636 EXPECT_FALSE(scroll_result.did_overscroll_root); 9638 EXPECT_FALSE(scroll_result.did_overscroll_root);
9637 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll()); 9639 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
9638 } 9640 }
9639 9641
9640 class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest { 9642 class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest {
9641 public: 9643 public:
9642 void SetUp() override { 9644 void SetUp() override {
9643 LayerTreeSettings settings = DefaultSettings(); 9645 LayerTreeSettings settings = DefaultSettings();
9644 settings.max_memory_for_prepaint_percentage = 50; 9646 settings.max_memory_for_prepaint_percentage = 50;
9645 CreateHostImpl(settings, CreateOutputSurface()); 9647 CreateHostImpl(settings, CreateCompositorFrameSink());
9646 } 9648 }
9647 }; 9649 };
9648 9650
9649 TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) { 9651 TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) {
9650 // Set up a memory policy and percentages which could cause 9652 // Set up a memory policy and percentages which could cause
9651 // 32-bit integer overflows. 9653 // 32-bit integer overflows.
9652 ManagedMemoryPolicy mem_policy(300 * 1024 * 1024); // 300MB 9654 ManagedMemoryPolicy mem_policy(300 * 1024 * 1024); // 300MB
9653 9655
9654 // Verify implicit limits are calculated correctly with no overflows 9656 // Verify implicit limits are calculated correctly with no overflows
9655 host_impl_->SetMemoryPolicy(mem_policy); 9657 host_impl_->SetMemoryPolicy(mem_policy);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
9740 // Different draw params does swap. 9742 // Different draw params does swap.
9741 did_request_redraw_ = false; 9743 did_request_redraw_ = false;
9742 host_impl_->OnDraw(draw_transform, draw_viewport2, 9744 host_impl_->OnDraw(draw_transform, draw_viewport2,
9743 resourceless_software_draw); 9745 resourceless_software_draw);
9744 EXPECT_TRUE(did_request_redraw_); 9746 EXPECT_TRUE(did_request_redraw_);
9745 EXPECT_FALSE(last_on_draw_frame_->has_no_damage); 9747 EXPECT_FALSE(last_on_draw_frame_->has_no_damage);
9746 } 9748 }
9747 9749
9748 class ResourcelessSoftwareLayerTreeHostImplTest : public LayerTreeHostImplTest { 9750 class ResourcelessSoftwareLayerTreeHostImplTest : public LayerTreeHostImplTest {
9749 protected: 9751 protected:
9750 std::unique_ptr<OutputSurface> CreateOutputSurface() override { 9752 std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override {
9751 return FakeOutputSurface::CreateDelegating3d(); 9753 return FakeCompositorFrameSink::Create3d();
9752 } 9754 }
9753 }; 9755 };
9754 9756
9755 TEST_F(ResourcelessSoftwareLayerTreeHostImplTest, 9757 TEST_F(ResourcelessSoftwareLayerTreeHostImplTest,
9756 ResourcelessSoftwareSetNeedsRedraw) { 9758 ResourcelessSoftwareSetNeedsRedraw) {
9757 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); 9759 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
9758 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 9760 host_impl_->active_tree()->BuildPropertyTreesForTesting();
9759 9761
9760 const gfx::Size viewport_size(100, 100); 9762 const gfx::Size viewport_size(100, 100);
9761 host_impl_->SetViewportSize(viewport_size); 9763 host_impl_->SetViewportSize(viewport_size);
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
10736 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); 10738 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
10737 host_impl_->ScrollEnd(EndState().get()); 10739 host_impl_->ScrollEnd(EndState().get());
10738 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2.5), 10740 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2.5),
10739 scroll_layer->CurrentScrollOffset()); 10741 scroll_layer->CurrentScrollOffset());
10740 } 10742 }
10741 } 10743 }
10742 10744
10743 class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest { 10745 class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest {
10744 public: 10746 public:
10745 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {} 10747 LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {}
10746 void DidLoseOutputSurfaceOnImplThread() override { num_lost_surfaces_++; } 10748 void DidLoseCompositorFrameSinkOnImplThread() override {
10749 num_lost_surfaces_++;
10750 }
10747 10751
10748 protected: 10752 protected:
10749 int num_lost_surfaces_; 10753 int num_lost_surfaces_;
10750 }; 10754 };
10751 10755
10752 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) { 10756 TEST_F(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) {
10753 // Really we just need at least one client notification each time 10757 // Really we just need at least one client notification each time
10754 // we go from having a valid output surface to not having a valid output 10758 // we go from having a valid output surface to not having a valid output
10755 // surface. 10759 // surface.
10756 EXPECT_EQ(0, num_lost_surfaces_); 10760 EXPECT_EQ(0, num_lost_surfaces_);
10757 host_impl_->DidLoseOutputSurface(); 10761 host_impl_->DidLoseCompositorFrameSink();
10758 EXPECT_EQ(1, num_lost_surfaces_); 10762 EXPECT_EQ(1, num_lost_surfaces_);
10759 host_impl_->DidLoseOutputSurface(); 10763 host_impl_->DidLoseCompositorFrameSink();
10760 EXPECT_LE(1, num_lost_surfaces_); 10764 EXPECT_LE(1, num_lost_surfaces_);
10761 } 10765 }
10762 10766
10763 size_t CountRenderPassesWithId(const RenderPassList& list, RenderPassId id) { 10767 size_t CountRenderPassesWithId(const RenderPassList& list, RenderPassId id) {
10764 return std::count_if( 10768 return std::count_if(
10765 list.begin(), list.end(), 10769 list.begin(), list.end(),
10766 [id](const std::unique_ptr<RenderPass>& p) { return p->id == id; }); 10770 [id](const std::unique_ptr<RenderPass>& p) { return p->id == id; });
10767 } 10771 }
10768 10772
10769 TEST_F(LayerTreeHostImplTest, RemoveUnreferencedRenderPass) { 10773 TEST_F(LayerTreeHostImplTest, RemoveUnreferencedRenderPass) {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
10984 host_impl_->gpu_rasterization_status()); 10988 host_impl_->gpu_rasterization_status());
10985 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10989 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10986 EXPECT_FALSE(host_impl_->use_msaa()); 10990 EXPECT_FALSE(host_impl_->use_msaa());
10987 10991
10988 std::unique_ptr<TestWebGraphicsContext3D> context_with_msaa = 10992 std::unique_ptr<TestWebGraphicsContext3D> context_with_msaa =
10989 TestWebGraphicsContext3D::Create(); 10993 TestWebGraphicsContext3D::Create();
10990 context_with_msaa->SetMaxSamples(8); 10994 context_with_msaa->SetMaxSamples(8);
10991 10995
10992 LayerTreeSettings msaaSettings = GpuRasterizationEnabledSettings(); 10996 LayerTreeSettings msaaSettings = GpuRasterizationEnabledSettings();
10993 msaaSettings.gpu_rasterization_msaa_sample_count = 4; 10997 msaaSettings.gpu_rasterization_msaa_sample_count = 4;
10994 EXPECT_TRUE(CreateHostImpl( 10998 EXPECT_TRUE(CreateHostImpl(msaaSettings, FakeCompositorFrameSink::Create3d(
10995 msaaSettings, 10999 std::move(context_with_msaa))));
10996 FakeOutputSurface::CreateDelegating3d(std::move(context_with_msaa))));
10997 host_impl_->SetHasGpuRasterizationTrigger(true); 11000 host_impl_->SetHasGpuRasterizationTrigger(true);
10998 host_impl_->SetContentIsSuitableForGpuRasterization(false); 11001 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10999 host_impl_->CommitComplete(); 11002 host_impl_->CommitComplete();
11000 EXPECT_EQ(GpuRasterizationStatus::MSAA_CONTENT, 11003 EXPECT_EQ(GpuRasterizationStatus::MSAA_CONTENT,
11001 host_impl_->gpu_rasterization_status()); 11004 host_impl_->gpu_rasterization_status());
11002 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11005 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11003 EXPECT_TRUE(host_impl_->use_msaa()); 11006 EXPECT_TRUE(host_impl_->use_msaa());
11004 11007
11005 LayerTreeSettings settings = DefaultSettings(); 11008 LayerTreeSettings settings = DefaultSettings();
11006 settings.gpu_rasterization_enabled = false; 11009 settings.gpu_rasterization_enabled = false;
11007 EXPECT_TRUE( 11010 EXPECT_TRUE(CreateHostImpl(settings, FakeCompositorFrameSink::Create3d()));
11008 CreateHostImpl(settings, FakeOutputSurface::CreateDelegating3d()));
11009 host_impl_->SetHasGpuRasterizationTrigger(true); 11011 host_impl_->SetHasGpuRasterizationTrigger(true);
11010 host_impl_->SetContentIsSuitableForGpuRasterization(true); 11012 host_impl_->SetContentIsSuitableForGpuRasterization(true);
11011 host_impl_->CommitComplete(); 11013 host_impl_->CommitComplete();
11012 EXPECT_EQ(GpuRasterizationStatus::OFF_DEVICE, 11014 EXPECT_EQ(GpuRasterizationStatus::OFF_DEVICE,
11013 host_impl_->gpu_rasterization_status()); 11015 host_impl_->gpu_rasterization_status());
11014 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 11016 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
11015 11017
11016 settings.gpu_rasterization_forced = true; 11018 settings.gpu_rasterization_forced = true;
11017 EXPECT_TRUE( 11019 EXPECT_TRUE(CreateHostImpl(settings, FakeCompositorFrameSink::Create3d()));
11018 CreateHostImpl(settings, FakeOutputSurface::CreateDelegating3d()));
11019 11020
11020 host_impl_->SetHasGpuRasterizationTrigger(false); 11021 host_impl_->SetHasGpuRasterizationTrigger(false);
11021 host_impl_->SetContentIsSuitableForGpuRasterization(false); 11022 host_impl_->SetContentIsSuitableForGpuRasterization(false);
11022 host_impl_->CommitComplete(); 11023 host_impl_->CommitComplete();
11023 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, 11024 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED,
11024 host_impl_->gpu_rasterization_status()); 11025 host_impl_->gpu_rasterization_status());
11025 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11026 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11026 } 11027 }
11027 11028
11028 class MsaaIsSlowLayerTreeHostImplTest : public LayerTreeHostImplTest { 11029 class MsaaIsSlowLayerTreeHostImplTest : public LayerTreeHostImplTest {
11029 public: 11030 public:
11030 void CreateHostImplWithMsaaIsSlow(bool msaa_is_slow) { 11031 void CreateHostImplWithMsaaIsSlow(bool msaa_is_slow) {
11031 LayerTreeSettings settings = DefaultSettings(); 11032 LayerTreeSettings settings = DefaultSettings();
11032 settings.gpu_rasterization_enabled = true; 11033 settings.gpu_rasterization_enabled = true;
11033 settings.gpu_rasterization_msaa_sample_count = 4; 11034 settings.gpu_rasterization_msaa_sample_count = 4;
11034 auto context_provider = TestContextProvider::Create(); 11035 auto context_provider = TestContextProvider::Create();
11035 context_provider->UnboundTestContext3d()->SetMaxSamples(4); 11036 context_provider->UnboundTestContext3d()->SetMaxSamples(4);
11036 context_provider->UnboundTestContext3d()->set_msaa_is_slow(msaa_is_slow); 11037 context_provider->UnboundTestContext3d()->set_msaa_is_slow(msaa_is_slow);
11037 auto msaa_is_normal_output_surface = 11038 auto msaa_is_normal_compositor_frame_sink =
11038 FakeOutputSurface::CreateDelegating3d(context_provider); 11039 FakeCompositorFrameSink::Create3d(context_provider);
11039 EXPECT_TRUE( 11040 EXPECT_TRUE(CreateHostImpl(
11040 CreateHostImpl(settings, std::move(msaa_is_normal_output_surface))); 11041 settings, std::move(msaa_is_normal_compositor_frame_sink)));
11041 } 11042 }
11042 }; 11043 };
11043 11044
11044 TEST_F(MsaaIsSlowLayerTreeHostImplTest, GpuRasterizationStatusMsaaIsSlow) { 11045 TEST_F(MsaaIsSlowLayerTreeHostImplTest, GpuRasterizationStatusMsaaIsSlow) {
11045 // Ensure that without the msaa_is_slow cap we raster unsuitable content with 11046 // Ensure that without the msaa_is_slow cap we raster unsuitable content with
11046 // msaa. 11047 // msaa.
11047 CreateHostImplWithMsaaIsSlow(false); 11048 CreateHostImplWithMsaaIsSlow(false);
11048 host_impl_->SetHasGpuRasterizationTrigger(true); 11049 host_impl_->SetHasGpuRasterizationTrigger(true);
11049 host_impl_->SetContentIsSuitableForGpuRasterization(false); 11050 host_impl_->SetContentIsSuitableForGpuRasterization(false);
11050 host_impl_->CommitComplete(); 11051 host_impl_->CommitComplete();
11051 EXPECT_EQ(GpuRasterizationStatus::MSAA_CONTENT, 11052 EXPECT_EQ(GpuRasterizationStatus::MSAA_CONTENT,
11052 host_impl_->gpu_rasterization_status()); 11053 host_impl_->gpu_rasterization_status());
11053 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11054 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11054 11055
11055 // Ensure that with the msaa_is_slow cap we don't raster unsuitable content 11056 // Ensure that with the msaa_is_slow cap we don't raster unsuitable content
11056 // with msaa. 11057 // with msaa.
11057 CreateHostImplWithMsaaIsSlow(true); 11058 CreateHostImplWithMsaaIsSlow(true);
11058 host_impl_->SetHasGpuRasterizationTrigger(true); 11059 host_impl_->SetHasGpuRasterizationTrigger(true);
11059 host_impl_->SetContentIsSuitableForGpuRasterization(false); 11060 host_impl_->SetContentIsSuitableForGpuRasterization(false);
11060 host_impl_->CommitComplete(); 11061 host_impl_->CommitComplete();
11061 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT, 11062 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT,
11062 host_impl_->gpu_rasterization_status()); 11063 host_impl_->gpu_rasterization_status());
11063 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 11064 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
11064 } 11065 }
11065 11066
11066 // A mock output surface which lets us detect calls to ForceReclaimResources. 11067 // A mock output surface which lets us detect calls to ForceReclaimResources.
11067 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { 11068 class MockReclaimResourcesCompositorFrameSink : public FakeCompositorFrameSink {
11068 public: 11069 public:
11069 MockReclaimResourcesOutputSurface() 11070 MockReclaimResourcesCompositorFrameSink()
11070 : FakeOutputSurface(TestContextProvider::Create(), 11071 : FakeCompositorFrameSink(TestContextProvider::Create(),
11071 TestContextProvider::CreateWorker(), 11072 TestContextProvider::CreateWorker(),
11072 true) {} 11073 true) {}
11073 11074
11074 MOCK_METHOD0(ForceReclaimResources, void()); 11075 MOCK_METHOD0(ForceReclaimResources, void());
11075 }; 11076 };
11076 11077
11077 // Display::Draw (and the planned Display Scheduler) currently rely on resources 11078 // Display::Draw (and the planned Display Scheduler) currently rely on resources
11078 // being reclaimed to block drawing between BeginCommit / Swap. This test 11079 // being reclaimed to block drawing between BeginCommit / Swap. This test
11079 // ensures that BeginCommit triggers ForceReclaimResources. See 11080 // ensures that BeginCommit triggers ForceReclaimResources. See
11080 // crbug.com/489515. 11081 // crbug.com/489515.
11081 TEST_F(LayerTreeHostImplTest, BeginCommitReclaimsResources) { 11082 TEST_F(LayerTreeHostImplTest, BeginCommitReclaimsResources) {
11082 auto output_surface = base::MakeUnique<MockReclaimResourcesOutputSurface>(); 11083 auto compositor_frame_sink =
11084 base::MakeUnique<MockReclaimResourcesCompositorFrameSink>();
11083 // Hold an unowned pointer to the output surface to use for mock expectations. 11085 // Hold an unowned pointer to the output surface to use for mock expectations.
11084 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); 11086 MockReclaimResourcesCompositorFrameSink* mock_compositor_frame_sink =
11087 compositor_frame_sink.get();
11085 11088
11086 CreateHostImpl(DefaultSettings(), std::move(output_surface)); 11089 CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink));
11087 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); 11090 EXPECT_CALL(*mock_compositor_frame_sink, ForceReclaimResources()).Times(1);
11088 host_impl_->BeginCommit(); 11091 host_impl_->BeginCommit();
11089 } 11092 }
11090 11093
11091 TEST_F(LayerTreeHostImplTest, UpdatePageScaleFactorOnActiveTree) { 11094 TEST_F(LayerTreeHostImplTest, UpdatePageScaleFactorOnActiveTree) {
11092 // Check page scale factor update in property trees when an update is made 11095 // Check page scale factor update in property trees when an update is made
11093 // on the active tree. 11096 // on the active tree.
11094 host_impl_->CreatePendingTree(); 11097 host_impl_->CreatePendingTree();
11095 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 3.f); 11098 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 3.f);
11096 CreateScrollAndContentsLayers(host_impl_->pending_tree(), 11099 CreateScrollAndContentsLayers(host_impl_->pending_tree(),
11097 gfx::Size(100, 100)); 11100 gfx::Size(100, 100));
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
11223 pending_tree->UpdateDrawProperties(false); 11226 pending_tree->UpdateDrawProperties(false);
11224 float jitter = LayerTreeHostCommon::CalculateLayerJitter(content_layer); 11227 float jitter = LayerTreeHostCommon::CalculateLayerJitter(content_layer);
11225 // There should not be any jitter measured till we hit the fixed point hits 11228 // There should not be any jitter measured till we hit the fixed point hits
11226 // threshold. 11229 // threshold.
11227 float expected_jitter = 11230 float expected_jitter =
11228 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; 11231 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0;
11229 EXPECT_EQ(jitter, expected_jitter); 11232 EXPECT_EQ(jitter, expected_jitter);
11230 } 11233 }
11231 } 11234 }
11232 11235
11233 // Checks that if we lose a GPU raster enabled OutputSurface and replace it 11236 // Checks that if we lose a GPU raster enabled CompositorFrameSink and replace
11234 // with a software OutputSurface, LayerTreeHostImpl correctly re-computes GPU 11237 // it
11238 // with a software CompositorFrameSink, LayerTreeHostImpl correctly re-computes
11239 // GPU
11235 // rasterization status. 11240 // rasterization status.
11236 TEST_F(LayerTreeHostImplTest, RecomputeGpuRasterOnOutputSurfaceChange) { 11241 TEST_F(LayerTreeHostImplTest, RecomputeGpuRasterOnCompositorFrameSinkChange) {
11237 host_impl_->ReleaseOutputSurface(); 11242 host_impl_->ReleaseCompositorFrameSink();
11238 host_impl_ = nullptr; 11243 host_impl_ = nullptr;
11239 11244
11240 LayerTreeSettings settings = DefaultSettings(); 11245 LayerTreeSettings settings = DefaultSettings();
11241 settings.gpu_rasterization_forced = true; 11246 settings.gpu_rasterization_forced = true;
11242 11247
11243 host_impl_ = LayerTreeHostImpl::Create( 11248 host_impl_ = LayerTreeHostImpl::Create(
11244 settings, this, &task_runner_provider_, &stats_instrumentation_, 11249 settings, this, &task_runner_provider_, &stats_instrumentation_,
11245 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, &task_graph_runner_, 11250 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, &task_graph_runner_,
11246 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0); 11251 AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0);
11247 host_impl_->SetVisible(true); 11252 host_impl_->SetVisible(true);
11248 11253
11249 // InitializeRenderer with a gpu-raster enabled output surface. 11254 // InitializeRenderer with a gpu-raster enabled output surface.
11250 auto gpu_raster_output_surface = 11255 auto gpu_raster_compositor_frame_sink =
11251 FakeOutputSurface::CreateDelegating3d(TestWebGraphicsContext3D::Create()); 11256 FakeCompositorFrameSink::Create3d(TestWebGraphicsContext3D::Create());
11252 host_impl_->InitializeRenderer(gpu_raster_output_surface.get()); 11257 host_impl_->InitializeRenderer(gpu_raster_compositor_frame_sink.get());
11253 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11258 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11254 11259
11255 // Re-initialize with a software output surface. 11260 // Re-initialize with a software output surface.
11256 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware(); 11261 compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware();
11257 host_impl_->InitializeRenderer(output_surface_.get()); 11262 host_impl_->InitializeRenderer(compositor_frame_sink_.get());
11258 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 11263 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
11259 } 11264 }
11260 11265
11261 } // namespace 11266 } // namespace
11262 } // namespace cc 11267 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698