Index: ui/gfx/compositor/compositor_cc.cc |
diff --git a/ui/gfx/compositor/compositor_cc.cc b/ui/gfx/compositor/compositor_cc.cc |
index 2ebed681438bc173c99418de34f155c5db2f01ad..70a4da3d6fcb0566b27f9e1c3fb59a18c3c8251b 100644 |
--- a/ui/gfx/compositor/compositor_cc.cc |
+++ b/ui/gfx/compositor/compositor_cc.cc |
@@ -23,6 +23,8 @@ |
namespace { |
webkit_glue::WebThreadImpl* g_compositor_thread = NULL; |
+// If true a context is used that results in no rendering. |
+bool test_context_enabled = false; |
} // anonymous namespace |
namespace ui { |
@@ -121,9 +123,6 @@ void TextureCC::Draw(const ui::TextureDrawParams& params, |
NOTREACHED(); |
} |
-// static |
-bool CompositorCC::test_context_enabled_ = false; |
- |
CompositorCC::CompositorCC(CompositorDelegate* delegate, |
gfx::AcceleratedWidget widget, |
const gfx::Size& size) |
@@ -172,12 +171,6 @@ void CompositorCC::Terminate() { |
} |
} |
-// static |
-void CompositorCC::EnableTestContextIfNecessary() { |
- // TODO: only do this if command line param not set. |
- test_context_enabled_ = true; |
-} |
- |
Texture* CompositorCC::CreateTexture() { |
NOTREACHED(); |
return NULL; |
@@ -247,7 +240,7 @@ void CompositorCC::applyScrollDelta(const WebKit::WebSize&) { |
WebKit::WebGraphicsContext3D* CompositorCC::createContext3D() { |
WebKit::WebGraphicsContext3D* context; |
- if (test_context_enabled_) { |
+ if (test_context_enabled) { |
context = new TestWebGraphicsContext3D(); |
} else { |
gfx::GLShareGroup* share_group = |
@@ -286,4 +279,15 @@ Compositor* Compositor::Create(CompositorDelegate* owner, |
return new CompositorCC(owner, widget, size); |
} |
+COMPOSITOR_EXPORT void SetupTestCompositor() { |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableTestCompositor)) { |
+ test_context_enabled = true; |
+ } |
+} |
+ |
+COMPOSITOR_EXPORT void DisableTestCompositor() { |
+ test_context_enabled = false; |
+} |
+ |
} // namespace ui |