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 a5b14336ab766d262cf57c47b317d497ab7b1980..b992dc80af721b9b1905b40526a73b4327b9a1b8 100644 |
| --- a/content/browser/compositor/gpu_process_transport_factory.cc |
| +++ b/content/browser/compositor/gpu_process_transport_factory.cc |
| @@ -244,11 +244,13 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| if (create_gpu_output_surface) { |
| // Try to reuse existing worker context provider. |
| + bool shared_worker_context_provider_lost = false; |
| if (shared_worker_context_provider_) { |
| base::AutoLock lock(*shared_worker_context_provider_->GetLock()); |
| if (shared_worker_context_provider_->ContextGL() |
| - ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) |
| - shared_worker_context_provider_ = nullptr; |
| + ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
| + shared_worker_context_provider_lost = true; |
|
piman
2015/09/14 21:54:38
nit: why the change? As opposed to just resetting
reveman
2015/09/15 20:38:35
To avoid deleting the context while holding the lo
|
| + } |
| } |
| scoped_refptr<GpuChannelHost> gpu_channel_host = |
| BrowserGpuChannelHostFactory::instance()->GetGpuChannel(); |
| @@ -259,7 +261,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| BROWSER_COMPOSITOR_ONSCREEN_CONTEXT); |
| if (context_provider && !context_provider->BindToCurrentThread()) |
| context_provider = nullptr; |
| - if (!shared_worker_context_provider_) { |
| + if (!shared_worker_context_provider_ || |
| + shared_worker_context_provider_lost) { |
| shared_worker_context_provider_ = ContextProviderCommandBuffer::Create( |
| GpuProcessTransportFactory::CreateContextCommon(gpu_channel_host, |
| 0), |
| @@ -267,6 +270,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| if (shared_worker_context_provider_ && |
| !shared_worker_context_provider_->BindToCurrentThread()) |
| shared_worker_context_provider_ = nullptr; |
| + if (shared_worker_context_provider_) |
| + shared_worker_context_provider_->SetupLock(); |
| } |
| } |