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

Unified Diff: ui/compositor/compositor.cc

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet Created 7 years, 4 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 88cfc5637176e296d770d92653b7cc50c21c197c..5edffee8ec3f2431de4972530453527c214cf15a 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -109,17 +109,13 @@ bool DefaultContextFactory::Initialize() {
scoped_ptr<cc::OutputSurface> DefaultContextFactory::CreateOutputSurface(
Compositor* compositor) {
- WebKit::WebGraphicsContext3D::Attributes attrs;
- attrs.depth = false;
- attrs.stencil = false;
- attrs.antialias = false;
- attrs.shareResources = true;
- using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
- scoped_ptr<WebKit::WebGraphicsContext3D> context(
- WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
- attrs, compositor->widget()));
- return make_scoped_ptr(new cc::OutputSurface(context.Pass()));
+ using webkit::gpu::ContextProviderInProcess;
+ scoped_refptr<ContextProviderInProcess> context_provider =
+ ContextProviderInProcess::Create(
+ base::Bind(&DefaultContextFactory::CreateViewContext, compositor));
+ DCHECK(context_provider.get());
+ return make_scoped_ptr(new cc::OutputSurface(context_provider));
}
scoped_refptr<Reflector> DefaultContextFactory::CreateReflector(
@@ -160,15 +156,31 @@ void DefaultContextFactory::RemoveCompositor(Compositor* compositor) {
bool DefaultContextFactory::DoesCreateTestContexts() { return false; }
+// static
+scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
+DefaultContextFactory::CreateViewContext(Compositor* compositor) {
+ WebKit::WebGraphicsContext3D::Attributes attrs;
+ attrs.depth = false;
+ attrs.stencil = false;
+ attrs.antialias = false;
+ attrs.shareResources = true;
+
+ using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
+ scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context(
+ WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
+ attrs, compositor->widget()));
+ CHECK(context);
+ return context.Pass();
+}
+
TestContextFactory::TestContextFactory() {}
TestContextFactory::~TestContextFactory() {}
scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface(
Compositor* compositor) {
- scoped_ptr<WebKit::WebGraphicsContext3D> context(
- cc::TestWebGraphicsContext3D::Create());
- return make_scoped_ptr(new cc::OutputSurface(context.Pass()));
+ return make_scoped_ptr(
+ new cc::OutputSurface(cc::TestContextProvider::Create()));
}
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