| 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/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 "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| 11 #include "cc/animation/timing_function.h" | 11 #include "cc/animation/timing_function.h" |
| 12 #include "cc/base/switches.h" | 12 #include "cc/base/switches.h" |
| 13 #include "cc/input/input_handler.h" | 13 #include "cc/input/input_handler.h" |
| 14 #include "cc/layers/content_layer.h" | 14 #include "cc/layers/content_layer.h" |
| 15 #include "cc/layers/layer.h" | 15 #include "cc/layers/layer.h" |
| 16 #include "cc/layers/layer_impl.h" | 16 #include "cc/layers/layer_impl.h" |
| 17 #include "cc/test/animation_test_common.h" | 17 #include "cc/test/animation_test_common.h" |
| 18 #include "cc/test/begin_frame_args_test.h" |
| 18 #include "cc/test/fake_layer_tree_host_client.h" | 19 #include "cc/test/fake_layer_tree_host_client.h" |
| 19 #include "cc/test/fake_output_surface.h" | 20 #include "cc/test/fake_output_surface.h" |
| 20 #include "cc/test/test_context_provider.h" | 21 #include "cc/test/test_context_provider.h" |
| 21 #include "cc/test/test_gpu_memory_buffer_manager.h" | 22 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 22 #include "cc/test/test_shared_bitmap_manager.h" | 23 #include "cc/test/test_shared_bitmap_manager.h" |
| 23 #include "cc/test/tiled_layer_test_common.h" | 24 #include "cc/test/tiled_layer_test_common.h" |
| 24 #include "cc/trees/layer_tree_host_client.h" | 25 #include "cc/trees/layer_tree_host_client.h" |
| 25 #include "cc/trees/layer_tree_host_impl.h" | 26 #include "cc/trees/layer_tree_host_impl.h" |
| 26 #include "cc/trees/layer_tree_host_single_thread_client.h" | 27 #include "cc/trees/layer_tree_host_single_thread_client.h" |
| 27 #include "cc/trees/layer_tree_impl.h" | 28 #include "cc/trees/layer_tree_impl.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 void TestHooks::CreateResourceAndRasterWorkerPool( | 48 void TestHooks::CreateResourceAndRasterWorkerPool( |
| 48 LayerTreeHostImpl* host_impl, | 49 LayerTreeHostImpl* host_impl, |
| 49 scoped_ptr<RasterWorkerPool>* raster_worker_pool, | 50 scoped_ptr<RasterWorkerPool>* raster_worker_pool, |
| 50 scoped_ptr<ResourcePool>* resource_pool, | 51 scoped_ptr<ResourcePool>* resource_pool, |
| 51 scoped_ptr<ResourcePool>* staging_resource_pool) { | 52 scoped_ptr<ResourcePool>* staging_resource_pool) { |
| 52 host_impl->LayerTreeHostImpl::CreateResourceAndRasterWorkerPool( | 53 host_impl->LayerTreeHostImpl::CreateResourceAndRasterWorkerPool( |
| 53 raster_worker_pool, resource_pool, staging_resource_pool); | 54 raster_worker_pool, resource_pool, staging_resource_pool); |
| 54 } | 55 } |
| 55 | 56 |
| 56 base::TimeDelta TestHooks::LowFrequencyAnimationInterval() const { | 57 class ExternalBeginFrameSourceForTest |
| 57 return base::TimeDelta::FromMilliseconds(16); | 58 : public BeginFrameSourceMixIn, |
| 58 } | 59 public NON_EXPORTED_BASE(base::NonThreadSafe) { |
| 60 public: |
| 61 explicit ExternalBeginFrameSourceForTest(double refresh_rate) |
| 62 : milliseconds_per_frame_(1000.0 / refresh_rate), |
| 63 is_ready_(false), |
| 64 weak_ptr_factory_(this) { |
| 65 DetachFromThread(); |
| 66 } |
| 67 |
| 68 virtual ~ExternalBeginFrameSourceForTest() { |
| 69 DCHECK(CalledOnValidThread()); |
| 70 } |
| 71 |
| 72 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) override { |
| 73 DCHECK(CalledOnValidThread()); |
| 74 if (needs_begin_frames) { |
| 75 base::MessageLoop::current()->PostDelayedTask( |
| 76 FROM_HERE, |
| 77 base::Bind(&ExternalBeginFrameSourceForTest::TestOnBeginFrame, |
| 78 weak_ptr_factory_.GetWeakPtr()), |
| 79 base::TimeDelta::FromMilliseconds(milliseconds_per_frame_)); |
| 80 } |
| 81 } |
| 82 |
| 83 virtual void SetClientReady() override { |
| 84 DCHECK(CalledOnValidThread()); |
| 85 is_ready_ = true; |
| 86 } |
| 87 |
| 88 bool is_ready() const { |
| 89 return is_ready_; |
| 90 } |
| 91 |
| 92 void TestOnBeginFrame() { |
| 93 DCHECK(CalledOnValidThread()); |
| 94 CallOnBeginFrame(CreateBeginFrameArgsForTesting()); |
| 95 } |
| 96 |
| 97 private: |
| 98 double milliseconds_per_frame_; |
| 99 bool is_ready_; |
| 100 base::WeakPtrFactory<ExternalBeginFrameSourceForTest> weak_ptr_factory_; |
| 101 }; |
| 59 | 102 |
| 60 // Adapts ThreadProxy for test. Injects test hooks for testing. | 103 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 61 class ThreadProxyForTest : public ThreadProxy { | 104 class ThreadProxyForTest : public ThreadProxy { |
| 62 public: | 105 public: |
| 63 static scoped_ptr<Proxy> Create( | 106 static scoped_ptr<Proxy> Create( |
| 64 TestHooks* test_hooks, | 107 TestHooks* test_hooks, |
| 65 LayerTreeHost* host, | 108 LayerTreeHost* host, |
| 66 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 109 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 67 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 110 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 111 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 68 return make_scoped_ptr(new ThreadProxyForTest( | 112 return make_scoped_ptr(new ThreadProxyForTest( |
| 69 test_hooks, host, main_task_runner, impl_task_runner)); | 113 test_hooks, |
| 114 host, |
| 115 main_task_runner, |
| 116 impl_task_runner, |
| 117 external_begin_frame_source.Pass())); |
| 70 } | 118 } |
| 71 | 119 |
| 72 ~ThreadProxyForTest() override {} | 120 ~ThreadProxyForTest() override {} |
| 73 | 121 |
| 74 void test() { | 122 void test() { |
| 75 test_hooks_->Layout(); | 123 test_hooks_->Layout(); |
| 76 } | 124 } |
| 77 | 125 |
| 78 private: | 126 private: |
| 79 TestHooks* test_hooks_; | 127 TestHooks* test_hooks_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 102 | 150 |
| 103 void ScheduledActionBeginOutputSurfaceCreation() override { | 151 void ScheduledActionBeginOutputSurfaceCreation() override { |
| 104 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); | 152 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); |
| 105 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); | 153 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); |
| 106 } | 154 } |
| 107 | 155 |
| 108 ThreadProxyForTest( | 156 ThreadProxyForTest( |
| 109 TestHooks* test_hooks, | 157 TestHooks* test_hooks, |
| 110 LayerTreeHost* host, | 158 LayerTreeHost* host, |
| 111 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 159 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 112 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 160 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 113 : ThreadProxy(host, main_task_runner, impl_task_runner), | 161 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 162 : ThreadProxy(host, main_task_runner, |
| 163 impl_task_runner, |
| 164 external_begin_frame_source.Pass()), |
| 114 test_hooks_(test_hooks) {} | 165 test_hooks_(test_hooks) {} |
| 115 }; | 166 }; |
| 116 | 167 |
| 117 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 168 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 118 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { | 169 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| 119 public: | 170 public: |
| 120 static scoped_ptr<LayerTreeHostImplForTesting> Create( | 171 static scoped_ptr<LayerTreeHostImplForTesting> Create( |
| 121 TestHooks* test_hooks, | 172 TestHooks* test_hooks, |
| 122 const LayerTreeSettings& settings, | 173 const LayerTreeSettings& settings, |
| 123 LayerTreeHostImplClient* host_impl_client, | 174 LayerTreeHostImplClient* host_impl_client, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 void ReclaimResources(const CompositorFrameAck* ack) override { | 258 void ReclaimResources(const CompositorFrameAck* ack) override { |
| 208 LayerTreeHostImpl::ReclaimResources(ack); | 259 LayerTreeHostImpl::ReclaimResources(ack); |
| 209 } | 260 } |
| 210 | 261 |
| 211 void UpdateVisibleTiles() override { | 262 void UpdateVisibleTiles() override { |
| 212 LayerTreeHostImpl::UpdateVisibleTiles(); | 263 LayerTreeHostImpl::UpdateVisibleTiles(); |
| 213 test_hooks_->UpdateVisibleTilesOnThread(this); | 264 test_hooks_->UpdateVisibleTilesOnThread(this); |
| 214 } | 265 } |
| 215 | 266 |
| 216 void NotifyReadyToActivate() override { | 267 void NotifyReadyToActivate() override { |
| 217 if (block_notify_ready_to_activate_for_testing_) | 268 if (block_notify_ready_to_activate_for_testing_) { |
| 218 notify_ready_to_activate_was_blocked_ = true; | 269 notify_ready_to_activate_was_blocked_ = true; |
| 219 else | 270 } else { |
| 220 client_->NotifyReadyToActivate(); | 271 client_->NotifyReadyToActivate(); |
| 272 test_hooks_->NotifyReadyToActivateOnThread(this); |
| 273 } |
| 274 } |
| 275 |
| 276 void NotifyReadyToDraw() override { |
| 277 client_->NotifyReadyToDraw(); |
| 278 test_hooks_->NotifyReadyToDrawOnThread(this); |
| 221 } | 279 } |
| 222 | 280 |
| 223 void BlockNotifyReadyToActivateForTesting(bool block) override { | 281 void BlockNotifyReadyToActivateForTesting(bool block) override { |
| 224 CHECK(settings().impl_side_painting); | 282 CHECK(settings().impl_side_painting); |
| 225 CHECK(proxy()->ImplThreadTaskRunner()) | 283 CHECK(proxy()->ImplThreadTaskRunner()) |
| 226 << "Not supported for single-threaded mode."; | 284 << "Not supported for single-threaded mode."; |
| 227 block_notify_ready_to_activate_for_testing_ = block; | 285 block_notify_ready_to_activate_for_testing_ = block; |
| 228 if (!block && notify_ready_to_activate_was_blocked_) { | 286 if (!block && notify_ready_to_activate_was_blocked_) { |
| 229 NotifyReadyToActivate(); | 287 NotifyReadyToActivate(); |
| 230 notify_ready_to_activate_was_blocked_ = false; | 288 notify_ready_to_activate_was_blocked_ = false; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 active_animation_controllers().begin(); | 320 active_animation_controllers().begin(); |
| 263 for (; iter != active_animation_controllers().end(); ++iter) { | 321 for (; iter != active_animation_controllers().end(); ++iter) { |
| 264 if (iter->second->HasActiveAnimation()) { | 322 if (iter->second->HasActiveAnimation()) { |
| 265 has_unfinished_animation = true; | 323 has_unfinished_animation = true; |
| 266 break; | 324 break; |
| 267 } | 325 } |
| 268 } | 326 } |
| 269 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); | 327 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); |
| 270 } | 328 } |
| 271 | 329 |
| 272 base::TimeDelta LowFrequencyAnimationInterval() const override { | |
| 273 return test_hooks_->LowFrequencyAnimationInterval(); | |
| 274 } | |
| 275 | |
| 276 private: | 330 private: |
| 277 TestHooks* test_hooks_; | 331 TestHooks* test_hooks_; |
| 278 bool block_notify_ready_to_activate_for_testing_; | 332 bool block_notify_ready_to_activate_for_testing_; |
| 279 bool notify_ready_to_activate_was_blocked_; | 333 bool notify_ready_to_activate_was_blocked_; |
| 280 }; | 334 }; |
| 281 | 335 |
| 282 // Implementation of LayerTreeHost callback interface. | 336 // Implementation of LayerTreeHost callback interface. |
| 283 class LayerTreeHostClientForTesting : public LayerTreeHostClient, | 337 class LayerTreeHostClientForTesting : public LayerTreeHostClient, |
| 284 public LayerTreeHostSingleThreadClient { | 338 public LayerTreeHostSingleThreadClient { |
| 285 public: | 339 public: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 }; | 408 }; |
| 355 | 409 |
| 356 // Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting. | 410 // Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting. |
| 357 class LayerTreeHostForTesting : public LayerTreeHost { | 411 class LayerTreeHostForTesting : public LayerTreeHost { |
| 358 public: | 412 public: |
| 359 static scoped_ptr<LayerTreeHostForTesting> Create( | 413 static scoped_ptr<LayerTreeHostForTesting> Create( |
| 360 TestHooks* test_hooks, | 414 TestHooks* test_hooks, |
| 361 LayerTreeHostClientForTesting* client, | 415 LayerTreeHostClientForTesting* client, |
| 362 const LayerTreeSettings& settings, | 416 const LayerTreeSettings& settings, |
| 363 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 417 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 364 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 418 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 419 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 365 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( | 420 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( |
| 366 new LayerTreeHostForTesting(test_hooks, client, settings)); | 421 new LayerTreeHostForTesting(test_hooks, client, settings)); |
| 367 if (impl_task_runner.get()) { | 422 if (impl_task_runner.get()) { |
| 368 layer_tree_host->InitializeForTesting( | 423 layer_tree_host->InitializeForTesting( |
| 369 ThreadProxyForTest::Create(test_hooks, | 424 ThreadProxyForTest::Create(test_hooks, |
| 370 layer_tree_host.get(), | 425 layer_tree_host.get(), |
| 371 main_task_runner, | 426 main_task_runner, |
| 372 impl_task_runner)); | 427 impl_task_runner, |
| 428 external_begin_frame_source.Pass())); |
| 373 } else { | 429 } else { |
| 374 layer_tree_host->InitializeForTesting(SingleThreadProxy::Create( | 430 layer_tree_host->InitializeForTesting(SingleThreadProxy::Create( |
| 375 layer_tree_host.get(), client, main_task_runner)); | 431 layer_tree_host.get(), |
| 432 client, |
| 433 main_task_runner, |
| 434 external_begin_frame_source.Pass())); |
| 376 } | 435 } |
| 377 return layer_tree_host.Pass(); | 436 return layer_tree_host.Pass(); |
| 378 } | 437 } |
| 379 | 438 |
| 380 scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( | 439 scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( |
| 381 LayerTreeHostImplClient* host_impl_client) override { | 440 LayerTreeHostImplClient* host_impl_client) override { |
| 382 return LayerTreeHostImplForTesting::Create( | 441 return LayerTreeHostImplForTesting::Create( |
| 383 test_hooks_, | 442 test_hooks_, |
| 384 settings(), | 443 settings(), |
| 385 host_impl_client, | 444 host_impl_client, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 410 test_started_(false) {} | 469 test_started_(false) {} |
| 411 | 470 |
| 412 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; | 471 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; |
| 413 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 472 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 414 TestHooks* test_hooks_; | 473 TestHooks* test_hooks_; |
| 415 bool test_started_; | 474 bool test_started_; |
| 416 }; | 475 }; |
| 417 | 476 |
| 418 LayerTreeTest::LayerTreeTest() | 477 LayerTreeTest::LayerTreeTest() |
| 419 : output_surface_(nullptr), | 478 : output_surface_(nullptr), |
| 479 external_begin_frame_source_(nullptr), |
| 420 beginning_(false), | 480 beginning_(false), |
| 421 end_when_begin_returns_(false), | 481 end_when_begin_returns_(false), |
| 422 timed_out_(false), | 482 timed_out_(false), |
| 423 scheduled_(false), | 483 scheduled_(false), |
| 424 started_(false), | 484 started_(false), |
| 425 ended_(false), | 485 ended_(false), |
| 426 delegating_renderer_(false), | 486 delegating_renderer_(false), |
| 427 timeout_seconds_(0), | 487 timeout_seconds_(0), |
| 428 weak_factory_(this) { | 488 weak_factory_(this) { |
| 429 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); | 489 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 main_thread_weak_ptr_)); | 599 main_thread_weak_ptr_)); |
| 540 } | 600 } |
| 541 | 601 |
| 542 void LayerTreeTest::WillBeginTest() { | 602 void LayerTreeTest::WillBeginTest() { |
| 543 layer_tree_host_->SetLayerTreeHostClientReady(); | 603 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 544 } | 604 } |
| 545 | 605 |
| 546 void LayerTreeTest::DoBeginTest() { | 606 void LayerTreeTest::DoBeginTest() { |
| 547 client_ = LayerTreeHostClientForTesting::Create(this); | 607 client_ = LayerTreeHostClientForTesting::Create(this); |
| 548 | 608 |
| 609 scoped_ptr<ExternalBeginFrameSourceForTest> external_begin_frame_source; |
| 610 if (settings_.use_external_begin_frame_source && |
| 611 settings_.throttle_frame_production) { |
| 612 external_begin_frame_source.reset( |
| 613 new ExternalBeginFrameSourceForTest(settings_.refresh_rate)); |
| 614 external_begin_frame_source_ = external_begin_frame_source.get(); |
| 615 } |
| 616 |
| 549 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); | 617 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); |
| 550 layer_tree_host_ = LayerTreeHostForTesting::Create( | 618 layer_tree_host_ = LayerTreeHostForTesting::Create( |
| 551 this, | 619 this, |
| 552 client_.get(), | 620 client_.get(), |
| 553 settings_, | 621 settings_, |
| 554 base::MessageLoopProxy::current(), | 622 base::MessageLoopProxy::current(), |
| 555 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL); | 623 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL, |
| 624 external_begin_frame_source.Pass()); |
| 556 ASSERT_TRUE(layer_tree_host_); | 625 ASSERT_TRUE(layer_tree_host_); |
| 557 | 626 |
| 558 started_ = true; | 627 started_ = true; |
| 559 beginning_ = true; | 628 beginning_ = true; |
| 560 SetupTree(); | 629 SetupTree(); |
| 561 WillBeginTest(); | 630 WillBeginTest(); |
| 562 BeginTest(); | 631 BeginTest(); |
| 563 beginning_ = false; | 632 beginning_ = false; |
| 564 if (end_when_begin_returns_) | 633 if (end_when_begin_returns_) |
| 565 RealEndTest(); | 634 RealEndTest(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 ASSERT_TRUE(impl_thread_->Start()); | 737 ASSERT_TRUE(impl_thread_->Start()); |
| 669 } | 738 } |
| 670 | 739 |
| 671 main_task_runner_ = base::MessageLoopProxy::current(); | 740 main_task_runner_ = base::MessageLoopProxy::current(); |
| 672 | 741 |
| 673 delegating_renderer_ = delegating_renderer; | 742 delegating_renderer_ = delegating_renderer; |
| 674 | 743 |
| 675 // Spend less time waiting for BeginFrame because the output is | 744 // Spend less time waiting for BeginFrame because the output is |
| 676 // mocked out. | 745 // mocked out. |
| 677 settings_.refresh_rate = 200.0; | 746 settings_.refresh_rate = 200.0; |
| 747 settings_.background_animation_rate = 200.0; |
| 678 settings_.impl_side_painting = impl_side_painting; | 748 settings_.impl_side_painting = impl_side_painting; |
| 679 InitializeSettings(&settings_); | 749 InitializeSettings(&settings_); |
| 680 | 750 |
| 681 main_task_runner_->PostTask( | 751 main_task_runner_->PostTask( |
| 682 FROM_HERE, | 752 FROM_HERE, |
| 683 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); | 753 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); |
| 684 | 754 |
| 685 if (timeout_seconds_) { | 755 if (timeout_seconds_) { |
| 686 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); | 756 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); |
| 687 main_task_runner_->PostDelayedTask( | 757 main_task_runner_->PostDelayedTask( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 713 } | 783 } |
| 714 | 784 |
| 715 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) { | 785 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) { |
| 716 scoped_ptr<FakeOutputSurface> output_surface = | 786 scoped_ptr<FakeOutputSurface> output_surface = |
| 717 CreateFakeOutputSurface(fallback); | 787 CreateFakeOutputSurface(fallback); |
| 718 if (output_surface) { | 788 if (output_surface) { |
| 719 DCHECK_EQ(delegating_renderer_, | 789 DCHECK_EQ(delegating_renderer_, |
| 720 output_surface->capabilities().delegated_rendering); | 790 output_surface->capabilities().delegated_rendering); |
| 721 } | 791 } |
| 722 output_surface_ = output_surface.get(); | 792 output_surface_ = output_surface.get(); |
| 793 |
| 794 if (settings_.use_external_begin_frame_source && |
| 795 settings_.throttle_frame_production) { |
| 796 DCHECK(external_begin_frame_source_); |
| 797 DCHECK(external_begin_frame_source_->is_ready()); |
| 798 } |
| 723 return output_surface.Pass(); | 799 return output_surface.Pass(); |
| 724 } | 800 } |
| 725 | 801 |
| 726 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface( | 802 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface( |
| 727 bool fallback) { | 803 bool fallback) { |
| 728 if (delegating_renderer_) | 804 if (delegating_renderer_) |
| 729 return FakeOutputSurface::CreateDelegating3d(); | 805 return FakeOutputSurface::CreateDelegating3d(); |
| 730 else | 806 else |
| 731 return FakeOutputSurface::Create3d(); | 807 return FakeOutputSurface::Create3d(); |
| 732 } | 808 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 746 return -1; | 822 return -1; |
| 747 } | 823 } |
| 748 | 824 |
| 749 void LayerTreeTest::DestroyLayerTreeHost() { | 825 void LayerTreeTest::DestroyLayerTreeHost() { |
| 750 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 826 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 751 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 827 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 752 layer_tree_host_ = nullptr; | 828 layer_tree_host_ = nullptr; |
| 753 } | 829 } |
| 754 | 830 |
| 755 } // namespace cc | 831 } // namespace cc |
| OLD | NEW |