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

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: Use numeric limits for raster task limit 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698