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

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: update test. 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
« cc/trees/single_thread_proxy.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
danakj 2015/09/17 18:43:55 Can you DCHECK that LTH knows the OS is lost?
221 DCHECK(IsMainThread());
222 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
223 CompletionEvent completion;
224 scoped_ptr<OutputSurface> output_surface;
225 Proxy::ImplThreadTaskRunner()->PostTask(
226 FROM_HERE,
227 base::Bind(&ThreadProxy::ReleaseOutputSurfaceOnImplThread,
228 impl_thread_weak_ptr_, &completion, &output_surface));
229 completion.Wait();
230 return output_surface.Pass();
danakj 2015/09/17 18:43:55 don't need Pass() on return
231 }
232
220 void ThreadProxy::DidInitializeOutputSurface( 233 void ThreadProxy::DidInitializeOutputSurface(
221 bool success, 234 bool success,
222 const RendererCapabilities& capabilities) { 235 const RendererCapabilities& capabilities) {
223 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); 236 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface");
224 DCHECK(IsMainThread()); 237 DCHECK(IsMainThread());
225 238
226 if (!success) { 239 if (!success) {
227 layer_tree_host()->DidFailToInitializeOutputSurface(); 240 layer_tree_host()->DidFailToInitializeOutputSurface();
228 return; 241 return;
229 } 242 }
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 FROM_HERE, 1088 FROM_HERE,
1076 base::Bind(&ThreadProxy::DidInitializeOutputSurface, 1089 base::Bind(&ThreadProxy::DidInitializeOutputSurface,
1077 main_thread_weak_ptr_, 1090 main_thread_weak_ptr_,
1078 success, 1091 success,
1079 capabilities)); 1092 capabilities));
1080 1093
1081 if (success) 1094 if (success)
1082 impl().scheduler->DidCreateAndInitializeOutputSurface(); 1095 impl().scheduler->DidCreateAndInitializeOutputSurface();
1083 } 1096 }
1084 1097
1098 void ThreadProxy::ReleaseOutputSurfaceOnImplThread(
1099 CompletionEvent* completion,
1100 scoped_ptr<OutputSurface>* output_surface) {
1101 TRACE_EVENT0("cc", "ThreadProxy::ReleaseOutputSurfaceOnImplThread");
danakj 2015/09/17 18:43:55 we didn't trace in the STP, i think i'd rather the
1102 DCHECK(IsImplThread());
1103
1104 impl().scheduler->DidLoseOutputSurface();
danakj 2015/09/17 18:43:55 Can you comment saying that, unlike in DidLoseOutp
1105 *output_surface = impl().layer_tree_host_impl->ReleaseOutputSurface();
1106 completion->Signal();
1107 }
1108
1085 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { 1109 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) {
1086 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); 1110 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread");
1087 DCHECK(IsImplThread()); 1111 DCHECK(IsImplThread());
1088 if (impl().layer_tree_host_impl->output_surface()) { 1112 if (impl().layer_tree_host_impl->output_surface()) {
1089 ContextProvider* context_provider = 1113 ContextProvider* context_provider =
1090 impl().layer_tree_host_impl->output_surface()->context_provider(); 1114 impl().layer_tree_host_impl->output_surface()->context_provider();
1091 if (context_provider) 1115 if (context_provider)
1092 context_provider->ContextGL()->Finish(); 1116 context_provider->ContextGL()->Finish();
1093 } 1117 }
1094 completion->Signal(); 1118 completion->Signal();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1278
1255 void ThreadProxy::PostFrameTimingEvents( 1279 void ThreadProxy::PostFrameTimingEvents(
1256 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 1280 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
1257 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 1281 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
1258 DCHECK(IsMainThread()); 1282 DCHECK(IsMainThread());
1259 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), 1283 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(),
1260 main_frame_events.Pass()); 1284 main_frame_events.Pass());
1261 } 1285 }
1262 1286
1263 } // namespace cc 1287 } // namespace cc
OLDNEW
« cc/trees/single_thread_proxy.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