Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Unified Diff: ui/compositor/compositor.cc

Issue 17447007: Change WGC3DInProcessCBImpl factories to return a base class pointer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/compositor.h ('k') | webkit/common/gpu/context_provider_in_process.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « ui/compositor/compositor.h ('k') | webkit/common/gpu/context_provider_in_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698