Chromium Code Reviews| 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 39f25f7247c9ada748644b9527d87ff73598d308..748d09506a5a892c66e986067635b3ff9d7970d5 100644 |
| --- a/content/browser/compositor/gpu_process_transport_factory.cc |
| +++ b/content/browser/compositor/gpu_process_transport_factory.cc |
| @@ -93,8 +93,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); |
| @@ -125,8 +124,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)); |
| } |
| } // namespace |
| @@ -341,26 +339,24 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| data->surface_id ? tracker->GetSurfaceHandle(data->surface_id) |
| : gpu::kNullSurfaceHandle; |
| - // 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, 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; |
| } |
| + |
| + // This context is used for both the browser compositor and the display |
| + // compositor. It shares resources with the worker context. |
|
piman
2016/04/27 22:09:33
Should we do this only if shared_worker_context_pr
danakj
2016/04/28 00:25:58
Good point, will match RenderWidget and go back to
|
| + context_provider = new ContextProviderCommandBuffer( |
| + CreateContextCommon(std::move(gpu_channel_host), 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 = |
| @@ -660,11 +656,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())); |