diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 10:03:37 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 10:03:37 +0000 |
commit | 59fe2c3b8b23b8fe3631e8a53d7678d09ef2cb11 (patch) | |
tree | 8b43ced9cfb5834229880d25b452c643e0d249d8 /content | |
parent | 9f3809b09055f98e420d5528cdb4c4868ff8c504 (diff) | |
download | chromium_src-59fe2c3b8b23b8fe3631e8a53d7678d09ef2cb11.zip chromium_src-59fe2c3b8b23b8fe3631e8a53d7678d09ef2cb11.tar.gz chromium_src-59fe2c3b8b23b8fe3631e8a53d7678d09ef2cb11.tar.bz2 |
Change WGC3DInProcessCBImpl factories to return a base class pointer.
TBR=sky@chromium.org for ui/aura/bench/bench_main.cc
Review URL: https://chromiumcodereview.appspot.com/17447007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207782 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
4 files changed, 28 insertions, 24 deletions
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc index 81e78ea..f1c3142 100644 --- a/content/browser/renderer_host/image_transport_factory.cc +++ b/content/browser/renderer_host/image_transport_factory.cc @@ -476,12 +476,12 @@ class BrowserCompositorOutputSurface public base::NonThreadSafe { public: BrowserCompositorOutputSurface( - WebGraphicsContext3DCommandBufferImpl* context, + scoped_ptr<WebKit::WebGraphicsContext3D> context, int surface_id, BrowserCompositorOutputSurfaceProxy* output_surface_proxy, base::MessageLoopProxy* compositor_message_loop, base::WeakPtr<ui::Compositor> compositor) - : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context)), + : OutputSurface(context.Pass()), surface_id_(surface_id), output_surface_proxy_(output_surface_proxy), compositor_message_loop_(compositor_message_loop), @@ -619,23 +619,28 @@ class GpuProcessTransportFactory DCHECK(per_compositor_data_.empty()); } - virtual WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext() - OVERRIDE { + scoped_ptr<WebGraphicsContext3DCommandBufferImpl> + CreateOffscreenCommandBufferContext() { base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; return CreateContextCommon(swap_client, 0); } + virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext() + OVERRIDE { + return CreateOffscreenCommandBufferContext() + .PassAs<WebKit::WebGraphicsContext3D>(); + } + virtual cc::OutputSurface* CreateOutputSurface( ui::Compositor* compositor) OVERRIDE { PerCompositorData* data = per_compositor_data_[compositor]; if (!data) data = CreatePerCompositorData(compositor); - WebGraphicsContext3DCommandBufferImpl* context = - CreateContextCommon(data->swap_client->AsWeakPtr(), - data->surface_id); BrowserCompositorOutputSurface* surface = new BrowserCompositorOutputSurface( - context, + CreateContextCommon(data->swap_client->AsWeakPtr(), + data->surface_id) + .PassAs<WebKit::WebGraphicsContext3D>(), per_compositor_data_[compositor]->surface_id, output_surface_proxy_.get(), base::MessageLoopProxy::current(), @@ -809,7 +814,7 @@ class GpuProcessTransportFactory return data; } - WebGraphicsContext3DCommandBufferImpl* CreateContextCommon( + scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContextCommon( const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client, int surface_id) { WebKit::WebGraphicsContext3D::Attributes attrs; @@ -830,8 +835,8 @@ class GpuProcessTransportFactory attrs, false, CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) - return NULL; - return context.release(); + return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); + return context.Pass(); } // Crash given that we are unable to show any UI whatsoever. On Windows we @@ -864,7 +869,7 @@ class GpuProcessTransportFactory virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext3d() OVERRIDE { - return make_scoped_ptr(factory_->CreateOffscreenContext()); + return factory_->CreateOffscreenCommandBufferContext(); } virtual void OnLostContext() OVERRIDE { @@ -908,7 +913,7 @@ class GpuProcessTransportFactory virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext3d() OVERRIDE { - return make_scoped_ptr(factory_->CreateOffscreenContext()); + return factory_->CreateOffscreenCommandBufferContext(); } private: @@ -987,8 +992,9 @@ class SoftwareContextFactory : public ui::ContextFactory { public: SoftwareContextFactory() {} virtual ~SoftwareContextFactory() {} - virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE { - return NULL; + virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext() + OVERRIDE { + return scoped_ptr<WebKit::WebGraphicsContext3D>(); } virtual cc::OutputSurface* CreateOutputSurface( ui::Compositor* compositor) OVERRIDE { diff --git a/content/browser/renderer_host/image_transport_factory_android.cc b/content/browser/renderer_host/image_transport_factory_android.cc index f2ab06c..c1ea043 100644 --- a/content/browser/renderer_host/image_transport_factory_android.cc +++ b/content/browser/renderer_host/image_transport_factory_android.cc @@ -45,7 +45,7 @@ class DirectGLImageTransportFactory : public ImageTransportFactoryAndroid { virtual GLHelper* GetGLHelper() OVERRIDE { return NULL; } private: - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context_; + scoped_ptr<WebKit::WebGraphicsContext3D> context_; DISALLOW_COPY_AND_ASSIGN(DirectGLImageTransportFactory); }; @@ -54,8 +54,8 @@ DirectGLImageTransportFactory::DirectGLImageTransportFactory() { WebKit::WebGraphicsContext3D::Attributes attrs; attrs.shareResources = true; attrs.noAutomaticFlushes = true; - context_.reset(webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: - CreateViewContext(attrs, NULL)); + context_ = webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: + CreateViewContext(attrs, NULL); if (context_->makeContextCurrent()) context_->pushGroupMarkerEXT( base::StringPrintf("DirectGLImageTransportFactory-%p", this).c_str()); diff --git a/content/common/gpu/client/gl_helper_benchmark.cc b/content/common/gpu/client/gl_helper_benchmark.cc index b729ad2..193e836 100644 --- a/content/common/gpu/client/gl_helper_benchmark.cc +++ b/content/common/gpu/client/gl_helper_benchmark.cc @@ -62,9 +62,8 @@ class GLHelperTest : public testing::Test { protected: virtual void SetUp() { WebGraphicsContext3D::Attributes attributes; - context_.reset( - webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: - CreateOffscreenContext(attributes)); + context_ = webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: + CreateOffscreenContext(attributes); context_->makeContextCurrent(); helper_.reset(new content::GLHelper(context_.get())); diff --git a/content/common/gpu/client/gl_helper_unittests.cc b/content/common/gpu/client/gl_helper_unittests.cc index ec728e5..847a0cb 100644 --- a/content/common/gpu/client/gl_helper_unittests.cc +++ b/content/common/gpu/client/gl_helper_unittests.cc @@ -59,9 +59,8 @@ class GLHelperTest : public testing::Test { protected: virtual void SetUp() { WebGraphicsContext3D::Attributes attributes; - context_.reset( - webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: - CreateOffscreenContext(attributes)); + context_ = webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: + CreateOffscreenContext(attributes); context_->makeContextCurrent(); helper_.reset(new content::GLHelper(context_.get())); helper_scaling_.reset(new content::GLHelperScaling( |