Chromium Code Reviews| Index: blimp/client/core/compositor/blimp_compositor.cc |
| diff --git a/blimp/client/core/compositor/blimp_compositor.cc b/blimp/client/core/compositor/blimp_compositor.cc |
| index e778c8b237ac6407124c470447bd3428a903f99c..4efb7b2e7d5fecfe98e325d6362d7dc22c183562 100644 |
| --- a/blimp/client/core/compositor/blimp_compositor.cc |
| +++ b/blimp/client/core/compositor/blimp_compositor.cc |
| @@ -72,7 +72,7 @@ BlimpCompositor::BlimpCompositor( |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>( |
| - GetEmbedderDeps()->AllocateSurfaceId()); |
| + GetEmbedderDeps()->AllocateSurfaceClientId()); |
| GetEmbedderDeps()->GetSurfaceManager()->RegisterSurfaceClientId( |
| surface_id_allocator_->client_id()); |
| } |
| @@ -104,8 +104,8 @@ void BlimpCompositor::RequestNewOutputSurface() { |
| DCHECK(!output_surface_request_pending_); |
| output_surface_request_pending_ = true; |
| - GetEmbedderDeps()->GetContextProvider( |
| - base::Bind(&BlimpCompositor::OnContextProviderCreated, |
| + GetEmbedderDeps()->GetContextProviders( |
| + base::Bind(&BlimpCompositor::OnContextProvidersCreated, |
| weak_ptr_factory_.GetWeakPtr())); |
| } |
| @@ -157,8 +157,9 @@ void BlimpCompositor::OnCompositorMessageReceived( |
| } |
| } |
| -void BlimpCompositor::OnContextProviderCreated( |
| - const scoped_refptr<cc::ContextProvider>& provider) { |
| +void BlimpCompositor::OnContextProvidersCreated( |
| + const blimp::client::CompositorDependencies::ContextProviders& |
| + context_providers) { |
| DCHECK(!surface_factory_) |
| << "Any connection to the old output surface should have been destroyed"; |
| @@ -168,15 +169,19 @@ void BlimpCompositor::OnContextProviderCreated( |
| if (!output_surface_request_pending_) |
| return; |
| - // TODO(khushalsagar): Make a worker context and bind it to the current |
| - // thread: |
| - // Worker context is bound to the main thread in RenderThreadImpl. One day |
| - // that will change and then this will have to be removed. |
| - // worker_context_provider->BindToCurrentThread(); |
| + // Try again if the context creation failed. |
| + if (!context_providers.compositor_context_provider) { |
| + GetEmbedderDeps()->GetContextProviders( |
| + base::Bind(&BlimpCompositor::OnContextProvidersCreated, |
| + weak_ptr_factory_.GetWeakPtr())); |
| + return; |
| + } |
| + |
| std::unique_ptr<DelegatedOutputSurface> delegated_output_surface = |
| base::MakeUnique<DelegatedOutputSurface>( |
| - provider, nullptr, base::ThreadTaskRunnerHandle::Get(), |
| - weak_ptr_factory_.GetWeakPtr()); |
| + std::move(context_providers.compositor_context_provider), |
| + std::move(context_providers.worker_context_provider), |
| + base::ThreadTaskRunnerHandle::Get(), weak_ptr_factory_.GetWeakPtr()); |
| host_->SetOutputSurface(std::move(delegated_output_surface)); |
| } |
| @@ -275,7 +280,14 @@ void BlimpCompositor::CreateLayerTreeHost( |
| params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| params.image_serialization_processor = |
| compositor_dependencies_->GetImageSerializationProcessor(); |
| - params.settings = GetEmbedderDeps()->GetLayerTreeSettings(); |
| + |
| + // TODO(khushalsagar): This is a hack. Remove when we move the split point |
| + // out. |
| + cc::LayerTreeSettings* settings = |
| + compositor_dependencies_->GetLayerTreeSettings(); |
| + settings->abort_commit_before_output_surface_creation = false; |
|
David Trainor- moved to gerrit
2016/08/31 21:49:58
Add comment why this is here.
Khushal
2016/08/31 22:04:57
Done.
|
| + params.settings = settings; |
| + |
| params.animation_host = cc::AnimationHost::CreateMainInstance(); |
| scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |