Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 667793004: Support single-threaded impl-side painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now with less plumbing Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 &LayerTreeTest::DispatchSetVisible, main_thread_weak_ptr_, visible)); 507 &LayerTreeTest::DispatchSetVisible, main_thread_weak_ptr_, visible));
508 } 508 }
509 509
510 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() { 510 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() {
511 main_task_runner_->PostTask( 511 main_task_runner_->PostTask(
512 FROM_HERE, 512 FROM_HERE,
513 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw, 513 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw,
514 main_thread_weak_ptr_)); 514 main_thread_weak_ptr_));
515 } 515 }
516 516
517 void LayerTreeTest::PostCompositeImmediatelyToMainThread() {
518 main_task_runner_->PostTask(
519 FROM_HERE,
520 base::Bind(&LayerTreeTest::DispatchCompositeImmediately,
521 main_thread_weak_ptr_));
522 }
523
517 void LayerTreeTest::WillBeginTest() { 524 void LayerTreeTest::WillBeginTest() {
518 layer_tree_host_->SetLayerTreeHostClientReady(); 525 layer_tree_host_->SetLayerTreeHostClientReady();
519 } 526 }
520 527
521 void LayerTreeTest::DoBeginTest() { 528 void LayerTreeTest::DoBeginTest() {
522 client_ = LayerTreeHostClientForTesting::Create(this); 529 client_ = LayerTreeHostClientForTesting::Create(this);
523 530
524 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); 531 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get());
525 layer_tree_host_ = LayerTreeHostForTesting::Create( 532 layer_tree_host_ = LayerTreeHostForTesting::Create(
526 this, 533 this,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 layer_tree_host_->SetVisible(visible); 629 layer_tree_host_->SetVisible(visible);
623 } 630 }
624 631
625 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { 632 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() {
626 DCHECK(!proxy() || proxy()->IsMainThread()); 633 DCHECK(!proxy() || proxy()->IsMainThread());
627 634
628 if (layer_tree_host_) 635 if (layer_tree_host_)
629 layer_tree_host_->SetNextCommitForcesRedraw(); 636 layer_tree_host_->SetNextCommitForcesRedraw();
630 } 637 }
631 638
639 void LayerTreeTest::DispatchCompositeImmediately() {
640 DCHECK(!proxy() || proxy()->IsMainThread());
641 if (layer_tree_host_)
642 layer_tree_host_->Composite(gfx::FrameTime::Now());
643 }
644
632 void LayerTreeTest::RunTest(bool threaded, 645 void LayerTreeTest::RunTest(bool threaded,
633 bool delegating_renderer, 646 bool delegating_renderer,
634 bool impl_side_painting) { 647 bool impl_side_painting) {
635 if (threaded) { 648 if (threaded) {
636 impl_thread_.reset(new base::Thread("Compositor")); 649 impl_thread_.reset(new base::Thread("Compositor"));
637 ASSERT_TRUE(impl_thread_->Start()); 650 ASSERT_TRUE(impl_thread_->Start());
638 } 651 }
639 652
640 main_task_runner_ = base::MessageLoopProxy::current(); 653 main_task_runner_ = base::MessageLoopProxy::current();
641 654
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 return -1; 728 return -1;
716 } 729 }
717 730
718 void LayerTreeTest::DestroyLayerTreeHost() { 731 void LayerTreeTest::DestroyLayerTreeHost() {
719 if (layer_tree_host_ && layer_tree_host_->root_layer()) 732 if (layer_tree_host_ && layer_tree_host_->root_layer())
720 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 733 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
721 layer_tree_host_ = nullptr; 734 layer_tree_host_ = nullptr;
722 } 735 }
723 736
724 } // namespace cc 737 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698