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

Unified Diff: ui/compositor/compositor.h

Issue 21052007: aura: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: Fix dominance 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
Index: ui/compositor/compositor.h
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index c8689b179b2ce914ebbc283fa1e69f7360e9b618..220e275e3eb267390d9e6a3dfafc3b47d97a400b 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -99,6 +99,10 @@ class COMPOSITOR_EXPORT ContextFactory {
// Destroys per-compositor data.
virtual void RemoveCompositor(Compositor* compositor) = 0;
+
+ // When true, the factory uses test contexts that do not do real GL
+ // operations.
+ virtual bool UsesTestContexts() = 0;
sky 2013/08/05 16:50:58 nit: IMO a better name for this is IsUsingTestCont
danakj 2013/08/05 16:53:34 That name sounds like it could change, whereas I w
};
// The default factory that creates in-process contexts.
@@ -123,6 +127,7 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory {
virtual scoped_refptr<cc::ContextProvider>
OffscreenContextProviderForCompositorThread() OVERRIDE;
virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
+ virtual bool UsesTestContexts() OVERRIDE;
bool Initialize();
@@ -161,6 +166,7 @@ class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory {
virtual scoped_refptr<cc::ContextProvider>
OffscreenContextProviderForCompositorThread() OVERRIDE;
virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
+ virtual bool UsesTestContexts() OVERRIDE;
private:
scoped_refptr<ContextProviderFromContextFactory>
@@ -290,6 +296,14 @@ class COMPOSITOR_EXPORT Compositor
gfx::AcceleratedWidget widget);
virtual ~Compositor();
+ // Set up the compositor ContextFactory for a test environment. Unit tests
+ // that do not have a full content environment need to call this before
+ // initializing the Compositor.
+ // Some tests expect pixel output, and they should pass false for
+ // |allow_test_contexts|. Most unit tests should pass true. Once this has been
+ // called, the Initialize() and Terminate() methods should be used as normal.
+ static void InitializeContextFactoryForTests(bool allow_test_contexts);
+
static void Initialize();
static bool WasInitializedWithThread();
static scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop();

Powered by Google App Engine
This is Rietveld 408576698