Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index c807427b348fbaebf51694a0c5a062824b07a72e..8aa2f1d2811ad027040d85def6cdad8481269331 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -50,6 +50,7 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layer_tree_host, |
textures_acquired_(true), |
in_composite_and_readback_(false), |
manage_tiles_pending_(false), |
+ initializing_new_output_surface__on_impl_thread_(false), |
weak_factory_on_impl_thread_(this), |
weak_factory_(this), |
begin_frame_sent_to_main_thread_completion_event_on_impl_thread_(NULL), |
@@ -1161,14 +1162,28 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
layer_tree_host_impl_->resource_provider()); |
*success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
+ if (*success) |
+ *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); |
+ |
+ initializing_new_output_surface__on_impl_thread_ = true; |
+ DidUpdateCapabilitiesOnImplThread(*success, offscreen_context_provider); |
+ initializing_new_output_surface__on_impl_thread_ = false; |
+ |
+ completion->Signal(); |
+} |
+ |
+void ThreadProxy::DidUpdateCapabilitiesOnImplThread( |
danakj
2013/05/24 19:02:30
nit: DidInitializeRendererOnImplThread? This funct
|
+ bool success, |
+ scoped_refptr<ContextProvider> offscreen_context_provider) { |
+ DCHECK(IsImplThread()); |
if (offscreen_context_provider) |
offscreen_context_provider->BindToCurrentThread(); |
- if (*success) { |
- *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); |
+ 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); |
@@ -1182,15 +1197,25 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); |
if (layer_tree_host_impl_->resource_provider()) |
- layer_tree_host_impl_->resource_provider()-> |
- set_offscreen_context_provider(offscreen_context_provider); |
+ layer_tree_host_impl_->resource_provider() |
+ ->set_offscreen_context_provider(offscreen_context_provider); |
- scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
+ if (initializing_new_output_surface__on_impl_thread_) { |
+ scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
+ } else { |
+ Proxy::MainThread()->PostTask(base::Bind( |
+ &ThreadProxy::DidUpdateCapabilities, main_thread_weak_ptr_)); |
+ } |
} else if (offscreen_context_provider) { |
offscreen_context_provider->VerifyContexts(); |
} |
+} |
- completion->Signal(); |
+void ThreadProxy::DidUpdateCapabilities() { |
danakj
2013/05/24 19:02:30
This needs to take and do something with the caps,
|
+ DCHECK(IsMainThread()); |
+ if (layer_tree_host_) { |
+ layer_tree_host_->DidUpdateCapabilities(); |
+ } |
} |
void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |