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

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

Issue 738983002: Move output surface fallback from cc to embedders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 top_controls_delta); 365 top_controls_delta);
366 } 366 }
367 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, 367 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
368 float scale, 368 float scale,
369 float top_controls_delta) override { 369 float top_controls_delta) override {
370 test_hooks_->ApplyViewportDeltas(scroll_delta, 370 test_hooks_->ApplyViewportDeltas(scroll_delta,
371 scale, 371 scale,
372 top_controls_delta); 372 top_controls_delta);
373 } 373 }
374 374
375 void RequestNewOutputSurface(bool fallback) override { 375 void RequestNewOutputSurface() override {
376 test_hooks_->RequestNewOutputSurface(fallback); 376 test_hooks_->RequestNewOutputSurface();
377 } 377 }
378 378
379 void DidInitializeOutputSurface() override { 379 void DidInitializeOutputSurface() override {
380 test_hooks_->DidInitializeOutputSurface(); 380 test_hooks_->DidInitializeOutputSurface();
381 } 381 }
382 382
383 void SendBeginFramesToChildren(const BeginFrameArgs& args) override { 383 void SendBeginFramesToChildren(const BeginFrameArgs& args) override {
384 test_hooks_->SendBeginFramesToChildren(args); 384 test_hooks_->SendBeginFramesToChildren(args);
385 } 385 }
386 386
387 void DidFailToInitializeOutputSurface() override { 387 void DidFailToInitializeOutputSurface() override {
388 test_hooks_->DidFailToInitializeOutputSurface(); 388 test_hooks_->DidFailToInitializeOutputSurface();
389 RequestNewOutputSurface();
389 } 390 }
390 391
391 void WillCommit() override { test_hooks_->WillCommit(); } 392 void WillCommit() override { test_hooks_->WillCommit(); }
392 393
393 void DidCommit() override { test_hooks_->DidCommit(); } 394 void DidCommit() override { test_hooks_->DidCommit(); }
394 395
395 void DidCommitAndDrawFrame() override { 396 void DidCommitAndDrawFrame() override {
396 test_hooks_->DidCommitAndDrawFrame(); 397 test_hooks_->DidCommitAndDrawFrame();
397 } 398 }
398 399
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 FAIL() << "Test timed out"; 774 FAIL() << "Test timed out";
774 return; 775 return;
775 } 776 }
776 AfterTest(); 777 AfterTest();
777 } 778 }
778 779
779 void LayerTreeTest::RunTestWithImplSidePainting() { 780 void LayerTreeTest::RunTestWithImplSidePainting() {
780 RunTest(true, false, true); 781 RunTest(true, false, true);
781 } 782 }
782 783
783 void LayerTreeTest::RequestNewOutputSurface(bool fallback) { 784 void LayerTreeTest::RequestNewOutputSurface() {
784 layer_tree_host_->SetOutputSurface(CreateOutputSurface(fallback)); 785 layer_tree_host_->SetOutputSurface(CreateOutputSurface());
785 } 786 }
786 787
787 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) { 788 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() {
788 scoped_ptr<FakeOutputSurface> output_surface = 789 scoped_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface();
789 CreateFakeOutputSurface(fallback); 790 DCHECK_EQ(delegating_renderer_,
790 if (output_surface) { 791 output_surface->capabilities().delegated_rendering);
791 DCHECK_EQ(delegating_renderer_,
792 output_surface->capabilities().delegated_rendering);
793 }
794 output_surface_ = output_surface.get(); 792 output_surface_ = output_surface.get();
795 793
796 if (settings_.use_external_begin_frame_source && 794 if (settings_.use_external_begin_frame_source &&
797 settings_.throttle_frame_production) { 795 settings_.throttle_frame_production) {
798 DCHECK(external_begin_frame_source_); 796 DCHECK(external_begin_frame_source_);
799 DCHECK(external_begin_frame_source_->is_ready()); 797 DCHECK(external_begin_frame_source_->is_ready());
800 } 798 }
801 return output_surface.Pass(); 799 return output_surface.Pass();
802 } 800 }
803 801
804 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface( 802 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() {
805 bool fallback) {
806 if (delegating_renderer_) 803 if (delegating_renderer_)
807 return FakeOutputSurface::CreateDelegating3d(); 804 return FakeOutputSurface::CreateDelegating3d();
808 else 805 else
809 return FakeOutputSurface::Create3d(); 806 return FakeOutputSurface::Create3d();
810 } 807 }
811 808
812 TestWebGraphicsContext3D* LayerTreeTest::TestContext() { 809 TestWebGraphicsContext3D* LayerTreeTest::TestContext() {
813 return static_cast<TestContextProvider*>(output_surface_->context_provider()) 810 return static_cast<TestContextProvider*>(output_surface_->context_provider())
814 ->TestContext3d(); 811 ->TestContext3d();
815 } 812 }
816 813
817 int LayerTreeTest::LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) 814 int LayerTreeTest::LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl)
818 const { 815 const {
819 if (impl->pending_tree()) 816 if (impl->pending_tree())
820 return impl->pending_tree()->source_frame_number(); 817 return impl->pending_tree()->source_frame_number();
821 if (impl->active_tree()) 818 if (impl->active_tree())
822 return impl->active_tree()->source_frame_number(); 819 return impl->active_tree()->source_frame_number();
823 // Source frames start at 0, so this is invalid. 820 // Source frames start at 0, so this is invalid.
824 return -1; 821 return -1;
825 } 822 }
826 823
827 void LayerTreeTest::DestroyLayerTreeHost() { 824 void LayerTreeTest::DestroyLayerTreeHost() {
828 if (layer_tree_host_ && layer_tree_host_->root_layer()) 825 if (layer_tree_host_ && layer_tree_host_->root_layer())
829 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 826 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
830 layer_tree_host_ = nullptr; 827 layer_tree_host_ = nullptr;
831 } 828 }
832 829
833 } // namespace cc 830 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698