diff options
Diffstat (limited to 'chromium/webkit/common/gpu')
5 files changed, 38 insertions, 67 deletions
diff --git a/chromium/webkit/common/gpu/context_provider_in_process.cc b/chromium/webkit/common/gpu/context_provider_in_process.cc index 1e42ab04d6b..e56da80fd0a 100644 --- a/chromium/webkit/common/gpu/context_provider_in_process.cc +++ b/chromium/webkit/common/gpu/context_provider_in_process.cc @@ -4,7 +4,6 @@ #include "webkit/common/gpu/context_provider_in_process.h" -#include "base/bind.h" #include "base/callback_helpers.h" #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" @@ -54,35 +53,6 @@ class ContextProviderInProcess::MemoryAllocationCallbackProxy ContextProviderInProcess* provider_; }; -// static -scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( - const CreateCallback& create_callback) { - scoped_refptr<ContextProviderInProcess> provider = - new ContextProviderInProcess; - if (!provider->InitializeOnMainThread(create_callback)) - return NULL; - return provider; -} - -static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> -CreateOffscreenContext() { - WebKit::WebGraphicsContext3D::Attributes attributes; - attributes.depth = false; - attributes.stencil = true; - attributes.antialias = false; - attributes.shareResources = true; - attributes.noAutomaticFlushes = true; - - return WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( - attributes).Pass(); -} - -// static -scoped_refptr<ContextProviderInProcess> -ContextProviderInProcess::CreateOffscreen() { - return Create(base::Bind(&CreateOffscreenContext)); -} - ContextProviderInProcess::ContextProviderInProcess() : destroyed_(false) { DCHECK(main_thread_checker_.CalledOnValidThread()); @@ -94,13 +64,22 @@ ContextProviderInProcess::~ContextProviderInProcess() { context_thread_checker_.CalledOnValidThread()); } -bool ContextProviderInProcess::InitializeOnMainThread( - const CreateCallback& create_callback) { +bool ContextProviderInProcess::InitializeOnMainThread() { DCHECK(!context3d_); DCHECK(main_thread_checker_.CalledOnValidThread()); - DCHECK(!create_callback.is_null()); - context3d_ = create_callback.Run(); + WebKit::WebGraphicsContext3D::Attributes attributes; + attributes.depth = false; + attributes.stencil = true; + attributes.antialias = false; + attributes.shareResources = true; + attributes.noAutomaticFlushes = true; + + using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; + context3d_ = + WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( + attributes); + return context3d_; } diff --git a/chromium/webkit/common/gpu/context_provider_in_process.h b/chromium/webkit/common/gpu/context_provider_in_process.h index 169a1a8fdd3..b427abeb043 100644 --- a/chromium/webkit/common/gpu/context_provider_in_process.h +++ b/chromium/webkit/common/gpu/context_provider_in_process.h @@ -19,21 +19,17 @@ class WebGraphicsContext3D; namespace webkit { namespace gpu { class GrContextForWebGraphicsContext3D; -class WebGraphicsContext3DInProcessCommandBufferImpl; class WEBKIT_GPU_EXPORT ContextProviderInProcess : NON_EXPORTED_BASE(public cc::ContextProvider) { public: - typedef base::Callback< - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(void)> - CreateCallback; - - static scoped_refptr<ContextProviderInProcess> Create( - const CreateCallback& create_callback); - - // Calls Create() with a default factory method for creating an offscreen - // context. - static scoped_refptr<ContextProviderInProcess> CreateOffscreen(); + static scoped_refptr<ContextProviderInProcess> Create() { + scoped_refptr<ContextProviderInProcess> provider = + new ContextProviderInProcess; + if (!provider->InitializeOnMainThread()) + return NULL; + return provider; + } virtual bool BindToCurrentThread() OVERRIDE; virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; @@ -47,8 +43,7 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess ContextProviderInProcess(); virtual ~ContextProviderInProcess(); - bool InitializeOnMainThread( - const CreateCallback& create_callback); + bool InitializeOnMainThread(); void OnLostContext(); void OnMemoryAllocationChanged(bool nonzero_allocation); diff --git a/chromium/webkit/common/gpu/test_context_provider_factory.cc b/chromium/webkit/common/gpu/test_context_provider_factory.cc index 7e4f04f949e..88464c00074 100644 --- a/chromium/webkit/common/gpu/test_context_provider_factory.cc +++ b/chromium/webkit/common/gpu/test_context_provider_factory.cc @@ -27,7 +27,7 @@ TestContextProviderFactory::~TestContextProviderFactory() {} scoped_refptr<cc::ContextProvider> TestContextProviderFactory:: OffscreenContextProviderForMainThread() { if (!main_thread_.get() || main_thread_->DestroyedOnMainThread()) { - main_thread_ = ContextProviderInProcess::CreateOffscreen(); + main_thread_ = ContextProviderInProcess::Create(); if (main_thread_.get() && !main_thread_->BindToCurrentThread()) main_thread_ = NULL; } diff --git a/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index 66c7a53a525..886e40f5f46 100644 --- a/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -66,11 +66,11 @@ static base::LazyInstance<GLES2Initializer> g_gles2_initializer = } // namespace anonymous // static -scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> +scoped_ptr<WebKit::WebGraphicsContext3D> WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( const WebKit::WebGraphicsContext3D::Attributes& attributes, gfx::AcceleratedWidget window) { - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context; + scoped_ptr<WebKit::WebGraphicsContext3D> context; if (gfx::GLSurface::InitializeOneOff()) { context.reset(new WebGraphicsContext3DInProcessCommandBufferImpl( scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window)); @@ -79,7 +79,7 @@ WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( } // static -scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> +scoped_ptr<WebKit::WebGraphicsContext3D> WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( const WebKit::WebGraphicsContext3D::Attributes& attributes) { return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( @@ -87,10 +87,10 @@ WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( attributes, true, gfx::kNullAcceleratedWidget)) - .Pass(); + .PassAs<WebKit::WebGraphicsContext3D>(); } -scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> +scoped_ptr<WebKit::WebGraphicsContext3D> WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( scoped_ptr< ::gpu::GLInProcessContext> context, const WebKit::WebGraphicsContext3D::Attributes& attributes) { @@ -100,7 +100,7 @@ WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( attributes, true /* is_offscreen. Not used. */, gfx::kNullAcceleratedWidget /* window. Not used. */)) - .Pass(); + .PassAs<WebKit::WebGraphicsContext3D>(); } WebGraphicsContext3DInProcessCommandBufferImpl:: diff --git a/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h index f96607d7dc3..d3620b411b2 100644 --- a/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h +++ b/chromium/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h @@ -48,19 +48,16 @@ namespace gpu { class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl : public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) { public: - static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> - CreateViewContext( - const WebKit::WebGraphicsContext3D::Attributes& attributes, - gfx::AcceleratedWidget window); - - static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> - CreateOffscreenContext( - const WebKit::WebGraphicsContext3D::Attributes& attributes); - - static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> - WrapContext( - scoped_ptr< ::gpu::GLInProcessContext> context, - const WebKit::WebGraphicsContext3D::Attributes& attributes); + static scoped_ptr<WebKit::WebGraphicsContext3D> CreateViewContext( + const WebKit::WebGraphicsContext3D::Attributes& attributes, + gfx::AcceleratedWidget window); + + static scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext( + const WebKit::WebGraphicsContext3D::Attributes& attributes); + + static scoped_ptr<WebKit::WebGraphicsContext3D> WrapContext( + scoped_ptr< ::gpu::GLInProcessContext> context, + const WebKit::WebGraphicsContext3D::Attributes& attributes); virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |