| 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" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 &LayerTreeTest::DispatchSetVisible, main_thread_weak_ptr_, visible)); | 506 &LayerTreeTest::DispatchSetVisible, main_thread_weak_ptr_, visible)); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() { | 509 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() { |
| 510 main_task_runner_->PostTask( | 510 main_task_runner_->PostTask( |
| 511 FROM_HERE, | 511 FROM_HERE, |
| 512 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw, | 512 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw, |
| 513 main_thread_weak_ptr_)); | 513 main_thread_weak_ptr_)); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void LayerTreeTest::PostCompositeImmediatelyToMainThread() { |
| 517 main_task_runner_->PostTask( |
| 518 FROM_HERE, |
| 519 base::Bind(&LayerTreeTest::DispatchCompositeImmediately, |
| 520 main_thread_weak_ptr_)); |
| 521 } |
| 522 |
| 516 void LayerTreeTest::WillBeginTest() { | 523 void LayerTreeTest::WillBeginTest() { |
| 517 layer_tree_host_->SetLayerTreeHostClientReady(); | 524 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 518 } | 525 } |
| 519 | 526 |
| 520 void LayerTreeTest::DoBeginTest() { | 527 void LayerTreeTest::DoBeginTest() { |
| 521 client_ = LayerTreeHostClientForTesting::Create(this); | 528 client_ = LayerTreeHostClientForTesting::Create(this); |
| 522 | 529 |
| 523 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); | 530 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); |
| 524 layer_tree_host_ = LayerTreeHostForTesting::Create( | 531 layer_tree_host_ = LayerTreeHostForTesting::Create( |
| 525 this, | 532 this, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 layer_tree_host_->SetVisible(visible); | 628 layer_tree_host_->SetVisible(visible); |
| 622 } | 629 } |
| 623 | 630 |
| 624 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { | 631 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { |
| 625 DCHECK(!proxy() || proxy()->IsMainThread()); | 632 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 626 | 633 |
| 627 if (layer_tree_host_) | 634 if (layer_tree_host_) |
| 628 layer_tree_host_->SetNextCommitForcesRedraw(); | 635 layer_tree_host_->SetNextCommitForcesRedraw(); |
| 629 } | 636 } |
| 630 | 637 |
| 638 void LayerTreeTest::DispatchCompositeImmediately() { |
| 639 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 640 if (layer_tree_host_) |
| 641 layer_tree_host_->Composite(gfx::FrameTime::Now()); |
| 642 } |
| 643 |
| 631 void LayerTreeTest::RunTest(bool threaded, | 644 void LayerTreeTest::RunTest(bool threaded, |
| 632 bool delegating_renderer, | 645 bool delegating_renderer, |
| 633 bool impl_side_painting) { | 646 bool impl_side_painting) { |
| 634 if (threaded) { | 647 if (threaded) { |
| 635 impl_thread_.reset(new base::Thread("Compositor")); | 648 impl_thread_.reset(new base::Thread("Compositor")); |
| 636 ASSERT_TRUE(impl_thread_->Start()); | 649 ASSERT_TRUE(impl_thread_->Start()); |
| 637 } | 650 } |
| 638 | 651 |
| 639 main_task_runner_ = base::MessageLoopProxy::current(); | 652 main_task_runner_ = base::MessageLoopProxy::current(); |
| 640 | 653 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 return -1; | 727 return -1; |
| 715 } | 728 } |
| 716 | 729 |
| 717 void LayerTreeTest::DestroyLayerTreeHost() { | 730 void LayerTreeTest::DestroyLayerTreeHost() { |
| 718 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 731 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 719 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 732 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 720 layer_tree_host_ = nullptr; | 733 layer_tree_host_ = nullptr; |
| 721 } | 734 } |
| 722 | 735 |
| 723 } // namespace cc | 736 } // namespace cc |
| OLD | NEW |