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

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 Proxy::ImplThreadTaskRunner()->PostTask(
226 FROM_HERE, base::Bind(&ThreadProxy::ReleaseOutputSurfaceOnImplThread,
227 impl_thread_weak_ptr_, &completion));
228 completion.Wait();
229 return output_surface_.Pass();
no sievers 2015/09/10 17:27:45 You don't need this variable, but you can have a s
sohanjg 2015/09/11 07:00:50 Done.
230 }
231
220 void ThreadProxy::DidInitializeOutputSurface( 232 void ThreadProxy::DidInitializeOutputSurface(
221 bool success, 233 bool success,
222 const RendererCapabilities& capabilities) { 234 const RendererCapabilities& capabilities) {
223 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); 235 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface");
224 DCHECK(IsMainThread()); 236 DCHECK(IsMainThread());
225 237
226 if (!success) { 238 if (!success) {
227 layer_tree_host()->DidFailToInitializeOutputSurface(); 239 layer_tree_host()->DidFailToInitializeOutputSurface();
228 return; 240 return;
229 } 241 }
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 FROM_HERE, 1087 FROM_HERE,
1076 base::Bind(&ThreadProxy::DidInitializeOutputSurface, 1088 base::Bind(&ThreadProxy::DidInitializeOutputSurface,
1077 main_thread_weak_ptr_, 1089 main_thread_weak_ptr_,
1078 success, 1090 success,
1079 capabilities)); 1091 capabilities));
1080 1092
1081 if (success) 1093 if (success)
1082 impl().scheduler->DidCreateAndInitializeOutputSurface(); 1094 impl().scheduler->DidCreateAndInitializeOutputSurface();
1083 } 1095 }
1084 1096
1097 void ThreadProxy::ReleaseOutputSurfaceOnImplThread(
1098 CompletionEvent* completion) {
1099 TRACE_EVENT0("cc", "ThreadProxy::FinishAllRenderingOnImplThread");
no sievers 2015/09/10 17:27:45 nit: "ThreadProxy::ReleaseOutputSurfaceOnImplThrea
sohanjg 2015/09/11 07:00:50 Done.
1100 DCHECK(IsImplThread());
1101
1102 impl().scheduler->DidLoseOutputSurface();
1103 output_surface_ = impl().layer_tree_host_impl->ReleaseOutputSurface();
1104 completion->Signal();
1105 }
1106
1085 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { 1107 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) {
1086 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); 1108 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread");
1087 DCHECK(IsImplThread()); 1109 DCHECK(IsImplThread());
1088 if (impl().layer_tree_host_impl->output_surface()) { 1110 if (impl().layer_tree_host_impl->output_surface()) {
1089 ContextProvider* context_provider = 1111 ContextProvider* context_provider =
1090 impl().layer_tree_host_impl->output_surface()->context_provider(); 1112 impl().layer_tree_host_impl->output_surface()->context_provider();
1091 if (context_provider) 1113 if (context_provider)
1092 context_provider->ContextGL()->Finish(); 1114 context_provider->ContextGL()->Finish();
1093 } 1115 }
1094 completion->Signal(); 1116 completion->Signal();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1276
1255 void ThreadProxy::PostFrameTimingEvents( 1277 void ThreadProxy::PostFrameTimingEvents(
1256 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 1278 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
1257 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 1279 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
1258 DCHECK(IsMainThread()); 1280 DCHECK(IsMainThread());
1259 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), 1281 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(),
1260 main_frame_events.Pass()); 1282 main_frame_events.Pass());
1261 } 1283 }
1262 1284
1263 } // namespace cc 1285 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698