Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(992)

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 470973002: gpu: Remove WebGraphicsContext3D::makeContextCurrent() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix in unittests Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b340b7cdd3bc95e758c196ccc64f7e502d09ee38 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -953,26 +953,35 @@ 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()) {
- return factory->CreateOffscreenGraphicsContext3D(attributes);
+ context.reset(factory->CreateOffscreenGraphicsContext3D(attributes));
+ must_use_synchronous_factory = true;
}
#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));
+ 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)));
+ }
+ // 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();
}
//------------------------------------------------------------------------------
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | content/shell/renderer/test_runner/TestPlugin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698