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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 407 } |
408 | 408 |
409 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) { | 409 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) { |
410 proxy()->MainThreadTaskRunner()->PostTask( | 410 proxy()->MainThreadTaskRunner()->PostTask( |
411 FROM_HERE, | 411 FROM_HERE, |
412 base::Bind(&LayerTreeTest::DispatchSetVisible, | 412 base::Bind(&LayerTreeTest::DispatchSetVisible, |
413 main_thread_weak_ptr_, | 413 main_thread_weak_ptr_, |
414 visible)); | 414 visible)); |
415 } | 415 } |
416 | 416 |
| 417 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() { |
| 418 proxy()->MainThreadTaskRunner()->PostTask( |
| 419 FROM_HERE, |
| 420 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw, |
| 421 main_thread_weak_ptr_)); |
| 422 } |
| 423 |
417 void LayerTreeTest::DoBeginTest() { | 424 void LayerTreeTest::DoBeginTest() { |
418 client_ = LayerTreeHostClientForTesting::Create(this); | 425 client_ = LayerTreeHostClientForTesting::Create(this); |
419 | 426 |
420 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); | 427 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); |
421 layer_tree_host_ = LayerTreeHostForTesting::Create( | 428 layer_tree_host_ = LayerTreeHostForTesting::Create( |
422 this, | 429 this, |
423 client_.get(), | 430 client_.get(), |
424 settings_, | 431 settings_, |
425 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL); | 432 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL); |
426 ASSERT_TRUE(layer_tree_host_); | 433 ASSERT_TRUE(layer_tree_host_); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 return; | 558 return; |
552 | 559 |
553 layer_tree_host_->SetVisible(visible); | 560 layer_tree_host_->SetVisible(visible); |
554 | 561 |
555 // If the LTH is being made visible and a previous ScheduleComposite() was | 562 // If the LTH is being made visible and a previous ScheduleComposite() was |
556 // deferred because the LTH was not visible, re-schedule the composite now. | 563 // deferred because the LTH was not visible, re-schedule the composite now. |
557 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) | 564 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) |
558 ScheduleComposite(); | 565 ScheduleComposite(); |
559 } | 566 } |
560 | 567 |
| 568 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { |
| 569 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 570 |
| 571 if (layer_tree_host_) |
| 572 layer_tree_host_->SetNextCommitForcesRedraw(); |
| 573 } |
| 574 |
561 void LayerTreeTest::DispatchComposite() { | 575 void LayerTreeTest::DispatchComposite() { |
562 scheduled_ = false; | 576 scheduled_ = false; |
563 | 577 |
564 if (!layer_tree_host_) | 578 if (!layer_tree_host_) |
565 return; | 579 return; |
566 | 580 |
567 // If the LTH is not visible, defer the composite until the LTH is made | 581 // If the LTH is not visible, defer the composite until the LTH is made |
568 // visible. | 582 // visible. |
569 if (!layer_tree_host_->visible()) { | 583 if (!layer_tree_host_->visible()) { |
570 schedule_when_set_visible_true_ = true; | 584 schedule_when_set_visible_true_ = true; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 651 } |
638 | 652 |
639 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { | 653 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { |
640 if (!compositor_contexts_.get() || | 654 if (!compositor_contexts_.get() || |
641 compositor_contexts_->DestroyedOnMainThread()) | 655 compositor_contexts_->DestroyedOnMainThread()) |
642 compositor_contexts_ = TestContextProvider::Create(); | 656 compositor_contexts_ = TestContextProvider::Create(); |
643 return compositor_contexts_; | 657 return compositor_contexts_; |
644 } | 658 } |
645 | 659 |
646 } // namespace cc | 660 } // namespace cc |
OLD | NEW |