Index: content/renderer/renderer_webkitplatformsupport_impl.cc |
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc |
index 850166d7663cb5613989f4815c289979a8a2334f..d2c087c7c5f2dcb3e317a4c109a5353d965e7d24 100644 |
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc |
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc |
@@ -81,6 +81,7 @@ |
#if defined(OS_ANDROID) |
#include "content/renderer/android/synchronous_compositor_factory.h" |
#include "content/renderer/media/android/audio_decoder_android.h" |
+#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
#endif |
#if defined(OS_MACOSX) |
@@ -952,34 +953,38 @@ RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( |
if (!RenderThreadImpl::current()) |
return NULL; |
- scoped_ptr<webkit::gpu::WebGraphicsContext3DImpl> context; |
- bool must_use_synchronous_factory = false; |
#if defined(OS_ANDROID) |
if (SynchronousCompositorFactory* factory = |
- SynchronousCompositorFactory::GetInstance()) { |
- context.reset(factory->CreateOffscreenGraphicsContext3D(attributes)); |
- must_use_synchronous_factory = true; |
+ SynchronousCompositorFactory::GetInstance()) { |
+ scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> |
+ in_process_context( |
+ factory->CreateOffscreenGraphicsContext3D(attributes)); |
+ if (!in_process_context || |
+ !in_process_context->InitializeOnCurrentThread()) |
+ return NULL; |
+ return in_process_context.release(); |
} |
#endif |
- if (!must_use_synchronous_factory) { |
- 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))); |
- } |
+ |
+ 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; |
+ scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
+ 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 NULL; |
return context.release(); |
} |