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

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2297933002: blimp: Set up the CompositorDependencies for blimp in Chrome. (Closed)
Patch Set: change to a Gpu Channel callback Created 4 years, 3 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: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 24eafda7fd06371142220856b6292f203d5f22fc..328703062a33f1a1a206cef40a9e2aebc029fc82 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -610,13 +610,8 @@ void CompositorImpl::HandlePendingOutputSurfaceRequest() {
#endif
DCHECK(surface_handle_ != gpu::kNullSurfaceHandle);
-
- ContextProviderFactoryImpl::GetInstance()->CreateDisplayContextProvider(
- surface_handle_, GetCompositorContextSharedMemoryLimits(),
- GetCompositorContextAttributes(has_transparent_background_),
- false /*support_locking*/, false /*automatic_flushes*/,
- base::Bind(&CompositorImpl::CreateCompositorOutputSurface,
- weak_factory_.GetWeakPtr()));
+ ContextProviderFactoryImpl::GetInstance()->RequestGpuChannelHost(base::Bind(
+ &CompositorImpl::OnGpuChannelEstablished, weak_factory_.GetWeakPtr()));
}
#if defined(ENABLE_VULKAN)
@@ -648,33 +643,34 @@ void CompositorImpl::CreateVulkanOutputSurface() {
}
#endif
-void CompositorImpl::CreateCompositorOutputSurface(
- const scoped_refptr<cc::ContextProvider>& context_provider,
- ui::ContextProviderFactory::ContextCreationResult result) {
+void CompositorImpl::OnGpuChannelEstablished(
+ const scoped_refptr<gpu::GpuChannelHost>& gpu_channel_host,
+ ui::ContextProviderFactory::GpuChannelHostResult result) {
DCHECK(output_surface_request_pending_);
switch (result) {
- // Don't retry if we are shutting down or if the Gpu Surface handle was
- // lost. The Gpu Surface handle loss should happen only if we are invisible
- // or this was from a previous request and the current surface has changed,
- // in which case we would have made another request with the factory.
- case ui::ContextProviderFactory::ContextCreationResult::
+ // Don't retry if we are shutting down.
+ case ui::ContextProviderFactory::GpuChannelHostResult::
FAILURE_FACTORY_SHUTDOWN:
- case ui::ContextProviderFactory::ContextCreationResult::
- FAILURE_GPU_SURFACE_HANDLE_LOST:
break;
- case ui::ContextProviderFactory::ContextCreationResult::
+ case ui::ContextProviderFactory::GpuChannelHostResult::
FAILURE_GPU_PROCESS_INITIALIZATION_FAILED:
- // Retry only if we are visible.
- if (host_->visible()) {
- HandlePendingOutputSurfaceRequest();
- }
+ HandlePendingOutputSurfaceRequest();
break;
- case ui::ContextProviderFactory::ContextCreationResult::SUCCESS:
- DCHECK(host_->visible());
+ case ui::ContextProviderFactory::GpuChannelHostResult::SUCCESS:
+ // We don't need the context anymore if we are invisible.
+ if (!host_->visible())
+ return;
+
DCHECK(window_);
DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle);
- DCHECK(context_provider);
+ scoped_refptr<cc::ContextProvider> context_provider =
+ ContextProviderFactoryImpl::GetInstance()
+ ->CreateDisplayContextProvider(
+ surface_handle_, GetCompositorContextSharedMemoryLimits(),
+ GetCompositorContextAttributes(has_transparent_background_),
+ false /*support_locking*/, false /*automatic_flushes*/,
+ gpu_channel_host.get());
scoped_refptr<ContextProviderCommandBuffer>
context_provider_command_buffer =

Powered by Google App Engine
This is Rietveld 408576698