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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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/test/layer_tree_test.h ('k') | cc/test/ordered_simple_task_runner.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/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
11 #include "cc/animation/animation.h" 12 #include "cc/animation/animation.h"
12 #include "cc/animation/animation_host.h" 13 #include "cc/animation/animation_host.h"
13 #include "cc/animation/animation_registrar.h" 14 #include "cc/animation/animation_registrar.h"
14 #include "cc/animation/layer_animation_controller.h" 15 #include "cc/animation/layer_animation_controller.h"
15 #include "cc/animation/timing_function.h" 16 #include "cc/animation/timing_function.h"
16 #include "cc/base/switches.h" 17 #include "cc/base/switches.h"
17 #include "cc/input/input_handler.h" 18 #include "cc/input/input_handler.h"
18 #include "cc/layers/layer.h" 19 #include "cc/layers/layer.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 outer_viewport_scroll_layer->SetBounds(scroll_bounds); 84 outer_viewport_scroll_layer->SetBounds(scroll_bounds);
84 outer_viewport_scroll_layer->SetIsDrawable(true); 85 outer_viewport_scroll_layer->SetIsDrawable(true);
85 CreateVirtualViewportLayers(root_layer, outer_viewport_scroll_layer, 86 CreateVirtualViewportLayers(root_layer, outer_viewport_scroll_layer,
86 inner_bounds, outer_bounds, host); 87 inner_bounds, outer_bounds, host);
87 } 88 }
88 89
89 // Creates a SingleThreadProxy that notifies the supplied |test_hooks| of 90 // Creates a SingleThreadProxy that notifies the supplied |test_hooks| of
90 // various actions. 91 // various actions.
91 class SingleThreadProxyForTest : public SingleThreadProxy { 92 class SingleThreadProxyForTest : public SingleThreadProxy {
92 public: 93 public:
93 static scoped_ptr<Proxy> Create(TestHooks* test_hooks, 94 static std::unique_ptr<Proxy> Create(
94 LayerTreeHost* host, 95 TestHooks* test_hooks,
95 LayerTreeHostSingleThreadClient* client, 96 LayerTreeHost* host,
96 TaskRunnerProvider* task_runner_provider) { 97 LayerTreeHostSingleThreadClient* client,
97 return make_scoped_ptr(new SingleThreadProxyForTest( 98 TaskRunnerProvider* task_runner_provider) {
99 return base::WrapUnique(new SingleThreadProxyForTest(
98 test_hooks, host, client, task_runner_provider)); 100 test_hooks, host, client, task_runner_provider));
99 } 101 }
100 102
101 ~SingleThreadProxyForTest() override {} 103 ~SingleThreadProxyForTest() override {}
102 104
103 private: 105 private:
104 SingleThreadProxyForTest(TestHooks* test_hooks, 106 SingleThreadProxyForTest(TestHooks* test_hooks,
105 LayerTreeHost* host, 107 LayerTreeHost* host,
106 LayerTreeHostSingleThreadClient* client, 108 LayerTreeHostSingleThreadClient* client,
107 TaskRunnerProvider* task_runner_provider) 109 TaskRunnerProvider* task_runner_provider)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 SingleThreadProxy::SendBeginMainFrameNotExpectedSoon(); 147 SingleThreadProxy::SendBeginMainFrameNotExpectedSoon();
146 test_hooks_->SendBeginMainFrameNotExpectedSoon(); 148 test_hooks_->SendBeginMainFrameNotExpectedSoon();
147 } 149 }
148 150
149 TestHooks* test_hooks_; 151 TestHooks* test_hooks_;
150 }; 152 };
151 153
152 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. 154 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks.
153 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { 155 class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
154 public: 156 public:
155 static scoped_ptr<LayerTreeHostImplForTesting> Create( 157 static std::unique_ptr<LayerTreeHostImplForTesting> Create(
156 TestHooks* test_hooks, 158 TestHooks* test_hooks,
157 const LayerTreeSettings& settings, 159 const LayerTreeSettings& settings,
158 LayerTreeHostImplClient* host_impl_client, 160 LayerTreeHostImplClient* host_impl_client,
159 TaskRunnerProvider* task_runner_provider, 161 TaskRunnerProvider* task_runner_provider,
160 SharedBitmapManager* shared_bitmap_manager, 162 SharedBitmapManager* shared_bitmap_manager,
161 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 163 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
162 TaskGraphRunner* task_graph_runner, 164 TaskGraphRunner* task_graph_runner,
163 RenderingStatsInstrumentation* stats_instrumentation) { 165 RenderingStatsInstrumentation* stats_instrumentation) {
164 return make_scoped_ptr(new LayerTreeHostImplForTesting( 166 return base::WrapUnique(new LayerTreeHostImplForTesting(
165 test_hooks, settings, host_impl_client, task_runner_provider, 167 test_hooks, settings, host_impl_client, task_runner_provider,
166 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, 168 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner,
167 stats_instrumentation)); 169 stats_instrumentation));
168 } 170 }
169 171
170 protected: 172 protected:
171 LayerTreeHostImplForTesting( 173 LayerTreeHostImplForTesting(
172 TestHooks* test_hooks, 174 TestHooks* test_hooks,
173 const LayerTreeSettings& settings, 175 const LayerTreeSettings& settings,
174 LayerTreeHostImplClient* host_impl_client, 176 LayerTreeHostImplClient* host_impl_client,
175 TaskRunnerProvider* task_runner_provider, 177 TaskRunnerProvider* task_runner_provider,
176 SharedBitmapManager* shared_bitmap_manager, 178 SharedBitmapManager* shared_bitmap_manager,
177 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 179 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
178 TaskGraphRunner* task_graph_runner, 180 TaskGraphRunner* task_graph_runner,
179 RenderingStatsInstrumentation* stats_instrumentation) 181 RenderingStatsInstrumentation* stats_instrumentation)
180 : LayerTreeHostImpl(settings, 182 : LayerTreeHostImpl(settings,
181 host_impl_client, 183 host_impl_client,
182 task_runner_provider, 184 task_runner_provider,
183 stats_instrumentation, 185 stats_instrumentation,
184 shared_bitmap_manager, 186 shared_bitmap_manager,
185 gpu_memory_buffer_manager, 187 gpu_memory_buffer_manager,
186 task_graph_runner, 188 task_graph_runner,
187 0), 189 0),
188 test_hooks_(test_hooks), 190 test_hooks_(test_hooks),
189 block_notify_ready_to_activate_for_testing_(false), 191 block_notify_ready_to_activate_for_testing_(false),
190 notify_ready_to_activate_was_blocked_(false) {} 192 notify_ready_to_activate_was_blocked_(false) {}
191 193
192 void CreateResourceAndTileTaskWorkerPool( 194 void CreateResourceAndTileTaskWorkerPool(
193 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, 195 std::unique_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
194 scoped_ptr<ResourcePool>* resource_pool) override { 196 std::unique_ptr<ResourcePool>* resource_pool) override {
195 test_hooks_->CreateResourceAndTileTaskWorkerPool( 197 test_hooks_->CreateResourceAndTileTaskWorkerPool(
196 this, tile_task_worker_pool, resource_pool); 198 this, tile_task_worker_pool, resource_pool);
197 } 199 }
198 200
199 void WillBeginImplFrame(const BeginFrameArgs& args) override { 201 void WillBeginImplFrame(const BeginFrameArgs& args) override {
200 LayerTreeHostImpl::WillBeginImplFrame(args); 202 LayerTreeHostImpl::WillBeginImplFrame(args);
201 test_hooks_->WillBeginImplFrameOnThread(this, args); 203 test_hooks_->WillBeginImplFrameOnThread(this, args);
202 } 204 }
203 205
204 void DidFinishImplFrame() override { 206 void DidFinishImplFrame() override {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 private: 330 private:
329 TestHooks* test_hooks_; 331 TestHooks* test_hooks_;
330 bool block_notify_ready_to_activate_for_testing_; 332 bool block_notify_ready_to_activate_for_testing_;
331 bool notify_ready_to_activate_was_blocked_; 333 bool notify_ready_to_activate_was_blocked_;
332 }; 334 };
333 335
334 // Implementation of LayerTreeHost callback interface. 336 // Implementation of LayerTreeHost callback interface.
335 class LayerTreeHostClientForTesting : public LayerTreeHostClient, 337 class LayerTreeHostClientForTesting : public LayerTreeHostClient,
336 public LayerTreeHostSingleThreadClient { 338 public LayerTreeHostSingleThreadClient {
337 public: 339 public:
338 static scoped_ptr<LayerTreeHostClientForTesting> Create( 340 static std::unique_ptr<LayerTreeHostClientForTesting> Create(
339 TestHooks* test_hooks) { 341 TestHooks* test_hooks) {
340 return make_scoped_ptr(new LayerTreeHostClientForTesting(test_hooks)); 342 return base::WrapUnique(new LayerTreeHostClientForTesting(test_hooks));
341 } 343 }
342 ~LayerTreeHostClientForTesting() override {} 344 ~LayerTreeHostClientForTesting() override {}
343 345
344 void WillBeginMainFrame() override { test_hooks_->WillBeginMainFrame(); } 346 void WillBeginMainFrame() override { test_hooks_->WillBeginMainFrame(); }
345 347
346 void DidBeginMainFrame() override { test_hooks_->DidBeginMainFrame(); } 348 void DidBeginMainFrame() override { test_hooks_->DidBeginMainFrame(); }
347 349
348 void BeginMainFrame(const BeginFrameArgs& args) override { 350 void BeginMainFrame(const BeginFrameArgs& args) override {
349 test_hooks_->BeginMainFrame(args); 351 test_hooks_->BeginMainFrame(args);
350 } 352 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 test_hooks_->DidCompleteSwapBuffers(); 394 test_hooks_->DidCompleteSwapBuffers();
393 } 395 }
394 396
395 void DidPostSwapBuffers() override {} 397 void DidPostSwapBuffers() override {}
396 void DidAbortSwapBuffers() override {} 398 void DidAbortSwapBuffers() override {}
397 void RequestScheduleComposite() override { test_hooks_->ScheduleComposite(); } 399 void RequestScheduleComposite() override { test_hooks_->ScheduleComposite(); }
398 void DidCompletePageScaleAnimation() override {} 400 void DidCompletePageScaleAnimation() override {}
399 void BeginMainFrameNotExpectedSoon() override {} 401 void BeginMainFrameNotExpectedSoon() override {}
400 402
401 void RecordFrameTimingEvents( 403 void RecordFrameTimingEvents(
402 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 404 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
403 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) 405 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events)
404 override {} 406 override {}
405 407
406 private: 408 private:
407 explicit LayerTreeHostClientForTesting(TestHooks* test_hooks) 409 explicit LayerTreeHostClientForTesting(TestHooks* test_hooks)
408 : test_hooks_(test_hooks) {} 410 : test_hooks_(test_hooks) {}
409 411
410 TestHooks* test_hooks_; 412 TestHooks* test_hooks_;
411 }; 413 };
412 414
413 // Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting. 415 // Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting.
414 class LayerTreeHostForTesting : public LayerTreeHost { 416 class LayerTreeHostForTesting : public LayerTreeHost {
415 public: 417 public:
416 static scoped_ptr<LayerTreeHostForTesting> Create( 418 static std::unique_ptr<LayerTreeHostForTesting> Create(
417 TestHooks* test_hooks, 419 TestHooks* test_hooks,
418 CompositorMode mode, 420 CompositorMode mode,
419 LayerTreeHostClientForTesting* client, 421 LayerTreeHostClientForTesting* client,
420 RemoteProtoChannel* remote_proto_channel, 422 RemoteProtoChannel* remote_proto_channel,
421 SharedBitmapManager* shared_bitmap_manager, 423 SharedBitmapManager* shared_bitmap_manager,
422 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 424 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
423 TaskGraphRunner* task_graph_runner, 425 TaskGraphRunner* task_graph_runner,
424 const LayerTreeSettings& settings, 426 const LayerTreeSettings& settings,
425 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 427 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
426 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 428 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
427 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 429 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
428 LayerTreeHost::InitParams params; 430 LayerTreeHost::InitParams params;
429 params.client = client; 431 params.client = client;
430 params.shared_bitmap_manager = shared_bitmap_manager; 432 params.shared_bitmap_manager = shared_bitmap_manager;
431 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; 433 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager;
432 params.task_graph_runner = task_graph_runner; 434 params.task_graph_runner = task_graph_runner;
433 params.settings = &settings; 435 params.settings = &settings;
434 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( 436 std::unique_ptr<LayerTreeHostForTesting> layer_tree_host(
435 new LayerTreeHostForTesting(test_hooks, &params, mode)); 437 new LayerTreeHostForTesting(test_hooks, &params, mode));
436 scoped_ptr<TaskRunnerProvider> task_runner_provider = 438 std::unique_ptr<TaskRunnerProvider> task_runner_provider =
437 TaskRunnerProvider::Create(main_task_runner, impl_task_runner); 439 TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
438 scoped_ptr<Proxy> proxy; 440 std::unique_ptr<Proxy> proxy;
439 switch (mode) { 441 switch (mode) {
440 case CompositorMode::SINGLE_THREADED: 442 case CompositorMode::SINGLE_THREADED:
441 proxy = SingleThreadProxyForTest::Create(test_hooks, 443 proxy = SingleThreadProxyForTest::Create(test_hooks,
442 layer_tree_host.get(), client, 444 layer_tree_host.get(), client,
443 task_runner_provider.get()); 445 task_runner_provider.get());
444 break; 446 break;
445 case CompositorMode::THREADED: 447 case CompositorMode::THREADED:
446 DCHECK(impl_task_runner.get()); 448 DCHECK(impl_task_runner.get());
447 proxy = ProxyMainForTest::CreateThreaded( 449 proxy = ProxyMainForTest::CreateThreaded(
448 test_hooks, layer_tree_host.get(), task_runner_provider.get()); 450 test_hooks, layer_tree_host.get(), task_runner_provider.get());
(...skipping 15 matching lines...) Expand all
464 layer_tree_host->SetOutputSurfaceLostForTesting(false); 466 layer_tree_host->SetOutputSurfaceLostForTesting(false);
465 } 467 }
466 break; 468 break;
467 } 469 }
468 layer_tree_host->InitializeForTesting( 470 layer_tree_host->InitializeForTesting(
469 std::move(task_runner_provider), std::move(proxy), 471 std::move(task_runner_provider), std::move(proxy),
470 std::move(external_begin_frame_source)); 472 std::move(external_begin_frame_source));
471 return layer_tree_host; 473 return layer_tree_host;
472 } 474 }
473 475
474 scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( 476 std::unique_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl(
475 LayerTreeHostImplClient* host_impl_client) override { 477 LayerTreeHostImplClient* host_impl_client) override {
476 return LayerTreeHostImplForTesting::Create( 478 return LayerTreeHostImplForTesting::Create(
477 test_hooks_, settings(), host_impl_client, task_runner_provider(), 479 test_hooks_, settings(), host_impl_client, task_runner_provider(),
478 shared_bitmap_manager(), gpu_memory_buffer_manager(), 480 shared_bitmap_manager(), gpu_memory_buffer_manager(),
479 task_graph_runner(), rendering_stats_instrumentation()); 481 task_graph_runner(), rendering_stats_instrumentation());
480 } 482 }
481 483
482 void SetNeedsCommit() override { 484 void SetNeedsCommit() override {
483 if (!test_started_) 485 if (!test_started_)
484 return; 486 return;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 657 }
656 658
657 void LayerTreeTest::PostNextCommitWaitsForActivationToMainThread() { 659 void LayerTreeTest::PostNextCommitWaitsForActivationToMainThread() {
658 main_task_runner_->PostTask( 660 main_task_runner_->PostTask(
659 FROM_HERE, 661 FROM_HERE,
660 base::Bind(&LayerTreeTest::DispatchNextCommitWaitsForActivation, 662 base::Bind(&LayerTreeTest::DispatchNextCommitWaitsForActivation,
661 main_thread_weak_ptr_)); 663 main_thread_weak_ptr_));
662 } 664 }
663 665
664 void LayerTreeTest::SetOutputSurfaceOnLayerTreeHost( 666 void LayerTreeTest::SetOutputSurfaceOnLayerTreeHost(
665 scoped_ptr<OutputSurface> output_surface) { 667 std::unique_ptr<OutputSurface> output_surface) {
666 if (IsRemoteTest()) { 668 if (IsRemoteTest()) {
667 DCHECK(remote_client_layer_tree_host_); 669 DCHECK(remote_client_layer_tree_host_);
668 remote_client_layer_tree_host_->SetOutputSurface(std::move(output_surface)); 670 remote_client_layer_tree_host_->SetOutputSurface(std::move(output_surface));
669 } else { 671 } else {
670 layer_tree_host_->SetOutputSurface(std::move(output_surface)); 672 layer_tree_host_->SetOutputSurface(std::move(output_surface));
671 } 673 }
672 } 674 }
673 675
674 scoped_ptr<OutputSurface> LayerTreeTest::ReleaseOutputSurfaceOnLayerTreeHost() { 676 std::unique_ptr<OutputSurface>
677 LayerTreeTest::ReleaseOutputSurfaceOnLayerTreeHost() {
675 if (IsRemoteTest()) { 678 if (IsRemoteTest()) {
676 DCHECK(remote_client_layer_tree_host_); 679 DCHECK(remote_client_layer_tree_host_);
677 return remote_client_layer_tree_host_->ReleaseOutputSurface(); 680 return remote_client_layer_tree_host_->ReleaseOutputSurface();
678 } 681 }
679 return layer_tree_host_->ReleaseOutputSurface(); 682 return layer_tree_host_->ReleaseOutputSurface();
680 } 683 }
681 684
682 void LayerTreeTest::SetVisibleOnLayerTreeHost(bool visible) { 685 void LayerTreeTest::SetVisibleOnLayerTreeHost(bool visible) {
683 layer_tree_host_->SetVisible(visible); 686 layer_tree_host_->SetVisible(visible);
684 687
685 if (IsRemoteTest()) { 688 if (IsRemoteTest()) {
686 DCHECK(remote_client_layer_tree_host_); 689 DCHECK(remote_client_layer_tree_host_);
687 remote_client_layer_tree_host_->SetVisible(visible); 690 remote_client_layer_tree_host_->SetVisible(visible);
688 } 691 }
689 } 692 }
690 693
691 void LayerTreeTest::WillBeginTest() { 694 void LayerTreeTest::WillBeginTest() {
692 SetVisibleOnLayerTreeHost(true); 695 SetVisibleOnLayerTreeHost(true);
693 } 696 }
694 697
695 void LayerTreeTest::DoBeginTest() { 698 void LayerTreeTest::DoBeginTest() {
696 client_ = LayerTreeHostClientForTesting::Create(this); 699 client_ = LayerTreeHostClientForTesting::Create(this);
697 700
698 scoped_ptr<FakeExternalBeginFrameSource> external_begin_frame_source; 701 std::unique_ptr<FakeExternalBeginFrameSource> external_begin_frame_source;
699 if (settings_.use_external_begin_frame_source) { 702 if (settings_.use_external_begin_frame_source) {
700 DCHECK(!IsRemoteTest()); 703 DCHECK(!IsRemoteTest());
701 external_begin_frame_source.reset(new FakeExternalBeginFrameSource( 704 external_begin_frame_source.reset(new FakeExternalBeginFrameSource(
702 settings_.renderer_settings.refresh_rate)); 705 settings_.renderer_settings.refresh_rate));
703 external_begin_frame_source_ = external_begin_frame_source.get(); 706 external_begin_frame_source_ = external_begin_frame_source.get();
704 } 707 }
705 708
706 DCHECK(!impl_thread_ || impl_thread_->task_runner().get()); 709 DCHECK(!impl_thread_ || impl_thread_->task_runner().get());
707 710
708 if (IsRemoteTest()) { 711 if (IsRemoteTest()) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 FAIL() << "Test timed out"; 901 FAIL() << "Test timed out";
899 return; 902 return;
900 } 903 }
901 AfterTest(); 904 AfterTest();
902 } 905 }
903 906
904 void LayerTreeTest::RequestNewOutputSurface() { 907 void LayerTreeTest::RequestNewOutputSurface() {
905 SetOutputSurfaceOnLayerTreeHost(CreateOutputSurface()); 908 SetOutputSurfaceOnLayerTreeHost(CreateOutputSurface());
906 } 909 }
907 910
908 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { 911 std::unique_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() {
909 scoped_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface(); 912 std::unique_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface();
910 DCHECK_EQ(delegating_renderer_, 913 DCHECK_EQ(delegating_renderer_,
911 output_surface->capabilities().delegated_rendering); 914 output_surface->capabilities().delegated_rendering);
912 output_surface_ = output_surface.get(); 915 output_surface_ = output_surface.get();
913 916
914 if (settings_.use_external_begin_frame_source && 917 if (settings_.use_external_begin_frame_source &&
915 settings_.wait_for_beginframe_interval) { 918 settings_.wait_for_beginframe_interval) {
916 DCHECK(external_begin_frame_source_); 919 DCHECK(external_begin_frame_source_);
917 } 920 }
918 return std::move(output_surface); 921 return std::move(output_surface);
919 } 922 }
920 923
921 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() { 924 std::unique_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() {
922 if (delegating_renderer_) 925 if (delegating_renderer_)
923 return FakeOutputSurface::CreateDelegating3d(); 926 return FakeOutputSurface::CreateDelegating3d();
924 else 927 else
925 return FakeOutputSurface::Create3d(); 928 return FakeOutputSurface::Create3d();
926 } 929 }
927 930
928 TestWebGraphicsContext3D* LayerTreeTest::TestContext() { 931 TestWebGraphicsContext3D* LayerTreeTest::TestContext() {
929 return static_cast<TestContextProvider*>(output_surface_->context_provider()) 932 return static_cast<TestContextProvider*>(output_surface_->context_provider())
930 ->TestContext3d(); 933 ->TestContext3d();
931 } 934 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1039
1037 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const { 1040 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const {
1038 DCHECK(IsRemoteTest()); 1041 DCHECK(IsRemoteTest());
1039 DCHECK(remote_client_layer_tree_host_); 1042 DCHECK(remote_client_layer_tree_host_);
1040 1043
1041 return static_cast<RemoteChannelImplForTest*>( 1044 return static_cast<RemoteChannelImplForTest*>(
1042 remote_client_layer_tree_host_->proxy()); 1045 remote_client_layer_tree_host_->proxy());
1043 } 1046 }
1044 1047
1045 } // namespace cc 1048 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/ordered_simple_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698