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

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

Issue 348093004: Make cc output surface creation async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 CompletionEvent completion; 212 CompletionEvent completion;
213 Proxy::ImplThreadTaskRunner()->PostTask( 213 Proxy::ImplThreadTaskRunner()->PostTask(
214 FROM_HERE, 214 FROM_HERE,
215 base::Bind(&ThreadProxy::DeleteContentsTexturesOnImplThread, 215 base::Bind(&ThreadProxy::DeleteContentsTexturesOnImplThread,
216 impl_thread_weak_ptr_, 216 impl_thread_weak_ptr_,
217 &completion)); 217 &completion));
218 completion.Wait(); 218 completion.Wait();
219 } 219 }
220 } 220 }
221 221
222 void ThreadProxy::CreateAndInitializeOutputSurface() { 222 void ThreadProxy::RequestNewOutputSurface() {
223 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface");
224 DCHECK(IsMainThread()); 223 DCHECK(IsMainThread());
224 layer_tree_host()->RequestNewOutputSurface();
225 }
225 226
226 scoped_ptr<OutputSurface> output_surface = 227 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) {
227 layer_tree_host()->CreateOutputSurface();
228
229 if (output_surface) { 228 if (output_surface) {
danakj 2014/06/20 23:36:34 Do we want the embedder to be able to call back wi
230 Proxy::ImplThreadTaskRunner()->PostTask( 229 Proxy::ImplThreadTaskRunner()->PostTask(
231 FROM_HERE, 230 FROM_HERE,
232 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, 231 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread,
233 impl_thread_weak_ptr_, 232 impl_thread_weak_ptr_,
234 base::Passed(&output_surface))); 233 base::Passed(&output_surface)));
235 return; 234 return;
236 } 235 }
237 236
238 DidInitializeOutputSurface(false, RendererCapabilities()); 237 DidInitializeOutputSurface(false, RendererCapabilities());
239 } 238 }
240 239
241 void ThreadProxy::DidInitializeOutputSurface( 240 void ThreadProxy::DidInitializeOutputSurface(
242 bool success, 241 bool success,
243 const RendererCapabilities& capabilities) { 242 const RendererCapabilities& capabilities) {
244 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); 243 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface");
245 DCHECK(IsMainThread()); 244 DCHECK(IsMainThread());
246 main().renderer_capabilities_main_thread_copy = capabilities; 245 main().renderer_capabilities_main_thread_copy = capabilities;
247 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); 246 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success);
248 247
249 if (!success) { 248 if (!success) {
250 Proxy::MainThreadTaskRunner()->PostTask( 249 Proxy::MainThreadTaskRunner()->PostTask(
251 FROM_HERE, 250 FROM_HERE,
252 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, 251 base::Bind(&ThreadProxy::RequestNewOutputSurface,
253 main_thread_weak_ptr_)); 252 main_thread_weak_ptr_));
254 } 253 }
255 } 254 }
256 255
257 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( 256 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy(
258 const RendererCapabilities& capabilities) { 257 const RendererCapabilities& capabilities) {
259 main().renderer_capabilities_main_thread_copy = capabilities; 258 main().renderer_capabilities_main_thread_copy = capabilities;
260 } 259 }
261 260
262 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { 261 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() {
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivatePendingTree"); 1018 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivatePendingTree");
1020 DCHECK(IsImplThread()); 1019 DCHECK(IsImplThread());
1021 impl().layer_tree_host_impl->ActivatePendingTree(); 1020 impl().layer_tree_host_impl->ActivatePendingTree();
1022 } 1021 }
1023 1022
1024 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { 1023 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() {
1025 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); 1024 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation");
1026 DCHECK(IsImplThread()); 1025 DCHECK(IsImplThread());
1027 Proxy::MainThreadTaskRunner()->PostTask( 1026 Proxy::MainThreadTaskRunner()->PostTask(
1028 FROM_HERE, 1027 FROM_HERE,
1029 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, 1028 base::Bind(&ThreadProxy::RequestNewOutputSurface, main_thread_weak_ptr_));
1030 main_thread_weak_ptr_));
1031 } 1029 }
1032 1030
1033 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { 1031 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) {
1034 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); 1032 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap");
1035 DrawResult result; 1033 DrawResult result;
1036 1034
1037 DCHECK(IsImplThread()); 1035 DCHECK(IsImplThread());
1038 DCHECK(impl().layer_tree_host_impl.get()); 1036 DCHECK(impl().layer_tree_host_impl.get());
1039 1037
1040 impl().timing_history.DidStartDrawing(); 1038 impl().timing_history.DidStartDrawing();
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 1435
1438 impl().timing_history.DidActivatePendingTree(); 1436 impl().timing_history.DidActivatePendingTree();
1439 } 1437 }
1440 1438
1441 void ThreadProxy::DidManageTiles() { 1439 void ThreadProxy::DidManageTiles() {
1442 DCHECK(IsImplThread()); 1440 DCHECK(IsImplThread());
1443 impl().scheduler->DidManageTiles(); 1441 impl().scheduler->DidManageTiles();
1444 } 1442 }
1445 1443
1446 } // namespace cc 1444 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698