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

Unified Diff: ui/compositor/compositor.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restart with GrContext owned in cc Created 7 years, 10 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
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 9e7c4d54496ee96db23b3253c0519a9e2c6d90a8..feca354b5c22717b6f05bd955163e022f74e78b4 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -141,6 +141,9 @@ DefaultContextFactory::~DefaultContextFactory() {
}
bool DefaultContextFactory::Initialize() {
+ if (g_test_compositor_enabled)
+ return true;
+
// The following line of code exists soley to disable IO restrictions
// on this thread long enough to perform the GL bindings.
// TODO(wjmaclean) Remove this when GL initialisation cleaned up.
@@ -163,6 +166,30 @@ WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateOffscreenContext() {
return CreateContextCommon(NULL, true);
}
+WebKit::WebGraphicsContext3D* DefaultContextFactory::
+ OffscreenContextForMainThread() {
+ if (!test_offscreen_context_main_thread_) {
+ scoped_ptr<ui::TestWebGraphicsContext3D> test_context(
+ new ui::TestWebGraphicsContext3D());
+ test_context->Initialize();
+ test_offscreen_context_main_thread_ =
+ test_context.PassAs<WebKit::WebGraphicsContext3D>();
+ }
+ return test_offscreen_context_main_thread_.get();
+}
+
+WebKit::WebGraphicsContext3D* DefaultContextFactory::
+ OffscreenContextForCompositorThread() {
+ if (!test_offscreen_context_compositor_thread_) {
+ scoped_ptr<ui::TestWebGraphicsContext3D> test_context(
+ new ui::TestWebGraphicsContext3D());
+ test_context->Initialize();
+ test_offscreen_context_compositor_thread_ =
+ test_context.PassAs<WebKit::WebGraphicsContext3D>();
+ }
+ return test_offscreen_context_compositor_thread_.get();
+}
+
void DefaultContextFactory::RemoveCompositor(Compositor* compositor) {
}
@@ -521,6 +548,16 @@ scoped_ptr<cc::OutputSurface> Compositor::createOutputSurface() {
void Compositor::didRecreateOutputSurface(bool success) {
}
+WebKit::WebGraphicsContext3D*
+ Compositor::OffscreenContext3dForMainThread() {
+ return ContextFactory::GetInstance()->OffscreenContextForMainThread();
+}
+
+WebKit::WebGraphicsContext3D*
+ Compositor::OffscreenContext3dForCompositorThread() {
+ return ContextFactory::GetInstance()->OffscreenContextForCompositorThread();
+}
+
scoped_ptr<cc::InputHandler> Compositor::createInputHandler() {
return scoped_ptr<cc::InputHandler>();
}

Powered by Google App Engine
This is Rietveld 408576698