summaryrefslogtreecommitdiffstats
path: root/ui/compositor
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 10:03:37 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 10:03:37 +0000
commit59fe2c3b8b23b8fe3631e8a53d7678d09ef2cb11 (patch)
tree8b43ced9cfb5834229880d25b452c643e0d249d8 /ui/compositor
parent9f3809b09055f98e420d5528cdb4c4868ff8c504 (diff)
downloadchromium_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 'ui/compositor')
-rw-r--r--ui/compositor/compositor.cc40
-rw-r--r--ui/compositor/compositor.h10
2 files changed, 27 insertions, 23 deletions
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 3758a02..8d9c8b7 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -172,7 +172,7 @@ class ContextProviderFromContextFactory : public cc::ContextProvider {
bool InitializeOnMainThread() {
if (context3d_)
return true;
- context3d_.reset(factory_->CreateOffscreenContext());
+ context3d_ = factory_->CreateOffscreenContext();
return !!context3d_;
}
@@ -201,11 +201,11 @@ bool DefaultContextFactory::Initialize() {
cc::OutputSurface* DefaultContextFactory::CreateOutputSurface(
Compositor* compositor) {
- return new cc::OutputSurface(
- make_scoped_ptr(CreateContextCommon(compositor, false)));
+ return new cc::OutputSurface(CreateContextCommon(compositor, false).Pass());
}
-WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateOffscreenContext() {
+scoped_ptr<WebKit::WebGraphicsContext3D>
+DefaultContextFactory::CreateOffscreenContext() {
return CreateContextCommon(NULL, true);
}
@@ -245,9 +245,9 @@ DefaultContextFactory::OffscreenContextProviderForCompositorThread() {
void DefaultContextFactory::RemoveCompositor(Compositor* compositor) {
}
-WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon(
- Compositor* compositor,
- bool offscreen) {
+scoped_ptr<WebKit::WebGraphicsContext3D>
+DefaultContextFactory::CreateContextCommon(Compositor* compositor,
+ bool offscreen) {
DCHECK(offscreen || compositor);
WebKit::WebGraphicsContext3D::Attributes attrs;
attrs.depth = false;
@@ -255,14 +255,14 @@ WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon(
attrs.antialias = false;
attrs.shareResources = true;
using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
- WebKit::WebGraphicsContext3D* context =
- offscreen ?
- WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- attrs) :
- WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
- attrs, compositor->widget());
+ scoped_ptr<WebKit::WebGraphicsContext3D> context(
+ offscreen
+ ? WebGraphicsContext3DInProcessCommandBufferImpl::
+ CreateOffscreenContext(attrs)
+ : WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
+ attrs, compositor->widget()));
if (!context)
- return NULL;
+ return context.Pass();
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (!offscreen) {
@@ -272,7 +272,7 @@ WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon(
gl_context->SetSwapInterval(vsync ? 1 : 0);
gl_context->ReleaseCurrent(NULL);
}
- return context;
+ return context.Pass();
}
TestContextFactory::TestContextFactory() {}
@@ -281,13 +281,15 @@ TestContextFactory::~TestContextFactory() {}
cc::OutputSurface* TestContextFactory::CreateOutputSurface(
Compositor* compositor) {
- return new cc::OutputSurface(make_scoped_ptr(CreateOffscreenContext()));
+ return new cc::OutputSurface(CreateOffscreenContext());
}
-WebKit::WebGraphicsContext3D* TestContextFactory::CreateOffscreenContext() {
- ui::TestWebGraphicsContext3D* context = new ui::TestWebGraphicsContext3D;
+scoped_ptr<WebKit::WebGraphicsContext3D>
+TestContextFactory::CreateOffscreenContext() {
+ scoped_ptr<ui::TestWebGraphicsContext3D> context(
+ new ui::TestWebGraphicsContext3D);
context->Initialize();
- return context;
+ return context.PassAs<WebKit::WebGraphicsContext3D>();
}
scoped_refptr<Reflector> TestContextFactory::CreateReflector(
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index 9762bb6..67ee81b 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -82,7 +82,7 @@ class COMPOSITOR_EXPORT ContextFactory {
// Creates a context used for offscreen rendering. This context can be shared
// with all compositors.
- virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0;
+ virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext() = 0;
// Creates a reflector that copies the content of the |mirrored_compositor|
// onto |mirroing_layer|.
@@ -110,7 +110,8 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory {
// ContextFactory implementation
virtual cc::OutputSurface* CreateOutputSurface(
Compositor* compositor) OVERRIDE;
- virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE;
+ virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext()
+ OVERRIDE;
virtual scoped_refptr<Reflector> CreateReflector(
Compositor* compositor,
@@ -126,7 +127,7 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory {
bool Initialize();
private:
- WebKit::WebGraphicsContext3D* CreateContextCommon(
+ scoped_ptr<WebKit::WebGraphicsContext3D> CreateContextCommon(
Compositor* compositor,
bool offscreen);
@@ -147,7 +148,8 @@ class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory {
// ContextFactory implementation
virtual cc::OutputSurface* CreateOutputSurface(
Compositor* compositor) OVERRIDE;
- virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE;
+ virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext()
+ OVERRIDE;
virtual scoped_refptr<Reflector> CreateReflector(
Compositor* mirrored_compositor,