Index: content/browser/compositor/gpu_process_transport_factory.cc |
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc |
index e615006ed1b7f2051eb7f64f9c9c72a78534ebec..e0e05310b8126209f09962fb8ec9bf8ca1b32711 100644 |
--- a/content/browser/compositor/gpu_process_transport_factory.cc |
+++ b/content/browser/compositor/gpu_process_transport_factory.cc |
@@ -97,8 +97,7 @@ const int kNumRetriesBeforeSoftwareFallback = 4; |
std::unique_ptr<content::WebGraphicsContext3DCommandBufferImpl> |
CreateContextCommon(scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
- gpu::SurfaceHandle surface_handle, |
- bool share_resources) { |
+ gpu::SurfaceHandle surface_handle) { |
DCHECK( |
content::GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()); |
DCHECK(gpu_channel_host); |
@@ -129,8 +128,7 @@ CreateContextCommon(scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"); |
return base::WrapUnique(new content::WebGraphicsContext3DCommandBufferImpl( |
surface_handle, url, gpu_channel_host.get(), attributes, |
- gfx::PreferIntegratedGpu, share_resources, automatic_flushes, |
- nullptr)); |
+ gfx::PreferIntegratedGpu, automatic_flushes)); |
} |
#if defined(OS_MACOSX) |
@@ -359,26 +357,28 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
if (!gpu_channel_host) { |
shared_worker_context_provider_ = nullptr; |
} else { |
- // This context is used for both the browser compositor and the display |
- // compositor. |
- constexpr bool share_resources = true; |
- context_provider = new ContextProviderCommandBuffer( |
- CreateContextCommon(gpu_channel_host, data->surface_handle, |
- share_resources), |
- gpu::SharedMemoryLimits(), DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); |
- if (!context_provider->BindToCurrentThread()) |
- context_provider = nullptr; |
- |
if (!shared_worker_context_provider_) { |
shared_worker_context_provider_ = new ContextProviderCommandBuffer( |
- CreateContextCommon(std::move(gpu_channel_host), |
- gpu::kNullSurfaceHandle, share_resources), |
- gpu::SharedMemoryLimits(), BROWSER_WORKER_CONTEXT); |
+ CreateContextCommon(gpu_channel_host, gpu::kNullSurfaceHandle), |
+ gpu::SharedMemoryLimits(), nullptr, BROWSER_WORKER_CONTEXT); |
if (shared_worker_context_provider_->BindToCurrentThread()) |
shared_worker_context_provider_->SetupLock(); |
else |
shared_worker_context_provider_ = nullptr; |
} |
+ |
+ // The |context_provider| is used for both the browser compositor and the |
+ // display compositor. It shares resources with the worker context, so if |
+ // we failed to make a worker context, just start over and try again. |
+ if (shared_worker_context_provider_) { |
+ context_provider = new ContextProviderCommandBuffer( |
+ CreateContextCommon(std::move(gpu_channel_host), |
+ data->surface_handle), |
+ gpu::SharedMemoryLimits(), shared_worker_context_provider_.get(), |
+ DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); |
+ if (!context_provider->BindToCurrentThread()) |
+ context_provider = nullptr; |
+ } |
} |
bool created_gpu_browser_compositor = |
@@ -683,11 +683,9 @@ GpuProcessTransportFactory::SharedMainThreadContextProvider() { |
// We need a separate context from the compositor's so that skia and gl_helper |
// don't step on each other. |
- bool share_resources = false; |
shared_main_thread_contexts_ = new ContextProviderCommandBuffer( |
- CreateContextCommon(std::move(gpu_channel_host), gpu::kNullSurfaceHandle, |
- share_resources), |
- gpu::SharedMemoryLimits(), BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); |
+ CreateContextCommon(std::move(gpu_channel_host), gpu::kNullSurfaceHandle), |
+ gpu::SharedMemoryLimits(), nullptr, BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); |
shared_main_thread_contexts_->SetLostContextCallback(base::Bind( |
&GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback, |
callback_factory_.GetWeakPtr())); |