Chromium Code Reviews| 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 "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( | 111 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( |
| 112 tile_task_worker_pool, resource_pool); | 112 tile_task_worker_pool, resource_pool); |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Adapts ThreadProxy for test. Injects test hooks for testing. | 115 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 116 class ThreadProxyForTest : public ThreadProxy { | 116 class ThreadProxyForTest : public ThreadProxy { |
| 117 public: | 117 public: |
| 118 static scoped_ptr<Proxy> Create( | 118 static scoped_ptr<Proxy> Create( |
| 119 TestHooks* test_hooks, | 119 TestHooks* test_hooks, |
| 120 LayerTreeHost* host, | 120 LayerTreeHost* host, |
| 121 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 121 TaskRunnerProvider* task_runner_provider, |
| 122 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | |
| 123 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 122 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 124 return make_scoped_ptr(new ThreadProxyForTest( | 123 return make_scoped_ptr( |
| 125 test_hooks, | 124 new ThreadProxyForTest(test_hooks, host, task_runner_provider, |
| 126 host, | 125 external_begin_frame_source.Pass())); |
| 127 main_task_runner, | |
| 128 impl_task_runner, | |
| 129 external_begin_frame_source.Pass())); | |
| 130 } | 126 } |
| 131 | 127 |
| 132 ~ThreadProxyForTest() override {} | 128 ~ThreadProxyForTest() override {} |
| 133 | 129 |
| 134 private: | 130 private: |
| 135 TestHooks* test_hooks_; | 131 TestHooks* test_hooks_; |
| 136 | 132 |
| 137 void SetNeedsUpdateLayers() override { | 133 void SetNeedsUpdateLayers() override { |
| 138 ThreadProxy::SetNeedsUpdateLayers(); | 134 ThreadProxy::SetNeedsUpdateLayers(); |
| 139 test_hooks_->DidSetNeedsUpdateLayers(); | 135 test_hooks_->DidSetNeedsUpdateLayers(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 ThreadProxy::PostFrameTimingEventsOnMain(composite_events.Pass(), | 324 ThreadProxy::PostFrameTimingEventsOnMain(composite_events.Pass(), |
| 329 main_frame_events.Pass()); | 325 main_frame_events.Pass()); |
| 330 } | 326 } |
| 331 | 327 |
| 332 void BeginMainFrame(scoped_ptr<BeginMainFrameAndCommitState> | 328 void BeginMainFrame(scoped_ptr<BeginMainFrameAndCommitState> |
| 333 begin_main_frame_state) override { | 329 begin_main_frame_state) override { |
| 334 test_hooks_->ReceivedBeginMainFrame(); | 330 test_hooks_->ReceivedBeginMainFrame(); |
| 335 ThreadProxy::BeginMainFrame(begin_main_frame_state.Pass()); | 331 ThreadProxy::BeginMainFrame(begin_main_frame_state.Pass()); |
| 336 }; | 332 }; |
| 337 | 333 |
| 338 ThreadProxyForTest( | 334 ThreadProxyForTest(TestHooks* test_hooks, |
| 339 TestHooks* test_hooks, | 335 LayerTreeHost* host, |
| 340 LayerTreeHost* host, | 336 TaskRunnerProvider* task_runner_provider, |
| 341 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 337 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 342 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 338 : ThreadProxy(host, |
| 343 scoped_ptr<BeginFrameSource> external_begin_frame_source) | 339 task_runner_provider, |
| 344 : ThreadProxy(host, main_task_runner, | |
| 345 impl_task_runner, | |
| 346 external_begin_frame_source.Pass()), | 340 external_begin_frame_source.Pass()), |
| 347 test_hooks_(test_hooks) {} | 341 test_hooks_(test_hooks) {} |
| 348 }; | 342 }; |
| 349 | 343 |
| 350 // Adapts ThreadProxy for test. Injects test hooks for testing. | 344 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 351 class SingleThreadProxyForTest : public SingleThreadProxy { | 345 class SingleThreadProxyForTest : public SingleThreadProxy { |
| 352 public: | 346 public: |
| 353 static scoped_ptr<Proxy> Create( | 347 static scoped_ptr<Proxy> Create( |
| 354 TestHooks* test_hooks, | 348 TestHooks* test_hooks, |
| 355 LayerTreeHost* host, | 349 LayerTreeHost* host, |
| 356 LayerTreeHostSingleThreadClient* client, | 350 LayerTreeHostSingleThreadClient* client, |
| 357 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 351 TaskRunnerProvider* task_runner_provider, |
| 358 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 352 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 359 return make_scoped_ptr(new SingleThreadProxyForTest( | 353 return make_scoped_ptr(new SingleThreadProxyForTest( |
| 360 test_hooks, host, client, main_task_runner, | 354 test_hooks, host, client, task_runner_provider, |
| 361 external_begin_frame_source.Pass())); | 355 external_begin_frame_source.Pass())); |
| 362 } | 356 } |
| 363 | 357 |
| 364 ~SingleThreadProxyForTest() override {} | 358 ~SingleThreadProxyForTest() override {} |
| 365 | 359 |
| 366 private: | 360 private: |
| 367 TestHooks* test_hooks_; | 361 TestHooks* test_hooks_; |
| 368 | 362 |
| 369 void ScheduledActionSendBeginMainFrame() override { | 363 void ScheduledActionSendBeginMainFrame() override { |
| 370 test_hooks_->ScheduledActionWillSendBeginMainFrame(); | 364 test_hooks_->ScheduledActionWillSendBeginMainFrame(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 | 400 |
| 407 void SendBeginMainFrameNotExpectedSoon() override { | 401 void SendBeginMainFrameNotExpectedSoon() override { |
| 408 SingleThreadProxy::SendBeginMainFrameNotExpectedSoon(); | 402 SingleThreadProxy::SendBeginMainFrameNotExpectedSoon(); |
| 409 test_hooks_->SendBeginMainFrameNotExpectedSoon(); | 403 test_hooks_->SendBeginMainFrameNotExpectedSoon(); |
| 410 } | 404 } |
| 411 | 405 |
| 412 SingleThreadProxyForTest( | 406 SingleThreadProxyForTest( |
| 413 TestHooks* test_hooks, | 407 TestHooks* test_hooks, |
| 414 LayerTreeHost* host, | 408 LayerTreeHost* host, |
| 415 LayerTreeHostSingleThreadClient* client, | 409 LayerTreeHostSingleThreadClient* client, |
| 416 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 410 TaskRunnerProvider* task_runner_provider, |
| 417 scoped_ptr<BeginFrameSource> external_begin_frame_source) | 411 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 418 : SingleThreadProxy(host, client, main_task_runner, | 412 : SingleThreadProxy(host, |
| 413 client, | |
| 414 task_runner_provider, | |
| 419 external_begin_frame_source.Pass()), | 415 external_begin_frame_source.Pass()), |
| 420 test_hooks_(test_hooks) {} | 416 test_hooks_(test_hooks) {} |
| 421 }; | 417 }; |
| 422 | 418 |
| 423 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 419 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 424 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { | 420 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| 425 public: | 421 public: |
| 426 static scoped_ptr<LayerTreeHostImplForTesting> Create( | 422 static scoped_ptr<LayerTreeHostImplForTesting> Create( |
| 427 TestHooks* test_hooks, | 423 TestHooks* test_hooks, |
| 428 const LayerTreeSettings& settings, | 424 const LayerTreeSettings& settings, |
| 429 LayerTreeHostImplClient* host_impl_client, | 425 LayerTreeHostImplClient* host_impl_client, |
| 430 Proxy* proxy, | 426 TaskRunnerProvider* task_runner_provider, |
| 431 SharedBitmapManager* shared_bitmap_manager, | 427 SharedBitmapManager* shared_bitmap_manager, |
| 432 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 428 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 433 TaskGraphRunner* task_graph_runner, | 429 TaskGraphRunner* task_graph_runner, |
| 434 RenderingStatsInstrumentation* stats_instrumentation) { | 430 RenderingStatsInstrumentation* stats_instrumentation) { |
| 435 return make_scoped_ptr(new LayerTreeHostImplForTesting( | 431 return make_scoped_ptr(new LayerTreeHostImplForTesting( |
| 436 test_hooks, settings, host_impl_client, proxy, shared_bitmap_manager, | 432 test_hooks, settings, host_impl_client, task_runner_provider, |
| 437 gpu_memory_buffer_manager, task_graph_runner, stats_instrumentation)); | 433 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, |
| 434 stats_instrumentation)); | |
| 438 } | 435 } |
| 439 | 436 |
| 440 protected: | 437 protected: |
| 441 LayerTreeHostImplForTesting( | 438 LayerTreeHostImplForTesting( |
| 442 TestHooks* test_hooks, | 439 TestHooks* test_hooks, |
| 443 const LayerTreeSettings& settings, | 440 const LayerTreeSettings& settings, |
| 444 LayerTreeHostImplClient* host_impl_client, | 441 LayerTreeHostImplClient* host_impl_client, |
| 445 Proxy* proxy, | 442 TaskRunnerProvider* task_runner_provider, |
| 446 SharedBitmapManager* shared_bitmap_manager, | 443 SharedBitmapManager* shared_bitmap_manager, |
| 447 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 444 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 448 TaskGraphRunner* task_graph_runner, | 445 TaskGraphRunner* task_graph_runner, |
| 449 RenderingStatsInstrumentation* stats_instrumentation) | 446 RenderingStatsInstrumentation* stats_instrumentation) |
| 450 : LayerTreeHostImpl(settings, | 447 : LayerTreeHostImpl(settings, |
| 451 host_impl_client, | 448 host_impl_client, |
| 452 proxy, | 449 task_runner_provider, |
| 453 stats_instrumentation, | 450 stats_instrumentation, |
| 454 shared_bitmap_manager, | 451 shared_bitmap_manager, |
| 455 gpu_memory_buffer_manager, | 452 gpu_memory_buffer_manager, |
| 456 task_graph_runner, | 453 task_graph_runner, |
| 457 0), | 454 0), |
| 458 test_hooks_(test_hooks), | 455 test_hooks_(test_hooks), |
| 459 block_notify_ready_to_activate_for_testing_(false), | 456 block_notify_ready_to_activate_for_testing_(false), |
| 460 notify_ready_to_activate_was_blocked_(false) {} | 457 notify_ready_to_activate_was_blocked_(false) {} |
| 461 | 458 |
| 462 void CreateResourceAndTileTaskWorkerPool( | 459 void CreateResourceAndTileTaskWorkerPool( |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 694 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 698 LayerTreeHost::InitParams params; | 695 LayerTreeHost::InitParams params; |
| 699 params.client = client; | 696 params.client = client; |
| 700 params.shared_bitmap_manager = shared_bitmap_manager; | 697 params.shared_bitmap_manager = shared_bitmap_manager; |
| 701 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; | 698 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; |
| 702 params.task_graph_runner = task_graph_runner; | 699 params.task_graph_runner = task_graph_runner; |
| 703 params.settings = &settings; | 700 params.settings = &settings; |
| 704 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( | 701 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( |
| 705 new LayerTreeHostForTesting(test_hooks, ¶ms)); | 702 new LayerTreeHostForTesting(test_hooks, ¶ms)); |
| 706 if (impl_task_runner.get()) { | 703 if (impl_task_runner.get()) { |
| 707 layer_tree_host->InitializeForTesting( | 704 scoped_ptr<TaskRunnerProvider> task_runner_provider = |
| 708 ThreadProxyForTest::Create(test_hooks, | 705 TaskRunnerProvider::Create(main_task_runner, impl_task_runner); |
|
vmpstr
2015/11/10 21:59:34
Can you rework this a bit to highlight the differe
Khushal
2015/11/10 23:34:03
Done.
| |
| 709 layer_tree_host.get(), | 706 scoped_ptr<Proxy> proxy = ThreadProxyForTest::Create( |
| 710 main_task_runner, | 707 test_hooks, layer_tree_host.get(), task_runner_provider.get(), |
| 711 impl_task_runner, | 708 external_begin_frame_source.Pass()); |
| 712 external_begin_frame_source.Pass())); | 709 layer_tree_host->InitializeForTesting(task_runner_provider.Pass(), |
| 710 proxy.Pass()); | |
| 713 } else { | 711 } else { |
| 714 layer_tree_host->InitializeForTesting( | 712 scoped_ptr<TaskRunnerProvider> task_runner_provider = |
| 715 SingleThreadProxyForTest::Create( | 713 TaskRunnerProvider::Create(main_task_runner, nullptr); |
| 716 test_hooks, | 714 scoped_ptr<Proxy> proxy = SingleThreadProxyForTest::Create( |
| 717 layer_tree_host.get(), | 715 test_hooks, layer_tree_host.get(), client, task_runner_provider.get(), |
| 718 client, | 716 external_begin_frame_source.Pass()); |
| 719 main_task_runner, | 717 layer_tree_host->InitializeForTesting(task_runner_provider.Pass(), |
| 720 external_begin_frame_source.Pass())); | 718 proxy.Pass()); |
| 721 } | 719 } |
| 722 return layer_tree_host.Pass(); | 720 return layer_tree_host.Pass(); |
| 723 } | 721 } |
| 724 | 722 |
| 725 scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( | 723 scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( |
| 726 LayerTreeHostImplClient* host_impl_client) override { | 724 LayerTreeHostImplClient* host_impl_client) override { |
| 727 return LayerTreeHostImplForTesting::Create( | 725 return LayerTreeHostImplForTesting::Create( |
| 728 test_hooks_, settings(), host_impl_client, proxy(), | 726 test_hooks_, settings(), host_impl_client, task_runner_provider(), |
| 729 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 727 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
| 730 task_graph_runner(), rendering_stats_instrumentation()); | 728 task_graph_runner(), rendering_stats_instrumentation()); |
| 731 } | 729 } |
| 732 | 730 |
| 733 void SetNeedsCommit() override { | 731 void SetNeedsCommit() override { |
| 734 if (!test_started_) | 732 if (!test_started_) |
| 735 return; | 733 return; |
| 736 LayerTreeHost::SetNeedsCommit(); | 734 LayerTreeHost::SetNeedsCommit(); |
| 737 } | 735 } |
| 738 | 736 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 978 FROM_HERE, | 976 FROM_HERE, |
| 979 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); | 977 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); |
| 980 return; | 978 return; |
| 981 } | 979 } |
| 982 | 980 |
| 983 base::MessageLoop::current()->QuitWhenIdle(); | 981 base::MessageLoop::current()->QuitWhenIdle(); |
| 984 } | 982 } |
| 985 | 983 |
| 986 void LayerTreeTest::DispatchAddAnimation(Layer* layer_to_receive_animation, | 984 void LayerTreeTest::DispatchAddAnimation(Layer* layer_to_receive_animation, |
| 987 double animation_duration) { | 985 double animation_duration) { |
| 988 DCHECK(!proxy() || proxy()->IsMainThread()); | 986 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 989 | 987 |
| 990 if (layer_to_receive_animation) { | 988 if (layer_to_receive_animation) { |
| 991 AddOpacityTransitionToLayer( | 989 AddOpacityTransitionToLayer( |
| 992 layer_to_receive_animation, animation_duration, 0, 0.5, true); | 990 layer_to_receive_animation, animation_duration, 0, 0.5, true); |
| 993 } | 991 } |
| 994 } | 992 } |
| 995 | 993 |
| 996 void LayerTreeTest::DispatchAddAnimationToPlayer( | 994 void LayerTreeTest::DispatchAddAnimationToPlayer( |
| 997 AnimationPlayer* player_to_receive_animation, | 995 AnimationPlayer* player_to_receive_animation, |
| 998 double animation_duration) { | 996 double animation_duration) { |
| 999 DCHECK(!proxy() || proxy()->IsMainThread()); | 997 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1000 | 998 |
| 1001 if (player_to_receive_animation) { | 999 if (player_to_receive_animation) { |
| 1002 AddOpacityTransitionToPlayer(player_to_receive_animation, | 1000 AddOpacityTransitionToPlayer(player_to_receive_animation, |
| 1003 animation_duration, 0, 0.5, true); | 1001 animation_duration, 0, 0.5, true); |
| 1004 } | 1002 } |
| 1005 } | 1003 } |
| 1006 | 1004 |
| 1007 void LayerTreeTest::DispatchSetDeferCommits(bool defer_commits) { | 1005 void LayerTreeTest::DispatchSetDeferCommits(bool defer_commits) { |
| 1008 DCHECK(!proxy() || proxy()->IsMainThread()); | 1006 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1009 | 1007 |
| 1010 if (layer_tree_host_) | 1008 if (layer_tree_host_) |
| 1011 layer_tree_host_->SetDeferCommits(defer_commits); | 1009 layer_tree_host_->SetDeferCommits(defer_commits); |
| 1012 } | 1010 } |
| 1013 | 1011 |
| 1014 void LayerTreeTest::DispatchSetNeedsCommit() { | 1012 void LayerTreeTest::DispatchSetNeedsCommit() { |
| 1015 DCHECK(!proxy() || proxy()->IsMainThread()); | 1013 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1016 | 1014 |
| 1017 if (layer_tree_host_) | 1015 if (layer_tree_host_) |
| 1018 layer_tree_host_->SetNeedsCommit(); | 1016 layer_tree_host_->SetNeedsCommit(); |
| 1019 } | 1017 } |
| 1020 | 1018 |
| 1021 void LayerTreeTest::DispatchSetNeedsUpdateLayers() { | 1019 void LayerTreeTest::DispatchSetNeedsUpdateLayers() { |
| 1022 DCHECK(!proxy() || proxy()->IsMainThread()); | 1020 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1023 | 1021 |
| 1024 if (layer_tree_host_) | 1022 if (layer_tree_host_) |
| 1025 layer_tree_host_->SetNeedsUpdateLayers(); | 1023 layer_tree_host_->SetNeedsUpdateLayers(); |
| 1026 } | 1024 } |
| 1027 | 1025 |
| 1028 void LayerTreeTest::DispatchSetNeedsRedraw() { | 1026 void LayerTreeTest::DispatchSetNeedsRedraw() { |
| 1029 DCHECK(!proxy() || proxy()->IsMainThread()); | 1027 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1030 | 1028 |
| 1031 if (layer_tree_host_) | 1029 if (layer_tree_host_) |
| 1032 layer_tree_host_->SetNeedsRedraw(); | 1030 layer_tree_host_->SetNeedsRedraw(); |
| 1033 } | 1031 } |
| 1034 | 1032 |
| 1035 void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1033 void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| 1036 DCHECK(!proxy() || proxy()->IsMainThread()); | 1034 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1037 | 1035 |
| 1038 if (layer_tree_host_) | 1036 if (layer_tree_host_) |
| 1039 layer_tree_host_->SetNeedsRedrawRect(damage_rect); | 1037 layer_tree_host_->SetNeedsRedrawRect(damage_rect); |
| 1040 } | 1038 } |
| 1041 | 1039 |
| 1042 void LayerTreeTest::DispatchSetVisible(bool visible) { | 1040 void LayerTreeTest::DispatchSetVisible(bool visible) { |
| 1043 DCHECK(!proxy() || proxy()->IsMainThread()); | 1041 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1044 if (layer_tree_host_) | 1042 if (layer_tree_host_) |
| 1045 layer_tree_host_->SetVisible(visible); | 1043 layer_tree_host_->SetVisible(visible); |
| 1046 } | 1044 } |
| 1047 | 1045 |
| 1048 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { | 1046 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { |
| 1049 DCHECK(!proxy() || proxy()->IsMainThread()); | 1047 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1050 | 1048 |
| 1051 if (layer_tree_host_) | 1049 if (layer_tree_host_) |
| 1052 layer_tree_host_->SetNextCommitForcesRedraw(); | 1050 layer_tree_host_->SetNextCommitForcesRedraw(); |
| 1053 } | 1051 } |
| 1054 | 1052 |
| 1055 void LayerTreeTest::DispatchCompositeImmediately() { | 1053 void LayerTreeTest::DispatchCompositeImmediately() { |
| 1056 DCHECK(!proxy() || proxy()->IsMainThread()); | 1054 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread()); |
| 1057 if (layer_tree_host_) | 1055 if (layer_tree_host_) |
| 1058 layer_tree_host_->Composite(base::TimeTicks::Now()); | 1056 layer_tree_host_->Composite(base::TimeTicks::Now()); |
| 1059 } | 1057 } |
| 1060 | 1058 |
| 1061 void LayerTreeTest::RunTest(bool threaded, bool delegating_renderer) { | 1059 void LayerTreeTest::RunTest(bool threaded, bool delegating_renderer) { |
| 1062 if (threaded) { | 1060 if (threaded) { |
| 1063 impl_thread_.reset(new base::Thread("Compositor")); | 1061 impl_thread_.reset(new base::Thread("Compositor")); |
| 1064 ASSERT_TRUE(impl_thread_->Start()); | 1062 ASSERT_TRUE(impl_thread_->Start()); |
| 1065 } | 1063 } |
| 1066 | 1064 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1145 return -1; | 1143 return -1; |
| 1146 } | 1144 } |
| 1147 | 1145 |
| 1148 void LayerTreeTest::DestroyLayerTreeHost() { | 1146 void LayerTreeTest::DestroyLayerTreeHost() { |
| 1149 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 1147 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 1150 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 1148 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 1151 layer_tree_host_ = nullptr; | 1149 layer_tree_host_ = nullptr; |
| 1152 } | 1150 } |
| 1153 | 1151 |
| 1154 LayerTreeHost* LayerTreeTest::layer_tree_host() { | 1152 LayerTreeHost* LayerTreeTest::layer_tree_host() { |
| 1155 // We check for a null proxy here as we sometimes ask for the layer tree host | 1153 // We check for a null task_runner_provider here as we sometimes ask for the |
| 1156 // when the proxy does not exist, often for checking settings after a test has | 1154 // layer tree host when the task_runner_provider does not exist, often for |
| 1157 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See | 1155 // checking settings after a test has completed. For example, |
| 1158 // elsewhere in this file for other examples. | 1156 // LTHPixelResourceTest::RunPixelResourceTest. See elsewhere in this file for |
| 1159 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); | 1157 // other examples. |
| 1158 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread() || | |
| 1159 task_runner_provider()->IsMainThreadBlocked()); | |
| 1160 return layer_tree_host_.get(); | 1160 return layer_tree_host_.get(); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 } // namespace cc | 1163 } // namespace cc |
| OLD | NEW |