Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index 4fcb8ac6b0afb3a3a1cd41590df5f665b2a5c8a9..471bb009984bd0105bf863d06f550b54303c370c 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -1164,13 +1164,29 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
*success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
- if (offscreen_context_provider.get()) |
- offscreen_context_provider->BindToCurrentThread(); |
+ DidTryInitializeRendererOnImplThread(*success, offscreen_context_provider); |
if (*success) { |
*capabilities = layer_tree_host_impl_->GetRendererCapabilities(); |
+ scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
+ } |
+ |
+ completion->Signal(); |
+} |
+ |
+void ThreadProxy::DidTryInitializeRendererOnImplThread( |
+ bool success, |
+ scoped_refptr<ContextProvider> offscreen_context_provider) { |
+ DCHECK(IsImplThread()); |
+ DCHECK(!inside_draw_); |
+ |
+ if (offscreen_context_provider.get()) |
+ offscreen_context_provider->BindToCurrentThread(); |
+ |
+ if (success) { |
scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( |
- capabilities->using_swap_complete_callback); |
+ layer_tree_host_impl_->GetRendererCapabilities() |
+ .using_swap_complete_callback); |
OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); |
DCHECK(output_surface_ptr); |
@@ -1183,16 +1199,13 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); |
- if (layer_tree_host_impl_->resource_provider()) |
+ if (layer_tree_host_impl_->resource_provider()) { |
layer_tree_host_impl_->resource_provider()-> |
set_offscreen_context_provider(offscreen_context_provider); |
- |
- scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
+ } |
} else if (offscreen_context_provider.get()) { |
offscreen_context_provider->VerifyContexts(); |
} |
- |
- completion->Signal(); |
} |
void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |