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

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

Issue 811523002: Added ability to dynamically toggle frame throttling in the scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests for SetThrottleFrameProduction Created 6 years 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 563 }
564 564
565 void LayerTreeTest::WillBeginTest() { 565 void LayerTreeTest::WillBeginTest() {
566 layer_tree_host_->SetLayerTreeHostClientReady(); 566 layer_tree_host_->SetLayerTreeHostClientReady();
567 } 567 }
568 568
569 void LayerTreeTest::DoBeginTest() { 569 void LayerTreeTest::DoBeginTest() {
570 client_ = LayerTreeHostClientForTesting::Create(this); 570 client_ = LayerTreeHostClientForTesting::Create(this);
571 571
572 scoped_ptr<FakeExternalBeginFrameSource> external_begin_frame_source; 572 scoped_ptr<FakeExternalBeginFrameSource> external_begin_frame_source;
573 if (settings_.use_external_begin_frame_source && 573 if (settings_.use_external_begin_frame_source) {
574 settings_.throttle_frame_production) {
575 external_begin_frame_source.reset(new FakeExternalBeginFrameSource( 574 external_begin_frame_source.reset(new FakeExternalBeginFrameSource(
576 settings_.renderer_settings.refresh_rate)); 575 settings_.renderer_settings.refresh_rate));
577 external_begin_frame_source_ = external_begin_frame_source.get(); 576 external_begin_frame_source_ = external_begin_frame_source.get();
578 } 577 }
579 578
580 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); 579 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get());
581 layer_tree_host_ = LayerTreeHostForTesting::Create( 580 layer_tree_host_ = LayerTreeHostForTesting::Create(
582 this, 581 this,
583 client_.get(), 582 client_.get(),
584 settings_, 583 settings_,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 void LayerTreeTest::RequestNewOutputSurface() { 744 void LayerTreeTest::RequestNewOutputSurface() {
746 layer_tree_host_->SetOutputSurface(CreateOutputSurface()); 745 layer_tree_host_->SetOutputSurface(CreateOutputSurface());
747 } 746 }
748 747
749 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { 748 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() {
750 scoped_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface(); 749 scoped_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface();
751 DCHECK_EQ(delegating_renderer_, 750 DCHECK_EQ(delegating_renderer_,
752 output_surface->capabilities().delegated_rendering); 751 output_surface->capabilities().delegated_rendering);
753 output_surface_ = output_surface.get(); 752 output_surface_ = output_surface.get();
754 753
755 if (settings_.use_external_begin_frame_source && 754 if (settings_.use_external_begin_frame_source) {
756 settings_.throttle_frame_production) {
757 DCHECK(external_begin_frame_source_); 755 DCHECK(external_begin_frame_source_);
758 DCHECK(external_begin_frame_source_->is_ready()); 756 DCHECK(external_begin_frame_source_->is_ready());
759 } 757 }
760 return output_surface.Pass(); 758 return output_surface.Pass();
761 } 759 }
762 760
763 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() { 761 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() {
764 if (delegating_renderer_) 762 if (delegating_renderer_)
765 return FakeOutputSurface::CreateDelegating3d(); 763 return FakeOutputSurface::CreateDelegating3d();
766 else 764 else
(...skipping 15 matching lines...) Expand all
782 return -1; 780 return -1;
783 } 781 }
784 782
785 void LayerTreeTest::DestroyLayerTreeHost() { 783 void LayerTreeTest::DestroyLayerTreeHost() {
786 if (layer_tree_host_ && layer_tree_host_->root_layer()) 784 if (layer_tree_host_ && layer_tree_host_->root_layer())
787 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 785 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
788 layer_tree_host_ = nullptr; 786 layer_tree_host_ = nullptr;
789 } 787 }
790 788
791 } // namespace cc 789 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698