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

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 609973002: Move InitializeOnCurrentThread down from WebGraphicsContext3DImpl to WebGraphicsContext3DCommandBuf… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-add CONTENT_EXPORT to InitializeOnCurrentThread to fix android_clang_dbg build Created 6 years, 3 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 850166d7663cb5613989f4815c289979a8a2334f..7677fa0a9ce55f0eb7431656900cc27f97f4f343 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,39 @@ 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;
+ in_process_context.reset(
jamesr 2014/09/29 21:22:31 no need to separate declaration of the variable fr
+ 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;
+ context.reset(WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
jamesr 2014/09/29 21:22:31 ditto, this can just be scoped_ptr<...> context =
+ 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();
}
« no previous file with comments | « content/renderer/android/synchronous_compositor_factory.h ('k') | webkit/common/gpu/webgraphicscontext3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698