summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorpilgrim <pilgrim@chromium.org>2014-09-29 22:00:58 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-30 05:01:21 +0000
commit7db0709dc9a1622c95c42ff349561da528e905b2 (patch)
tree29784107943d9ff739146b5a3384975257f4bda5 /content
parent1a815bc356ca4e4e387870b2cd953030ae6647ba (diff)
downloadchromium_src-7db0709dc9a1622c95c42ff349561da528e905b2.zip
chromium_src-7db0709dc9a1622c95c42ff349561da528e905b2.tar.gz
chromium_src-7db0709dc9a1622c95c42ff349561da528e905b2.tar.bz2
Move InitializeOnCurrentThread down from WebGraphicsContext3DImpl to WebGraphicsContext3DCommandBufferImpl and WebGraphicsContext3DInProcessCommandBufferImpl
in preparation for dis-inheriting these classes BUG=338338 TBR=darin@chromium.org Review URL: https://codereview.chromium.org/609973002 Cr-Commit-Position: refs/heads/master@{#297362}
Diffstat (limited to 'content')
-rw-r--r--content/browser/android/in_process/synchronous_compositor_factory_impl.cc2
-rw-r--r--content/browser/android/in_process/synchronous_compositor_factory_impl.h2
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h3
-rw-r--r--content/renderer/android/synchronous_compositor_factory.h4
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc47
5 files changed, 31 insertions, 27 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
index fbbb910..a329fde 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
@@ -223,7 +223,7 @@ SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) {
return factory;
}
-webkit::gpu::WebGraphicsContext3DImpl*
+webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl*
SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D(
const blink::WebGraphicsContext3D::Attributes& attributes) {
return WrapContextWithAttributes(CreateOffscreenContext(attributes),
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.h b/content/browser/android/in_process/synchronous_compositor_factory_impl.h
index 73044bb..8f57cb4 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.h
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.h
@@ -44,7 +44,7 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
const std::string& debug_name) OVERRIDE;
virtual scoped_refptr<StreamTextureFactory> CreateStreamTextureFactory(
int view_id) OVERRIDE;
- virtual webkit::gpu::WebGraphicsContext3DImpl*
+ virtual webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl*
CreateOffscreenGraphicsContext3D(
const blink::WebGraphicsContext3D::Attributes& attributes) OVERRIDE;
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
index 2fe59c5..9b4c7b6 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
@@ -142,8 +142,7 @@ class WebGraphicsContext3DCommandBufferImpl
return mem_limits_.mapped_memory_reclaim_limit;
}
- // WebGraphicsContext3DImpl methods
- virtual bool InitializeOnCurrentThread() OVERRIDE;
+ CONTENT_EXPORT bool InitializeOnCurrentThread();
//----------------------------------------------------------------------
// WebGraphicsContext3D methods
diff --git a/content/renderer/android/synchronous_compositor_factory.h b/content/renderer/android/synchronous_compositor_factory.h
index e5d9aa0..9653bc2 100644
--- a/content/renderer/android/synchronous_compositor_factory.h
+++ b/content/renderer/android/synchronous_compositor_factory.h
@@ -21,7 +21,7 @@ class OutputSurface;
namespace webkit {
namespace gpu {
class ContextProviderWebContext;
-class WebGraphicsContext3DImpl;
+class WebGraphicsContext3DInProcessCommandBufferImpl;
}
}
@@ -58,7 +58,7 @@ class SynchronousCompositorFactory {
const std::string& debug_name) = 0;
virtual scoped_refptr<StreamTextureFactory> CreateStreamTextureFactory(
int frame_id) = 0;
- virtual webkit::gpu::WebGraphicsContext3DImpl*
+ virtual webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl*
CreateOffscreenGraphicsContext3D(
const blink::WebGraphicsContext3D::Attributes& attributes) = 0;
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 850166d..d2c087c 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();
}