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>(); |
} |