OLD | NEW |
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/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { | 213 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { |
214 Proxy::ImplThreadTaskRunner()->PostTask( | 214 Proxy::ImplThreadTaskRunner()->PostTask( |
215 FROM_HERE, | 215 FROM_HERE, |
216 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, | 216 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, |
217 impl_thread_weak_ptr_, base::Passed(&output_surface))); | 217 impl_thread_weak_ptr_, base::Passed(&output_surface))); |
218 } | 218 } |
219 | 219 |
220 scoped_ptr<OutputSurface> ThreadProxy::ReleaseOutputSurface() { | 220 scoped_ptr<OutputSurface> ThreadProxy::ReleaseOutputSurface() { |
221 DCHECK(IsMainThread()); | 221 DCHECK(IsMainThread()); |
| 222 DCHECK(layer_tree_host()->output_surface_lost()); |
| 223 |
222 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 224 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
223 CompletionEvent completion; | 225 CompletionEvent completion; |
224 scoped_ptr<OutputSurface> output_surface; | 226 scoped_ptr<OutputSurface> output_surface; |
225 Proxy::ImplThreadTaskRunner()->PostTask( | 227 Proxy::ImplThreadTaskRunner()->PostTask( |
226 FROM_HERE, | 228 FROM_HERE, |
227 base::Bind(&ThreadProxy::ReleaseOutputSurfaceOnImplThread, | 229 base::Bind(&ThreadProxy::ReleaseOutputSurfaceOnImplThread, |
228 impl_thread_weak_ptr_, &completion, &output_surface)); | 230 impl_thread_weak_ptr_, &completion, &output_surface)); |
229 completion.Wait(); | 231 completion.Wait(); |
230 return output_surface.Pass(); | 232 return output_surface; |
231 } | 233 } |
232 | 234 |
233 void ThreadProxy::DidInitializeOutputSurface( | 235 void ThreadProxy::DidInitializeOutputSurface( |
234 bool success, | 236 bool success, |
235 const RendererCapabilities& capabilities) { | 237 const RendererCapabilities& capabilities) { |
236 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); | 238 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); |
237 DCHECK(IsMainThread()); | 239 DCHECK(IsMainThread()); |
238 | 240 |
239 if (!success) { | 241 if (!success) { |
240 layer_tree_host()->DidFailToInitializeOutputSurface(); | 242 layer_tree_host()->DidFailToInitializeOutputSurface(); |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 success, | 1078 success, |
1077 capabilities)); | 1079 capabilities)); |
1078 | 1080 |
1079 if (success) | 1081 if (success) |
1080 impl().scheduler->DidCreateAndInitializeOutputSurface(); | 1082 impl().scheduler->DidCreateAndInitializeOutputSurface(); |
1081 } | 1083 } |
1082 | 1084 |
1083 void ThreadProxy::ReleaseOutputSurfaceOnImplThread( | 1085 void ThreadProxy::ReleaseOutputSurfaceOnImplThread( |
1084 CompletionEvent* completion, | 1086 CompletionEvent* completion, |
1085 scoped_ptr<OutputSurface>* output_surface) { | 1087 scoped_ptr<OutputSurface>* output_surface) { |
1086 TRACE_EVENT0("cc", "ThreadProxy::ReleaseOutputSurfaceOnImplThread"); | |
1087 DCHECK(IsImplThread()); | 1088 DCHECK(IsImplThread()); |
1088 | 1089 |
| 1090 // Unlike DidLoseOutputSurfaceOnImplThread, we don't need to call |
| 1091 // LayerTreeHost::DidLoseOutputSurface since it already knows. |
1089 impl().scheduler->DidLoseOutputSurface(); | 1092 impl().scheduler->DidLoseOutputSurface(); |
1090 *output_surface = impl().layer_tree_host_impl->ReleaseOutputSurface(); | 1093 *output_surface = impl().layer_tree_host_impl->ReleaseOutputSurface(); |
1091 completion->Signal(); | 1094 completion->Signal(); |
1092 } | 1095 } |
1093 | 1096 |
1094 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1097 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
1095 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1098 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
1096 DCHECK(IsImplThread()); | 1099 DCHECK(IsImplThread()); |
1097 if (impl().layer_tree_host_impl->output_surface()) { | 1100 if (impl().layer_tree_host_impl->output_surface()) { |
1098 ContextProvider* context_provider = | 1101 ContextProvider* context_provider = |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 | 1266 |
1264 void ThreadProxy::PostFrameTimingEvents( | 1267 void ThreadProxy::PostFrameTimingEvents( |
1265 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1268 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
1266 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1269 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
1267 DCHECK(IsMainThread()); | 1270 DCHECK(IsMainThread()); |
1268 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), | 1271 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), |
1269 main_frame_events.Pass()); | 1272 main_frame_events.Pass()); |
1270 } | 1273 } |
1271 | 1274 |
1272 } // namespace cc | 1275 } // namespace cc |
OLD | NEW |