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 c3d27592271913680f48b701b5dd2e03855e0255..e00aa43fc6fa00adefdad857c336d12022e504e4 100644 |
| --- a/content/browser/compositor/gpu_process_transport_factory.cc |
| +++ b/content/browser/compositor/gpu_process_transport_factory.cc |
| @@ -107,6 +107,27 @@ bool IsUsingMus() { |
| return shell::ShellIsRemote(); |
| } |
| +static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
| +#if defined(OS_CHROMEOS) |
| + // Software fallback does not happen on Chrome OS. |
| + return true; |
| +#endif |
| + |
| + if (IsUsingMus()) { |
| + // There will always be a GPU process. |
| + return true; |
| + } |
| + |
| +#if defined(OS_WIN) |
| + if (compositor && ::GetProp(compositor->widget(), kForceSoftwareCompositor) && |
| + ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) |
| + return false; |
| +#endif |
| + |
| + return content::GpuDataManagerImpl::GetInstance() |
| + ->CanUseGpuBrowserCompositor(); |
| +} |
| + |
| scoped_refptr<content::ContextProviderCommandBuffer> CreateContextCommon( |
| scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
| gpu::SurfaceHandle surface_handle, |
| @@ -114,8 +135,7 @@ scoped_refptr<content::ContextProviderCommandBuffer> CreateContextCommon( |
| bool support_locking, |
| content::ContextProviderCommandBuffer* shared_context_provider, |
| content::command_buffer_metrics::ContextType type) { |
| - DCHECK( |
| - content::GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()); |
| + DCHECK(ShouldCreateGpuOutputSurface(nullptr)); |
|
danakj
2016/08/12 17:48:29
This is tied to the change for shared main thread
|
| DCHECK(gpu_channel_host); |
| // This is called from a few places to create different contexts: |
| @@ -264,21 +284,6 @@ CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) { |
| return validator; |
| } |
| -static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
| -#if defined(OS_CHROMEOS) |
| - // Software fallback does not happen on Chrome OS. |
| - return true; |
| -#endif |
| - |
| -#if defined(OS_WIN) |
| - if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && |
| - ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) |
| - return false; |
| -#endif |
| - |
| - return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor(); |
| -} |
| - |
| void GpuProcessTransportFactory::CreateOutputSurface( |
| base::WeakPtr<ui::Compositor> compositor) { |
| DCHECK(!!compositor); |
| @@ -361,7 +366,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| } |
| scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; |
| - if (GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) |
| + if (ShouldCreateGpuOutputSurface(nullptr)) |
|
danakj
2016/08/12 17:48:29
I don't think this should change. The fact that we
|
| gpu_channel_host = std::move(established_channel_host); |
| if (!gpu_channel_host) { |
| @@ -767,7 +772,7 @@ GpuProcessTransportFactory::SharedMainThreadContextProvider() { |
| if (shared_main_thread_contexts_) |
| return shared_main_thread_contexts_; |
| - if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) |
| + if (!ShouldCreateGpuOutputSurface(nullptr)) |
|
danakj
2016/08/12 17:48:29
This might be right but it has nothing to do with
|
| return nullptr; |
| DCHECK(gpu_channel_factory_); |