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

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 2445553002: cc: Make OutputSurface entirely live on one thread in tests. (Closed)
Patch Set: osonthread: fixcontextdeleteintest Created 4 years, 1 month 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/test/layer_tree_test.h ('k') | cc/test/test_compositor_frame_sink.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/test/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 TestHooks* test_hooks_; 486 TestHooks* test_hooks_;
487 }; 487 };
488 488
489 class LayerTreeTestCompositorFrameSinkClient 489 class LayerTreeTestCompositorFrameSinkClient
490 : public TestCompositorFrameSinkClient { 490 : public TestCompositorFrameSinkClient {
491 public: 491 public:
492 explicit LayerTreeTestCompositorFrameSinkClient(TestHooks* hooks) 492 explicit LayerTreeTestCompositorFrameSinkClient(TestHooks* hooks)
493 : hooks_(hooks) {} 493 : hooks_(hooks) {}
494 494
495 // TestCompositorFrameSinkClient implementation. 495 // TestCompositorFrameSinkClient implementation.
496 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface(
497 scoped_refptr<ContextProvider> compositor_context_provider) override {
498 return hooks_->CreateDisplayOutputSurfaceOnThread(
499 std::move(compositor_context_provider));
500 }
496 void DisplayReceivedCompositorFrame(const CompositorFrame& frame) override { 501 void DisplayReceivedCompositorFrame(const CompositorFrame& frame) override {
497 hooks_->DisplayReceivedCompositorFrameOnThread(frame); 502 hooks_->DisplayReceivedCompositorFrameOnThread(frame);
498 } 503 }
499 void DisplayWillDrawAndSwap(bool will_draw_and_swap, 504 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
500 const RenderPassList& render_passes) override { 505 const RenderPassList& render_passes) override {
501 hooks_->DisplayWillDrawAndSwapOnThread(will_draw_and_swap, render_passes); 506 hooks_->DisplayWillDrawAndSwapOnThread(will_draw_and_swap, render_passes);
502 } 507 }
503 void DisplayDidDrawAndSwap() override { 508 void DisplayDidDrawAndSwap() override {
504 hooks_->DisplayDidDrawAndSwapOnThread(); 509 hooks_->DisplayDidDrawAndSwapOnThread();
505 } 510 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 870
866 void LayerTreeTest::RequestNewCompositorFrameSink() { 871 void LayerTreeTest::RequestNewCompositorFrameSink() {
867 scoped_refptr<TestContextProvider> shared_context_provider = 872 scoped_refptr<TestContextProvider> shared_context_provider =
868 TestContextProvider::Create(); 873 TestContextProvider::Create();
869 scoped_refptr<TestContextProvider> worker_context_provider = 874 scoped_refptr<TestContextProvider> worker_context_provider =
870 TestContextProvider::CreateWorker(); 875 TestContextProvider::CreateWorker();
871 876
872 auto compositor_frame_sink = CreateCompositorFrameSink( 877 auto compositor_frame_sink = CreateCompositorFrameSink(
873 std::move(shared_context_provider), std::move(worker_context_provider)); 878 std::move(shared_context_provider), std::move(worker_context_provider));
874 compositor_frame_sink->SetClient(compositor_frame_sink_client_.get()); 879 compositor_frame_sink->SetClient(compositor_frame_sink_client_.get());
875 880 layer_tree_host_->SetCompositorFrameSink(std::move(compositor_frame_sink));
876 layer_tree_host_->SetCompositorFrameSink(std::move(compositor_frame_sink));
877 } 881 }
878 882
879 std::unique_ptr<TestCompositorFrameSink> 883 std::unique_ptr<TestCompositorFrameSink>
880 LayerTreeTest::CreateCompositorFrameSink( 884 LayerTreeTest::CreateCompositorFrameSink(
881 scoped_refptr<ContextProvider> compositor_context_provider, 885 scoped_refptr<ContextProvider> compositor_context_provider,
882 scoped_refptr<ContextProvider> worker_context_provider) { 886 scoped_refptr<ContextProvider> worker_context_provider) {
883 bool synchronous_composite = 887 bool synchronous_composite =
884 !HasImplThread() && 888 !HasImplThread() &&
885 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; 889 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler;
886 // Disable reclaim resources by default to act like the Display lives 890 // Disable reclaim resources by default to act like the Display lives
887 // out-of-process. 891 // out-of-process.
888 bool force_disable_reclaim_resources = true; 892 bool force_disable_reclaim_resources = true;
889 return base::MakeUnique<TestCompositorFrameSink>( 893 return base::MakeUnique<TestCompositorFrameSink>(
890 compositor_context_provider, std::move(worker_context_provider), 894 compositor_context_provider, std::move(worker_context_provider),
891 CreateDisplayOutputSurface(compositor_context_provider),
892 shared_bitmap_manager(), gpu_memory_buffer_manager(), 895 shared_bitmap_manager(), gpu_memory_buffer_manager(),
893 layer_tree_host()->GetSettings().renderer_settings, impl_task_runner_, 896 layer_tree_host()->GetSettings().renderer_settings, impl_task_runner_,
894 synchronous_composite, force_disable_reclaim_resources); 897 synchronous_composite, force_disable_reclaim_resources);
895 } 898 }
896 899
897 std::unique_ptr<OutputSurface> LayerTreeTest::CreateDisplayOutputSurface( 900 std::unique_ptr<OutputSurface>
901 LayerTreeTest::CreateDisplayOutputSurfaceOnThread(
898 scoped_refptr<ContextProvider> compositor_context_provider) { 902 scoped_refptr<ContextProvider> compositor_context_provider) {
899 // By default the Display shares a context with the LayerTreeHostImpl. 903 // By default the Display shares a context with the LayerTreeHostImpl.
900 return FakeOutputSurface::Create3d(std::move(compositor_context_provider)); 904 return FakeOutputSurface::Create3d(std::move(compositor_context_provider));
901 } 905 }
902 906
903 void LayerTreeTest::DestroyLayerTreeHost() { 907 void LayerTreeTest::DestroyLayerTreeHost() {
904 if (layer_tree_host_ && layer_tree_host_->GetLayerTree()->root_layer()) 908 if (layer_tree_host_ && layer_tree_host_->GetLayerTree()->root_layer())
905 layer_tree_host_->GetLayerTree()->root_layer()->SetLayerTreeHost(NULL); 909 layer_tree_host_->GetLayerTree()->root_layer()->SetLayerTreeHost(NULL);
906 layer_tree_host_ = nullptr; 910 layer_tree_host_ = nullptr;
907 layer_tree_host_in_process_ = nullptr; 911 layer_tree_host_in_process_ = nullptr;
(...skipping 21 matching lines...) Expand all
929 DCHECK(!IsRemoteTest()); 933 DCHECK(!IsRemoteTest());
930 return layer_tree_host_in_process_; 934 return layer_tree_host_in_process_;
931 } 935 }
932 936
933 Proxy* LayerTreeTest::proxy() { 937 Proxy* LayerTreeTest::proxy() {
934 return layer_tree_host_in_process() ? layer_tree_host_in_process()->proxy() 938 return layer_tree_host_in_process() ? layer_tree_host_in_process()->proxy()
935 : NULL; 939 : NULL;
936 } 940 }
937 941
938 } // namespace cc 942 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/test_compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698