Chromium Code Reviews| Index: content/renderer/renderer_webkitplatformsupport_impl.cc |
| diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc |
| index dd0c3c12bf44d6b6a8be0b4f6e05e99786129b7d..9a72de5e43c02c94e2fc838b2dadd44119bfa610 100644 |
| --- a/content/renderer/renderer_webkitplatformsupport_impl.cc |
| +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc |
| @@ -953,26 +953,33 @@ RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( |
| if (!RenderThreadImpl::current()) |
| return NULL; |
| + scoped_ptr<webkit::gpu::WebGraphicsContext3DImpl> context; |
| #if defined(OS_ANDROID) |
| if (SynchronousCompositorFactory* factory = |
| SynchronousCompositorFactory::GetInstance()) { |
| - return factory->CreateOffscreenGraphicsContext3D(attributes); |
| - } |
| + context.reset(factory->CreateOffscreenGraphicsContext3D(attributes)); |
| + } else |
| #endif |
|
piman
2014/08/28 18:13:02
nit: this is a little hard to read (the interactio
|
| - |
| - scoped_refptr<GpuChannelHost> gpu_channel_host( |
| - RenderThreadImpl::current()->EstablishGpuChannelSync( |
| - CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| - |
| - WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| - bool lose_context_when_out_of_memory = false; |
| - return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| - gpu_channel_host.get(), |
| - attributes, |
| - lose_context_when_out_of_memory, |
| - GURL(attributes.topDocumentURL), |
| - limits, |
| - static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)); |
| + { |
| + scoped_refptr<GpuChannelHost> gpu_channel_host( |
| + RenderThreadImpl::current()->EstablishGpuChannelSync( |
| + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| + |
| + WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| + bool lose_context_when_out_of_memory = false; |
| + context.reset(WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| + gpu_channel_host.get(), |
| + attributes, |
| + lose_context_when_out_of_memory, |
| + GURL(attributes.topDocumentURL), |
| + limits, |
| + static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); |
| + } |
| + // Most likely the GPU process exited and the attempt to reconnect to it |
| + // failed. Need to try to restore the context again later. |
| + if (!context || !context->InitializeOnCurrentThread()) |
| + return NULL; |
| + return context.release(); |
| } |
| //------------------------------------------------------------------------------ |