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 c150e0c624ae7bda6806483818d2a117c2a8e005..9b8fcfe346f9458f8f2a0a0e2117baa532c9f757 100644 |
| --- a/content/renderer/renderer_webkitplatformsupport_impl.cc |
| +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc |
| @@ -954,26 +954,33 @@ RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( |
| if (!RenderThreadImpl::current()) |
| return NULL; |
| + webkit::gpu::WebGraphicsContext3DImpl* context = NULL; |
|
danakj
2014/08/15 15:28:44
use scoped_ptr
dshwang
2014/08/15 16:02:32
yes, I'll update soon.
|
| #if defined(OS_ANDROID) |
| if (SynchronousCompositorFactory* factory = |
| SynchronousCompositorFactory::GetInstance()) { |
| - return factory->CreateOffscreenGraphicsContext3D(attributes); |
| - } |
| + context = factory->CreateOffscreenGraphicsContext3D(attributes); |
| + } else |
| #endif |
| - |
| - 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 = WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| + gpu_channel_host.get(), |
| + attributes, |
| + lose_context_when_out_of_memory, |
| + GURL(attributes.topDocumentURL), |
| + limits, |
| + static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)); |
| + } |
| + if (context && !context->BindToCurrentThread()) { |
|
dshwang
2014/08/15 14:54:01
This method is used by WebGL. Now we return the co
|
| + delete context; |
| + return NULL; |
| + } |
| + return context; |
| } |
| //------------------------------------------------------------------------------ |