| 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 508 |
| 509 void LayerTreeTest::ScheduleComposite() { | 509 void LayerTreeTest::ScheduleComposite() { |
| 510 if (!started_ || scheduled_) | 510 if (!started_ || scheduled_) |
| 511 return; | 511 return; |
| 512 scheduled_ = true; | 512 scheduled_ = true; |
| 513 main_task_runner_->PostTask( | 513 main_task_runner_->PostTask( |
| 514 FROM_HERE, | 514 FROM_HERE, |
| 515 base::Bind(&LayerTreeTest::DispatchComposite, main_thread_weak_ptr_)); | 515 base::Bind(&LayerTreeTest::DispatchComposite, main_thread_weak_ptr_)); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void LayerTreeTest::ScheduleAnimation() { |
| 519 ScheduleComposite(); |
| 520 } |
| 521 |
| 518 void LayerTreeTest::RealEndTest() { | 522 void LayerTreeTest::RealEndTest() { |
| 519 if (layer_tree_host_ && proxy()->CommitPendingForTesting()) { | 523 if (layer_tree_host_ && proxy()->CommitPendingForTesting()) { |
| 520 main_task_runner_->PostTask( | 524 main_task_runner_->PostTask( |
| 521 FROM_HERE, | 525 FROM_HERE, |
| 522 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); | 526 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); |
| 523 return; | 527 return; |
| 524 } | 528 } |
| 525 | 529 |
| 526 base::MessageLoop::current()->Quit(); | 530 base::MessageLoop::current()->Quit(); |
| 527 } | 531 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 // If the LTH is being made visible and a previous ScheduleComposite() was | 598 // If the LTH is being made visible and a previous ScheduleComposite() was |
| 595 // deferred because the LTH was not visible, re-schedule the composite now. | 599 // deferred because the LTH was not visible, re-schedule the composite now. |
| 596 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) | 600 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) |
| 597 ScheduleComposite(); | 601 ScheduleComposite(); |
| 598 } | 602 } |
| 599 | 603 |
| 600 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { | 604 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { |
| 601 DCHECK(!proxy() || proxy()->IsMainThread()); | 605 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 602 | 606 |
| 603 if (layer_tree_host_) | 607 if (layer_tree_host_) |
| 604 layer_tree_host_->SetNextCommitForcesRedraw(); | 608 layer_tree_host_->set_next_commit_forces_redraw(); |
| 605 } | 609 } |
| 606 | 610 |
| 607 void LayerTreeTest::DispatchComposite() { | 611 void LayerTreeTest::DispatchComposite() { |
| 608 scheduled_ = false; | 612 scheduled_ = false; |
| 609 | 613 |
| 610 if (!layer_tree_host_) | 614 if (!layer_tree_host_) |
| 611 return; | 615 return; |
| 612 | 616 |
| 613 // If the LTH is not visible, defer the composite until the LTH is made | 617 // If the LTH is not visible, defer the composite until the LTH is made |
| 614 // visible. | 618 // visible. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 691 } |
| 688 | 692 |
| 689 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { | 693 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { |
| 690 if (!compositor_contexts_.get() || | 694 if (!compositor_contexts_.get() || |
| 691 compositor_contexts_->DestroyedOnMainThread()) | 695 compositor_contexts_->DestroyedOnMainThread()) |
| 692 compositor_contexts_ = TestContextProvider::Create(); | 696 compositor_contexts_ = TestContextProvider::Create(); |
| 693 return compositor_contexts_; | 697 return compositor_contexts_; |
| 694 } | 698 } |
| 695 | 699 |
| 696 } // namespace cc | 700 } // namespace cc |
| OLD | NEW |