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