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

Unified Diff: blimp/client/feature/compositor/blimp_compositor.cc

Issue 2297933002: blimp: Set up the CompositorDependencies for blimp in Chrome. (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/feature/compositor/blimp_compositor.cc
diff --git a/blimp/client/feature/compositor/blimp_compositor.cc b/blimp/client/feature/compositor/blimp_compositor.cc
index 8c16907e6ba97616c647966a2aad1d63ea38aec7..0a44e3863f74a4b03e8d3186877fa4df8b57b05b 100644
--- a/blimp/client/feature/compositor/blimp_compositor.cc
+++ b/blimp/client/feature/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,7 +104,7 @@ void BlimpCompositor::RequestNewOutputSurface() {
DCHECK(!output_surface_request_pending_);
output_surface_request_pending_ = true;
- GetEmbedderDeps()->GetContextProvider(
+ GetEmbedderDeps()->GetContextProviders(
base::Bind(&BlimpCompositor::OnContextProviderCreated,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -159,7 +159,8 @@ void BlimpCompositor::OnCompositorMessageReceived(
}
void BlimpCompositor::OnContextProviderCreated(
- const scoped_refptr<cc::ContextProvider>& provider) {
+ const blimp::client::CompositorDependencies::ContextProviders&
+ context_providers) {
DCHECK(!surface_factory_)
<< "Any connection to the old output surface should have been destroyed";
@@ -169,15 +170,18 @@ 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::OnContextProviderCreated,
+ weak_ptr_factory_.GetWeakPtr()));
David Trainor- moved to gerrit 2016/08/31 00:28:58 Return after this?
Khushal 2016/08/31 21:22:50 Good catch. Done.
+ }
+
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));
}

Powered by Google App Engine
This is Rietveld 408576698