OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "cc/test/fake_picture_layer_impl.h" | 42 #include "cc/test/fake_picture_layer_impl.h" |
43 #include "cc/test/fake_proxy.h" | 43 #include "cc/test/fake_proxy.h" |
44 #include "cc/test/fake_recording_source.h" | 44 #include "cc/test/fake_recording_source.h" |
45 #include "cc/test/fake_scoped_ui_resource.h" | 45 #include "cc/test/fake_scoped_ui_resource.h" |
46 #include "cc/test/fake_video_frame_provider.h" | 46 #include "cc/test/fake_video_frame_provider.h" |
47 #include "cc/test/geometry_test_utils.h" | 47 #include "cc/test/geometry_test_utils.h" |
48 #include "cc/test/layer_internals_for_test.h" | 48 #include "cc/test/layer_internals_for_test.h" |
49 #include "cc/test/layer_tree_test.h" | 49 #include "cc/test/layer_tree_test.h" |
50 #include "cc/test/render_pass_test_utils.h" | 50 #include "cc/test/render_pass_test_utils.h" |
51 #include "cc/test/skia_common.h" | 51 #include "cc/test/skia_common.h" |
52 #include "cc/test/test_delegating_output_surface.h" | 52 #include "cc/test/test_compositor_frame_sink.h" |
53 #include "cc/test/test_shared_bitmap_manager.h" | 53 #include "cc/test/test_shared_bitmap_manager.h" |
54 #include "cc/test/test_web_graphics_context_3d.h" | 54 #include "cc/test/test_web_graphics_context_3d.h" |
55 #include "cc/trees/effect_node.h" | 55 #include "cc/trees/effect_node.h" |
56 #include "cc/trees/layer_tree_host_common.h" | 56 #include "cc/trees/layer_tree_host_common.h" |
57 #include "cc/trees/layer_tree_host_impl.h" | 57 #include "cc/trees/layer_tree_host_impl.h" |
58 #include "cc/trees/layer_tree_impl.h" | 58 #include "cc/trees/layer_tree_impl.h" |
59 #include "cc/trees/single_thread_proxy.h" | 59 #include "cc/trees/single_thread_proxy.h" |
60 #include "cc/trees/transform_node.h" | 60 #include "cc/trees/transform_node.h" |
61 #include "gpu/GLES2/gl2extchromium.h" | 61 #include "gpu/GLES2/gl2extchromium.h" |
62 #include "testing/gmock/include/gmock/gmock.h" | 62 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 bool did_notify_ready_to_draw_; | 428 bool did_notify_ready_to_draw_; |
429 bool did_draw_; | 429 bool did_draw_; |
430 }; | 430 }; |
431 | 431 |
432 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in | 432 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in |
433 // single threaded mode. | 433 // single threaded mode. |
434 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility); | 434 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility); |
435 | 435 |
436 class LayerTreeHostContextCacheTest : public LayerTreeHostTest { | 436 class LayerTreeHostContextCacheTest : public LayerTreeHostTest { |
437 public: | 437 public: |
438 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 438 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
439 scoped_refptr<ContextProvider> compositor_context_provider, | 439 scoped_refptr<ContextProvider> compositor_context_provider, |
440 scoped_refptr<ContextProvider> worker_context_provider) override { | 440 scoped_refptr<ContextProvider> worker_context_provider) override { |
441 // Create the main ContextProvider with a MockContextSupport. | 441 // Create the main ContextProvider with a MockContextSupport. |
442 auto main_support = base::MakeUnique<MockContextSupport>(); | 442 auto main_support = base::MakeUnique<MockContextSupport>(); |
443 mock_main_context_support_ = main_support.get(); | 443 mock_main_context_support_ = main_support.get(); |
444 auto test_main_context_provider = TestContextProvider::Create( | 444 auto test_main_context_provider = TestContextProvider::Create( |
445 TestWebGraphicsContext3D::Create(), std::move(main_support)); | 445 TestWebGraphicsContext3D::Create(), std::move(main_support)); |
446 | 446 |
447 // Create the main ContextProvider with a MockContextSupport. | 447 // Create the main ContextProvider with a MockContextSupport. |
448 auto worker_support = base::MakeUnique<MockContextSupport>(); | 448 auto worker_support = base::MakeUnique<MockContextSupport>(); |
449 mock_worker_context_support_ = worker_support.get(); | 449 mock_worker_context_support_ = worker_support.get(); |
450 auto test_worker_context_provider = TestContextProvider::Create( | 450 auto test_worker_context_provider = TestContextProvider::Create( |
451 TestWebGraphicsContext3D::Create(), std::move(worker_support)); | 451 TestWebGraphicsContext3D::Create(), std::move(worker_support)); |
452 test_worker_context_provider->BindToCurrentThread(); | 452 test_worker_context_provider->BindToCurrentThread(); |
453 | 453 |
454 // At init, visibility is set to true, so SetAggressivelyFreeResources will | 454 // At init, visibility is set to true, so SetAggressivelyFreeResources will |
455 // be disabled. | 455 // be disabled. |
456 EXPECT_CALL(*mock_main_context_support_, | 456 EXPECT_CALL(*mock_main_context_support_, |
457 SetAggressivelyFreeResources(false)); | 457 SetAggressivelyFreeResources(false)); |
458 EXPECT_CALL(*mock_worker_context_support_, | 458 EXPECT_CALL(*mock_worker_context_support_, |
459 SetAggressivelyFreeResources(false)); | 459 SetAggressivelyFreeResources(false)); |
460 | 460 |
461 return LayerTreeHostTest::CreateDelegatingOutputSurface( | 461 return LayerTreeHostTest::CreateCompositorFrameSink( |
462 std::move(test_main_context_provider), | 462 std::move(test_main_context_provider), |
463 std::move(test_worker_context_provider)); | 463 std::move(test_worker_context_provider)); |
464 } | 464 } |
465 | 465 |
466 void InitializeSettings(LayerTreeSettings* settings) override { | 466 void InitializeSettings(LayerTreeSettings* settings) override { |
467 settings->gpu_rasterization_enabled = true; | 467 settings->gpu_rasterization_enabled = true; |
468 settings->gpu_rasterization_forced = true; | 468 settings->gpu_rasterization_forced = true; |
469 } | 469 } |
470 | 470 |
471 void BeginTest() override {} | 471 void BeginTest() override {} |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 // Ensure that our initialization expectations have completed. | 585 // Ensure that our initialization expectations have completed. |
586 Mock::VerifyAndClearExpectations(mock_main_context_support_); | 586 Mock::VerifyAndClearExpectations(mock_main_context_support_); |
587 Mock::VerifyAndClearExpectations(mock_worker_context_support_); | 587 Mock::VerifyAndClearExpectations(mock_worker_context_support_); |
588 | 588 |
589 // Output surface lost expectations. | 589 // Output surface lost expectations. |
590 EXPECT_CALL(*mock_worker_context_support_, | 590 EXPECT_CALL(*mock_worker_context_support_, |
591 SetAggressivelyFreeResources(true)); | 591 SetAggressivelyFreeResources(true)); |
592 EXPECT_CALL(*mock_main_context_support_, | 592 EXPECT_CALL(*mock_main_context_support_, |
593 SetAggressivelyFreeResources(true)); | 593 SetAggressivelyFreeResources(true)); |
594 host_impl->DidLoseOutputSurface(); | 594 host_impl->DidLoseCompositorFrameSink(); |
595 has_recreated_ = true; | 595 has_recreated_ = true; |
596 } | 596 } |
597 | 597 |
598 void DidInitializeOutputSurface() override { | 598 void DidInitializeCompositorFrameSink() override { |
599 // This is run after we have recreated our OutputSurface. | 599 // This is run after we have recreated our OutputSurface. |
600 if (!has_recreated_) | 600 if (!has_recreated_) |
601 return; | 601 return; |
602 | 602 |
603 // Ensure that our initialization expectations have completed. | 603 // Ensure that our initialization expectations have completed. |
604 Mock::VerifyAndClearExpectations(mock_main_context_support_); | 604 Mock::VerifyAndClearExpectations(mock_main_context_support_); |
605 Mock::VerifyAndClearExpectations(mock_worker_context_support_); | 605 Mock::VerifyAndClearExpectations(mock_worker_context_support_); |
606 | 606 |
607 // Destruction exptectations. | 607 // Destruction exptectations. |
608 EXPECT_CALL(*mock_worker_context_support_, | 608 EXPECT_CALL(*mock_worker_context_support_, |
(...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2713 EXPECT_EQ(commit_count_, 5); | 2713 EXPECT_EQ(commit_count_, 5); |
2714 EXPECT_EQ(commit_abort_count_, 3); | 2714 EXPECT_EQ(commit_abort_count_, 3); |
2715 EXPECT_EQ(commit_complete_count_, 2); | 2715 EXPECT_EQ(commit_complete_count_, 2); |
2716 } | 2716 } |
2717 | 2717 |
2718 int commit_count_; | 2718 int commit_count_; |
2719 int commit_abort_count_; | 2719 int commit_abort_count_; |
2720 int commit_complete_count_; | 2720 int commit_complete_count_; |
2721 }; | 2721 }; |
2722 | 2722 |
2723 class OnDrawOutputSurface : public TestDelegatingOutputSurface { | 2723 class OnDrawCompositorFrameSink : public TestCompositorFrameSink { |
2724 public: | 2724 public: |
2725 explicit OnDrawOutputSurface( | 2725 explicit OnDrawCompositorFrameSink( |
2726 scoped_refptr<ContextProvider> compositor_context_provider, | 2726 scoped_refptr<ContextProvider> compositor_context_provider, |
2727 scoped_refptr<ContextProvider> worker_context_provider, | 2727 scoped_refptr<ContextProvider> worker_context_provider, |
2728 std::unique_ptr<OutputSurface> display_output_surface, | 2728 std::unique_ptr<OutputSurface> display_output_surface, |
2729 SharedBitmapManager* shared_bitmap_manager, | 2729 SharedBitmapManager* shared_bitmap_manager, |
2730 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 2730 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
2731 const RendererSettings& renderer_settings, | 2731 const RendererSettings& renderer_settings, |
2732 base::SingleThreadTaskRunner* task_runner, | 2732 base::SingleThreadTaskRunner* task_runner, |
2733 bool synchronous_composite, | 2733 bool synchronous_composite, |
2734 bool force_disable_reclaim_resources, | 2734 bool force_disable_reclaim_resources, |
2735 base::Closure invalidate_callback) | 2735 base::Closure invalidate_callback) |
2736 : TestDelegatingOutputSurface(std::move(compositor_context_provider), | 2736 : TestCompositorFrameSink(std::move(compositor_context_provider), |
2737 std::move(worker_context_provider), | 2737 std::move(worker_context_provider), |
2738 std::move(display_output_surface), | 2738 std::move(display_output_surface), |
2739 shared_bitmap_manager, | 2739 shared_bitmap_manager, |
2740 gpu_memory_buffer_manager, | 2740 gpu_memory_buffer_manager, |
2741 renderer_settings, | 2741 renderer_settings, |
2742 task_runner, | 2742 task_runner, |
2743 synchronous_composite, | 2743 synchronous_composite, |
2744 force_disable_reclaim_resources), | 2744 force_disable_reclaim_resources), |
2745 invalidate_callback_(std::move(invalidate_callback)) {} | 2745 invalidate_callback_(std::move(invalidate_callback)) {} |
2746 | 2746 |
2747 // TestDelegatingOutputSurface overrides. | 2747 // TestCompositorFrameSink overrides. |
2748 void Invalidate() override { invalidate_callback_.Run(); } | 2748 void Invalidate() override { invalidate_callback_.Run(); } |
2749 | 2749 |
2750 void OnDraw(bool resourceless_software_draw) { | 2750 void OnDraw(bool resourceless_software_draw) { |
2751 gfx::Transform identity; | 2751 gfx::Transform identity; |
2752 gfx::Rect empty_rect; | 2752 gfx::Rect empty_rect; |
2753 client_->OnDraw(identity, empty_rect, resourceless_software_draw); | 2753 client_->OnDraw(identity, empty_rect, resourceless_software_draw); |
2754 } | 2754 } |
2755 | 2755 |
2756 private: | 2756 private: |
2757 const base::Closure invalidate_callback_; | 2757 const base::Closure invalidate_callback_; |
2758 }; | 2758 }; |
2759 | 2759 |
2760 class LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor | 2760 class LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor |
2761 : public LayerTreeHostTestAbortedCommitDoesntStall { | 2761 : public LayerTreeHostTestAbortedCommitDoesntStall { |
2762 protected: | 2762 protected: |
2763 void InitializeSettings(LayerTreeSettings* settings) override { | 2763 void InitializeSettings(LayerTreeSettings* settings) override { |
2764 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings); | 2764 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings); |
2765 settings->using_synchronous_renderer_compositor = true; | 2765 settings->using_synchronous_renderer_compositor = true; |
2766 } | 2766 } |
2767 | 2767 |
2768 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 2768 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
2769 scoped_refptr<ContextProvider> compositor_context_provider, | 2769 scoped_refptr<ContextProvider> compositor_context_provider, |
2770 scoped_refptr<ContextProvider> worker_context_provider) override { | 2770 scoped_refptr<ContextProvider> worker_context_provider) override { |
2771 auto on_draw_callback = base::Bind( | 2771 auto on_draw_callback = base::Bind( |
2772 &LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor:: | 2772 &LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor:: |
2773 CallOnDraw, | 2773 CallOnDraw, |
2774 base::Unretained(this)); | 2774 base::Unretained(this)); |
2775 auto output_surface = base::MakeUnique<OnDrawOutputSurface>( | 2775 auto output_surface = base::MakeUnique<OnDrawCompositorFrameSink>( |
2776 compositor_context_provider, std::move(worker_context_provider), | 2776 compositor_context_provider, std::move(worker_context_provider), |
2777 CreateDisplayOutputSurface(compositor_context_provider), | 2777 CreateDisplayOutputSurface(compositor_context_provider), |
2778 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 2778 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
2779 layer_tree_host()->GetSettings().renderer_settings, | 2779 layer_tree_host()->GetSettings().renderer_settings, |
2780 ImplThreadTaskRunner(), false /* synchronous_composite */, | 2780 ImplThreadTaskRunner(), false /* synchronous_composite */, |
2781 false /* force_disable_reclaim_resources */, | 2781 false /* force_disable_reclaim_resources */, |
2782 std::move(on_draw_callback)); | 2782 std::move(on_draw_callback)); |
2783 output_surface_ = output_surface.get(); | 2783 output_surface_ = output_surface.get(); |
2784 return std::move(output_surface); | 2784 return std::move(output_surface); |
2785 } | 2785 } |
2786 | 2786 |
2787 void CallOnDraw() { | 2787 void CallOnDraw() { |
2788 if (!TestEnded()) { | 2788 if (!TestEnded()) { |
2789 // Synchronous compositor does not draw unless told to do so by the output | 2789 // Synchronous compositor does not draw unless told to do so by the output |
2790 // surface. But it needs to be done on a new stack frame. | 2790 // surface. But it needs to be done on a new stack frame. |
2791 bool resourceless_software_draw = false; | 2791 bool resourceless_software_draw = false; |
2792 ImplThreadTaskRunner()->PostTask( | 2792 ImplThreadTaskRunner()->PostTask( |
2793 FROM_HERE, base::Bind(&OnDrawOutputSurface::OnDraw, | 2793 FROM_HERE, base::Bind(&OnDrawCompositorFrameSink::OnDraw, |
2794 base::Unretained(output_surface_), | 2794 base::Unretained(output_surface_), |
2795 resourceless_software_draw)); | 2795 resourceless_software_draw)); |
2796 } | 2796 } |
2797 } | 2797 } |
2798 | 2798 |
2799 OnDrawOutputSurface* output_surface_ = nullptr; | 2799 OnDrawCompositorFrameSink* output_surface_ = nullptr; |
2800 }; | 2800 }; |
2801 | 2801 |
2802 MULTI_THREAD_TEST_F( | 2802 MULTI_THREAD_TEST_F( |
2803 LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor); | 2803 LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor); |
2804 | 2804 |
2805 class LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync | 2805 class LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync |
2806 : public LayerTreeHostTestAbortedCommitDoesntStall { | 2806 : public LayerTreeHostTestAbortedCommitDoesntStall { |
2807 void InitializeSettings(LayerTreeSettings* settings) override { | 2807 void InitializeSettings(LayerTreeSettings* settings) override { |
2808 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings); | 2808 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings); |
2809 settings->wait_for_beginframe_interval = false; | 2809 settings->wait_for_beginframe_interval = false; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2908 child_layer_->SetBounds(gfx::Size(50, 50)); | 2908 child_layer_->SetBounds(gfx::Size(50, 50)); |
2909 | 2909 |
2910 root_layer_->AddChild(parent_layer_); | 2910 root_layer_->AddChild(parent_layer_); |
2911 parent_layer_->AddChild(child_layer_); | 2911 parent_layer_->AddChild(child_layer_); |
2912 layer_tree()->SetRootLayer(root_layer_); | 2912 layer_tree()->SetRootLayer(root_layer_); |
2913 | 2913 |
2914 LayerTreeHostTest::SetupTree(); | 2914 LayerTreeHostTest::SetupTree(); |
2915 client_.set_bounds(root_layer_->bounds()); | 2915 client_.set_bounds(root_layer_->bounds()); |
2916 } | 2916 } |
2917 | 2917 |
2918 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 2918 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
2919 scoped_refptr<ContextProvider> compositor_context_provider, | 2919 scoped_refptr<ContextProvider> compositor_context_provider, |
2920 scoped_refptr<ContextProvider> worker_context_provider) override { | 2920 scoped_refptr<ContextProvider> worker_context_provider) override { |
2921 auto on_draw_callback = | 2921 auto on_draw_callback = |
2922 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, | 2922 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, |
2923 base::Unretained(this)); | 2923 base::Unretained(this)); |
2924 auto output_surface = base::MakeUnique<OnDrawOutputSurface>( | 2924 auto output_surface = base::MakeUnique<OnDrawCompositorFrameSink>( |
2925 compositor_context_provider, std::move(worker_context_provider), | 2925 compositor_context_provider, std::move(worker_context_provider), |
2926 CreateDisplayOutputSurface(compositor_context_provider), | 2926 CreateDisplayOutputSurface(compositor_context_provider), |
2927 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 2927 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
2928 layer_tree_host()->GetSettings().renderer_settings, | 2928 layer_tree_host()->GetSettings().renderer_settings, |
2929 ImplThreadTaskRunner(), false /* synchronous_composite */, | 2929 ImplThreadTaskRunner(), false /* synchronous_composite */, |
2930 false /* force_disable_reclaim_resources */, | 2930 false /* force_disable_reclaim_resources */, |
2931 std::move(on_draw_callback)); | 2931 std::move(on_draw_callback)); |
2932 output_surface_ = output_surface.get(); | 2932 output_surface_ = output_surface.get(); |
2933 return std::move(output_surface); | 2933 return std::move(output_surface); |
2934 } | 2934 } |
2935 | 2935 |
2936 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2936 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2937 | 2937 |
2938 void CallOnDraw() { | 2938 void CallOnDraw() { |
2939 if (!TestEnded()) { | 2939 if (!TestEnded()) { |
2940 // Synchronous compositor does not draw unless told to do so by the output | 2940 // Synchronous compositor does not draw unless told to do so by the output |
2941 // surface. But it needs to be done on a new stack frame. | 2941 // surface. But it needs to be done on a new stack frame. |
2942 bool resourceless_software_draw = true; | 2942 bool resourceless_software_draw = true; |
2943 ImplThreadTaskRunner()->PostTask( | 2943 ImplThreadTaskRunner()->PostTask( |
2944 FROM_HERE, base::Bind(&OnDrawOutputSurface::OnDraw, | 2944 FROM_HERE, base::Bind(&OnDrawCompositorFrameSink::OnDraw, |
2945 base::Unretained(output_surface_), | 2945 base::Unretained(output_surface_), |
2946 resourceless_software_draw)); | 2946 resourceless_software_draw)); |
2947 } | 2947 } |
2948 } | 2948 } |
2949 | 2949 |
2950 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 2950 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
2951 LayerTreeHostImpl::FrameData* frame_data, | 2951 LayerTreeHostImpl::FrameData* frame_data, |
2952 DrawResult draw_result) override { | 2952 DrawResult draw_result) override { |
2953 if (host_impl->GetDrawMode() == DRAW_MODE_RESOURCELESS_SOFTWARE) { | 2953 if (host_impl->GetDrawMode() == DRAW_MODE_RESOURCELESS_SOFTWARE) { |
2954 EXPECT_EQ(1u, frame_data->render_passes.size()); | 2954 EXPECT_EQ(1u, frame_data->render_passes.size()); |
(...skipping 21 matching lines...) Expand all Loading... |
2976 EndTest(); | 2976 EndTest(); |
2977 break; | 2977 break; |
2978 default: | 2978 default: |
2979 NOTREACHED(); | 2979 NOTREACHED(); |
2980 } | 2980 } |
2981 } | 2981 } |
2982 | 2982 |
2983 void AfterTest() override {} | 2983 void AfterTest() override {} |
2984 | 2984 |
2985 private: | 2985 private: |
2986 OnDrawOutputSurface* output_surface_ = nullptr; | 2986 OnDrawCompositorFrameSink* output_surface_ = nullptr; |
2987 FakeContentLayerClient client_; | 2987 FakeContentLayerClient client_; |
2988 scoped_refptr<Layer> root_layer_; | 2988 scoped_refptr<Layer> root_layer_; |
2989 scoped_refptr<Layer> parent_layer_; | 2989 scoped_refptr<Layer> parent_layer_; |
2990 scoped_refptr<Layer> child_layer_; | 2990 scoped_refptr<Layer> child_layer_; |
2991 int draw_count_ = 0; | 2991 int draw_count_ = 0; |
2992 }; | 2992 }; |
2993 | 2993 |
2994 // Resourceless is not used for SingleThreadProxy, so it is unimplemented. | 2994 // Resourceless is not used for SingleThreadProxy, so it is unimplemented. |
2995 MULTI_THREAD_TEST_F(LayerTreeHostTestResourcelessSoftwareDraw); | 2995 MULTI_THREAD_TEST_F(LayerTreeHostTestResourcelessSoftwareDraw); |
2996 | 2996 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 break; | 3034 break; |
3035 case 5: | 3035 case 5: |
3036 ClearResources(); | 3036 ClearResources(); |
3037 EndTest(); | 3037 EndTest(); |
3038 break; | 3038 break; |
3039 } | 3039 } |
3040 } | 3040 } |
3041 | 3041 |
3042 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 3042 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
3043 auto* context = static_cast<TestContextProvider*>( | 3043 auto* context = static_cast<TestContextProvider*>( |
3044 impl->output_surface()->context_provider()) | 3044 impl->compositor_frame_sink()->context_provider()) |
3045 ->TestContext3d(); | 3045 ->TestContext3d(); |
3046 | 3046 |
3047 int frame = impl->active_tree()->source_frame_number(); | 3047 int frame = impl->active_tree()->source_frame_number(); |
3048 switch (frame) { | 3048 switch (frame) { |
3049 case 0: | 3049 case 0: |
3050 ASSERT_EQ(0u, context->NumTextures()); | 3050 ASSERT_EQ(0u, context->NumTextures()); |
3051 break; | 3051 break; |
3052 case 1: | 3052 case 1: |
3053 // Created two textures. | 3053 // Created two textures. |
3054 ASSERT_EQ(2u, context->NumTextures()); | 3054 ASSERT_EQ(2u, context->NumTextures()); |
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 class LayerTreeHostTestSynchronousCompositeSwapPromise | 5476 class LayerTreeHostTestSynchronousCompositeSwapPromise |
5477 : public LayerTreeHostTest { | 5477 : public LayerTreeHostTest { |
5478 public: | 5478 public: |
5479 LayerTreeHostTestSynchronousCompositeSwapPromise() = default; | 5479 LayerTreeHostTestSynchronousCompositeSwapPromise() = default; |
5480 | 5480 |
5481 void InitializeSettings(LayerTreeSettings* settings) override { | 5481 void InitializeSettings(LayerTreeSettings* settings) override { |
5482 settings->single_thread_proxy_scheduler = false; | 5482 settings->single_thread_proxy_scheduler = false; |
5483 settings->use_zero_copy = true; | 5483 settings->use_zero_copy = true; |
5484 } | 5484 } |
5485 | 5485 |
5486 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( | 5486 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
5487 scoped_refptr<ContextProvider> compositor_context_provider, | 5487 scoped_refptr<ContextProvider> compositor_context_provider, |
5488 scoped_refptr<ContextProvider> worker_context_provider) override { | 5488 scoped_refptr<ContextProvider> worker_context_provider) override { |
5489 bool synchronous_composite = | 5489 bool synchronous_composite = |
5490 !HasImplThread() && | 5490 !HasImplThread() && |
5491 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; | 5491 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; |
5492 // Relaiming resources is parameterized for this test. | 5492 // Relaiming resources is parameterized for this test. |
5493 bool force_disable_reclaim_resources = !reclaim_resources_; | 5493 bool force_disable_reclaim_resources = !reclaim_resources_; |
5494 return base::MakeUnique<TestDelegatingOutputSurface>( | 5494 return base::MakeUnique<TestCompositorFrameSink>( |
5495 compositor_context_provider, std::move(worker_context_provider), | 5495 compositor_context_provider, std::move(worker_context_provider), |
5496 CreateDisplayOutputSurface(compositor_context_provider), | 5496 CreateDisplayOutputSurface(compositor_context_provider), |
5497 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 5497 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
5498 layer_tree_host()->GetSettings().renderer_settings, | 5498 layer_tree_host()->GetSettings().renderer_settings, |
5499 ImplThreadTaskRunner(), synchronous_composite, | 5499 ImplThreadTaskRunner(), synchronous_composite, |
5500 force_disable_reclaim_resources); | 5500 force_disable_reclaim_resources); |
5501 } | 5501 } |
5502 | 5502 |
5503 void BeginTest() override { | 5503 void BeginTest() override { |
5504 // Successful composite. | 5504 // Successful composite. |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6940 client_.set_bounds(root->bounds()); | 6940 client_.set_bounds(root->bounds()); |
6941 } | 6941 } |
6942 | 6942 |
6943 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 6943 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
6944 bool success) override { | 6944 bool success) override { |
6945 // Check that our large_image_size_ is greater than max texture size. We do | 6945 // Check that our large_image_size_ is greater than max texture size. We do |
6946 // this here to ensure that our otuput surface exists. | 6946 // this here to ensure that our otuput surface exists. |
6947 | 6947 |
6948 // Retrieve max texture size from Skia. | 6948 // Retrieve max texture size from Skia. |
6949 ContextProvider* context_provider = | 6949 ContextProvider* context_provider = |
6950 host_impl->output_surface()->context_provider(); | 6950 host_impl->compositor_frame_sink()->context_provider(); |
6951 ASSERT_TRUE(context_provider); | 6951 ASSERT_TRUE(context_provider); |
6952 ContextProvider::ScopedContextLock context_lock(context_provider); | 6952 ContextProvider::ScopedContextLock context_lock(context_provider); |
6953 | 6953 |
6954 GrContext* gr_context = context_provider->GrContext(); | 6954 GrContext* gr_context = context_provider->GrContext(); |
6955 ASSERT_TRUE(gr_context); | 6955 ASSERT_TRUE(gr_context); |
6956 const uint32_t max_texture_size = gr_context->caps()->maxTextureSize(); | 6956 const uint32_t max_texture_size = gr_context->caps()->maxTextureSize(); |
6957 ASSERT_GT(static_cast<uint32_t>(large_image_size_.width()), | 6957 ASSERT_GT(static_cast<uint32_t>(large_image_size_.width()), |
6958 max_texture_size); | 6958 max_texture_size); |
6959 } | 6959 } |
6960 | 6960 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7052 EndTest(); | 7052 EndTest(); |
7053 } | 7053 } |
7054 | 7054 |
7055 void AfterTest() override {} | 7055 void AfterTest() override {} |
7056 }; | 7056 }; |
7057 | 7057 |
7058 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7058 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
7059 | 7059 |
7060 } // namespace | 7060 } // namespace |
7061 } // namespace cc | 7061 } // namespace cc |
OLD | NEW |