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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
9 #include "cc/layers/delegated_frame_provider.h" | 9 #include "cc/layers/delegated_frame_provider.h" |
10 #include "cc/layers/delegated_frame_resource_collection.h" | 10 #include "cc/layers/delegated_frame_resource_collection.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 context3d_->set_have_extension_egl_image(true); | 97 context3d_->set_have_extension_egl_image(true); |
98 } | 98 } |
99 | 99 |
100 if (delegating_renderer()) | 100 if (delegating_renderer()) |
101 return FakeOutputSurface::CreateDelegating3d(context3d.Pass()); | 101 return FakeOutputSurface::CreateDelegating3d(context3d.Pass()); |
102 else | 102 else |
103 return FakeOutputSurface::Create3d(context3d.Pass()); | 103 return FakeOutputSurface::Create3d(context3d.Pass()); |
104 } | 104 } |
105 | 105 |
106 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 106 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
107 LayerTreeHostImpl::FrameData* frame, | 107 FrameData* frame, |
108 DrawResult draw_result) override { | 108 DrawResult draw_result) override { |
109 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { | 109 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { |
110 // Only valid for single-threaded impl-side painting, which activates | 110 // Only valid for single-threaded impl-side painting, which activates |
111 // immediately and will try to draw again when content has finished. | 111 // immediately and will try to draw again when content has finished. |
112 DCHECK(!host_impl->proxy()->HasImplThread()); | 112 DCHECK(!host_impl->proxy()->HasImplThread()); |
113 DCHECK(layer_tree_host()->settings().impl_side_painting); | 113 DCHECK(layer_tree_host()->settings().impl_side_painting); |
114 return draw_result; | 114 return draw_result; |
115 } | 115 } |
116 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 116 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
117 if (!times_to_lose_during_draw_) | 117 if (!times_to_lose_during_draw_) |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 if (host_impl->active_tree()->source_frame_number() == 3) { | 1123 if (host_impl->active_tree()->source_frame_number() == 3) { |
1124 // On the third commit we're recovering from context loss. Hardware | 1124 // On the third commit we're recovering from context loss. Hardware |
1125 // video frames should not be reused by the VideoFrameProvider, but | 1125 // video frames should not be reused by the VideoFrameProvider, but |
1126 // software frames can be. | 1126 // software frames can be. |
1127 hw_frame_provider_.set_frame(NULL); | 1127 hw_frame_provider_.set_frame(NULL); |
1128 scaled_hw_frame_provider_.set_frame(NULL); | 1128 scaled_hw_frame_provider_.set_frame(NULL); |
1129 } | 1129 } |
1130 } | 1130 } |
1131 | 1131 |
1132 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1132 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
1133 LayerTreeHostImpl::FrameData* frame, | 1133 FrameData* frame, |
1134 DrawResult draw_result) override { | 1134 DrawResult draw_result) override { |
1135 if (host_impl->active_tree()->source_frame_number() == 2) { | 1135 if (host_impl->active_tree()->source_frame_number() == 2) { |
1136 // Lose the context during draw on the second commit. This will cause | 1136 // Lose the context during draw on the second commit. This will cause |
1137 // a third commit to recover. | 1137 // a third commit to recover. |
1138 context3d_->set_times_bind_texture_succeeds(0); | 1138 context3d_->set_times_bind_texture_succeeds(0); |
1139 } | 1139 } |
1140 return draw_result; | 1140 return draw_result; |
1141 } | 1141 } |
1142 | 1142 |
1143 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 1143 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 void AfterTest() override {} | 1792 void AfterTest() override {} |
1793 | 1793 |
1794 bool deferred_; | 1794 bool deferred_; |
1795 }; | 1795 }; |
1796 | 1796 |
1797 SINGLE_AND_MULTI_THREAD_TEST_F( | 1797 SINGLE_AND_MULTI_THREAD_TEST_F( |
1798 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1798 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
1799 | 1799 |
1800 } // namespace | 1800 } // namespace |
1801 } // namespace cc | 1801 } // namespace cc |
OLD | NEW |