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

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 1287043002: cc: Setup API to release OutputSurface from LTHClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 5 years, 3 months 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/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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 layer_tree_host()->RequestNewOutputSurface(); 210 layer_tree_host()->RequestNewOutputSurface();
211 } 211 }
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() {
221 DCHECK(IsMainThread());
222
223 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
224 CompletionEvent completion;
225 scoped_ptr<OutputSurface> output_surface;
226 Proxy::ImplThreadTaskRunner()->PostTask(
227 FROM_HERE, base::Bind(&ThreadProxy::ReleaseOutputSurfaceOnImplThread,
228 impl_thread_weak_ptr_, &completion,
229 base::Passed(&output_surface)));
230 completion.Wait();
231 return output_surface.Pass();
232 }
233
220 void ThreadProxy::DidInitializeOutputSurface( 234 void ThreadProxy::DidInitializeOutputSurface(
221 bool success, 235 bool success,
222 const RendererCapabilities& capabilities) { 236 const RendererCapabilities& capabilities) {
223 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); 237 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface");
224 DCHECK(IsMainThread()); 238 DCHECK(IsMainThread());
225 239
226 if (!success) { 240 if (!success) {
227 layer_tree_host()->DidFailToInitializeOutputSurface(); 241 layer_tree_host()->DidFailToInitializeOutputSurface();
228 return; 242 return;
229 } 243 }
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 FROM_HERE, 1089 FROM_HERE,
1076 base::Bind(&ThreadProxy::DidInitializeOutputSurface, 1090 base::Bind(&ThreadProxy::DidInitializeOutputSurface,
1077 main_thread_weak_ptr_, 1091 main_thread_weak_ptr_,
1078 success, 1092 success,
1079 capabilities)); 1093 capabilities));
1080 1094
1081 if (success) 1095 if (success)
1082 impl().scheduler->DidCreateAndInitializeOutputSurface(); 1096 impl().scheduler->DidCreateAndInitializeOutputSurface();
1083 } 1097 }
1084 1098
1099 void ThreadProxy::ReleaseOutputSurfaceOnImplThread(
1100 CompletionEvent* completion,
1101 scoped_ptr<OutputSurface> output_surface) {
1102 TRACE_EVENT0("cc", "ThreadProxy::ReleaseOutputSurfaceOnImplThread");
1103 DCHECK(IsImplThread());
1104
1105 impl().scheduler->DidLoseOutputSurface();
1106 output_surface = impl().layer_tree_host_impl->ReleaseOutputSurface();
1107 completion->Signal();
1108 }
1109
1085 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { 1110 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) {
1086 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); 1111 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread");
1087 DCHECK(IsImplThread()); 1112 DCHECK(IsImplThread());
1088 if (impl().layer_tree_host_impl->output_surface()) { 1113 if (impl().layer_tree_host_impl->output_surface()) {
1089 ContextProvider* context_provider = 1114 ContextProvider* context_provider =
1090 impl().layer_tree_host_impl->output_surface()->context_provider(); 1115 impl().layer_tree_host_impl->output_surface()->context_provider();
1091 if (context_provider) 1116 if (context_provider)
1092 context_provider->ContextGL()->Finish(); 1117 context_provider->ContextGL()->Finish();
1093 } 1118 }
1094 completion->Signal(); 1119 completion->Signal();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1279
1255 void ThreadProxy::PostFrameTimingEvents( 1280 void ThreadProxy::PostFrameTimingEvents(
1256 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 1281 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
1257 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 1282 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
1258 DCHECK(IsMainThread()); 1283 DCHECK(IsMainThread());
1259 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), 1284 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(),
1260 main_frame_events.Pass()); 1285 main_frame_events.Pass());
1261 } 1286 }
1262 1287
1263 } // namespace cc 1288 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_unittest_context.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698