| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 void LayerTreeTest::ScheduleComposite() { | 518 void LayerTreeTest::ScheduleComposite() { |
| 519 if (!started_ || scheduled_) | 519 if (!started_ || scheduled_) |
| 520 return; | 520 return; |
| 521 scheduled_ = true; | 521 scheduled_ = true; |
| 522 main_task_runner_->PostTask( | 522 main_task_runner_->PostTask( |
| 523 FROM_HERE, | 523 FROM_HERE, |
| 524 base::Bind(&LayerTreeTest::DispatchComposite, main_thread_weak_ptr_)); | 524 base::Bind(&LayerTreeTest::DispatchComposite, main_thread_weak_ptr_)); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void LayerTreeTest::ScheduleAnimation() { |
| 528 ScheduleComposite(); |
| 529 } |
| 530 |
| 527 void LayerTreeTest::RealEndTest() { | 531 void LayerTreeTest::RealEndTest() { |
| 528 if (layer_tree_host_ && proxy()->CommitPendingForTesting()) { | 532 if (layer_tree_host_ && proxy()->CommitPendingForTesting()) { |
| 529 main_task_runner_->PostTask( | 533 main_task_runner_->PostTask( |
| 530 FROM_HERE, | 534 FROM_HERE, |
| 531 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); | 535 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); |
| 532 return; | 536 return; |
| 533 } | 537 } |
| 534 | 538 |
| 535 base::MessageLoop::current()->Quit(); | 539 base::MessageLoop::current()->Quit(); |
| 536 } | 540 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 // If the LTH is being made visible and a previous ScheduleComposite() was | 607 // If the LTH is being made visible and a previous ScheduleComposite() was |
| 604 // deferred because the LTH was not visible, re-schedule the composite now. | 608 // deferred because the LTH was not visible, re-schedule the composite now. |
| 605 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) | 609 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) |
| 606 ScheduleComposite(); | 610 ScheduleComposite(); |
| 607 } | 611 } |
| 608 | 612 |
| 609 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { | 613 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { |
| 610 DCHECK(!proxy() || proxy()->IsMainThread()); | 614 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 611 | 615 |
| 612 if (layer_tree_host_) | 616 if (layer_tree_host_) |
| 613 layer_tree_host_->SetNextCommitForcesRedraw(); | 617 layer_tree_host_->set_next_commit_forces_redraw(); |
| 614 } | 618 } |
| 615 | 619 |
| 616 void LayerTreeTest::DispatchComposite() { | 620 void LayerTreeTest::DispatchComposite() { |
| 617 scheduled_ = false; | 621 scheduled_ = false; |
| 618 | 622 |
| 619 if (!layer_tree_host_) | 623 if (!layer_tree_host_) |
| 620 return; | 624 return; |
| 621 | 625 |
| 622 // If the LTH is not visible, defer the composite until the LTH is made | 626 // If the LTH is not visible, defer the composite until the LTH is made |
| 623 // visible. | 627 // visible. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 } | 700 } |
| 697 | 701 |
| 698 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { | 702 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { |
| 699 if (!compositor_contexts_.get() || | 703 if (!compositor_contexts_.get() || |
| 700 compositor_contexts_->DestroyedOnMainThread()) | 704 compositor_contexts_->DestroyedOnMainThread()) |
| 701 compositor_contexts_ = TestContextProvider::Create(); | 705 compositor_contexts_ = TestContextProvider::Create(); |
| 702 return compositor_contexts_; | 706 return compositor_contexts_; |
| 703 } | 707 } |
| 704 | 708 |
| 705 } // namespace cc | 709 } // namespace cc |
| OLD | NEW |