OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
9 #include "cc/delegated_renderer_layer.h" | 9 #include "cc/delegated_renderer_layer.h" |
10 #include "cc/delegated_renderer_layer_impl.h" | 10 #include "cc/delegated_renderer_layer_impl.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 gfx::Rect(0, 0, 10, 10), | 683 gfx::Rect(0, 0, 10, 10), |
684 gfx::Rect(0, 0, 10, 10), | 684 gfx::Rect(0, 0, 10, 10), |
685 gfx::Transform()); | 685 gfx::Transform()); |
686 | 686 |
687 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); | 687 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
688 pass->SetNew( | 688 pass->SetNew( |
689 RenderPass::Id(2, 1), | 689 RenderPass::Id(2, 1), |
690 gfx::Rect(0, 0, 10, 10), | 690 gfx::Rect(0, 0, 10, 10), |
691 gfx::Rect(0, 0, 10, 10), | 691 gfx::Rect(0, 0, 10, 10), |
692 gfx::Transform()); | 692 gfx::Transform()); |
693 pass->AppendOneOfEveryQuadType(resource_provider); | 693 pass->AppendOneOfEveryQuadType(resource_provider, RenderPass::Id(2, 1)); |
694 | 694 |
695 ScopedPtrVector<RenderPass> pass_list; | 695 ScopedPtrVector<RenderPass> pass_list; |
696 pass_list.push_back(pass_for_quad.PassAs<RenderPass>()); | 696 pass_list.push_back(pass_for_quad.PassAs<RenderPass>()); |
697 pass_list.push_back(pass.PassAs<RenderPass>()); | 697 pass_list.push_back(pass.PassAs<RenderPass>()); |
698 | 698 |
699 // First child is the delegated layer. | 699 // First child is the delegated layer. |
700 DelegatedRendererLayerImpl* delegated_impl = | 700 DelegatedRendererLayerImpl* delegated_impl = |
701 static_cast<DelegatedRendererLayerImpl*>( | 701 static_cast<DelegatedRendererLayerImpl*>( |
702 host_impl->rootLayer()->children()[0]); | 702 host_impl->rootLayer()->children()[0]); |
703 delegated_impl->setRenderPasses(pass_list); | 703 delegated_impl->setRenderPasses(pass_list); |
(...skipping 24 matching lines...) Expand all Loading... |
728 | 728 |
729 if (host_impl->activeTree()->source_frame_number() == 3) { | 729 if (host_impl->activeTree()->source_frame_number() == 3) { |
730 // On the third commit we're recovering from context loss. Hardware | 730 // On the third commit we're recovering from context loss. Hardware |
731 // video frames should not be reused by the VideoFrameProvider, but | 731 // video frames should not be reused by the VideoFrameProvider, but |
732 // software frames can be. | 732 // software frames can be. |
733 hw_frame_provider_.set_frame(NULL); | 733 hw_frame_provider_.set_frame(NULL); |
734 scaled_hw_frame_provider_.set_frame(NULL); | 734 scaled_hw_frame_provider_.set_frame(NULL); |
735 } | 735 } |
736 } | 736 } |
737 | 737 |
738 virtual bool prepareToDrawOnThread(LayerTreeHostImpl* host_impl) { | 738 virtual bool prepareToDrawOnThread( |
| 739 LayerTreeHostImpl* host_impl, |
| 740 LayerTreeHostImpl::FrameData& frame, |
| 741 bool result) OVERRIDE { |
739 if (host_impl->activeTree()->source_frame_number() == 2) { | 742 if (host_impl->activeTree()->source_frame_number() == 2) { |
740 // Lose the context during draw on the second commit. This will cause | 743 // Lose the context during draw on the second commit. This will cause |
741 // a third commit to recover. | 744 // a third commit to recover. |
742 if (context3d_) | 745 if (context3d_) |
743 context3d_->set_times_bind_texture_succeeds(4); | 746 context3d_->set_times_bind_texture_succeeds(4); |
744 } | 747 } |
745 return true; | 748 return true; |
746 } | 749 } |
747 | 750 |
748 virtual void didCommitAndDrawFrame() OVERRIDE { | 751 virtual void didCommitAndDrawFrame() OVERRIDE { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 EXPECT_FALSE(succeeded); | 810 EXPECT_FALSE(succeeded); |
808 // If we make it this far without crashing, we pass! | 811 // If we make it this far without crashing, we pass! |
809 endTest(); | 812 endTest(); |
810 } | 813 } |
811 }; | 814 }; |
812 | 815 |
813 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestFailsImmediately); | 816 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestFailsImmediately); |
814 | 817 |
815 } // namespace | 818 } // namespace |
816 } // namespace cc | 819 } // namespace cc |
OLD | NEW |