Index: ui/compositor/compositor.cc |
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc |
index 3758a029656520dd3c6831ee0a1220a1f38a8817..8d9c8b74977494b21928a4e8be9c89a02b4681dd 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( |