diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 17:32:55 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 17:32:55 +0000 |
commit | f633394a005fde18fe09f3b3fb5e6c6d796587e9 (patch) | |
tree | 0de40fe2006144460e92914c80e08446e4f867d5 /ui/compositor/compositor.h | |
parent | ff42cbdf15e1494608840d9c6c27d26eeaad65f0 (diff) | |
download | chromium_src-f633394a005fde18fe09f3b3fb5e6c6d796587e9.zip chromium_src-f633394a005fde18fe09f3b3fb5e6c6d796587e9.tar.gz chromium_src-f633394a005fde18fe09f3b3fb5e6c6d796587e9.tar.bz2 |
Move test-only ContextFactory implementations out of production targets
This moves (Test|Default)ContextFactory and associated setup out of the
production compositor target into the test-only compositor_test_support library.
This removes the need for us to link in fake/mock classes into the prod build
and cleans up several pieces of confusing static state. Code that wants to use
one of the test ContextFactory implementations now has to call either
ui::InitializeContextFactoryForTests() or, if it's depending on content and
using aura, content::ImageTransportFactory::InitializeForUnitTests() and pass
in a ContextFactory implementation. Content-based tests get the latter for free
through content::BrowserTestBase.
R=piman,sky
Review URL: https://codereview.chromium.org/45963003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor/compositor.h')
-rw-r--r-- | ui/compositor/compositor.h | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 8992969..513822a 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -34,7 +34,6 @@ class ContextProvider; class Layer; class LayerTreeDebugState; class LayerTreeHost; -class TestContextProvider; } namespace gfx { @@ -117,68 +116,6 @@ class COMPOSITOR_EXPORT ContextFactory { virtual bool DoesCreateTestContexts() = 0; }; -// The default factory that creates in-process contexts. -class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { - public: - DefaultContextFactory(); - virtual ~DefaultContextFactory(); - - // ContextFactory implementation - virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( - Compositor* compositor) OVERRIDE; - - virtual scoped_refptr<Reflector> CreateReflector( - Compositor* compositor, - Layer* layer) OVERRIDE; - virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE; - - virtual scoped_refptr<cc::ContextProvider> - OffscreenCompositorContextProvider() OVERRIDE; - virtual scoped_refptr<cc::ContextProvider> - SharedMainThreadContextProvider() OVERRIDE; - virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; - virtual bool DoesCreateTestContexts() OVERRIDE; - - bool Initialize(); - - private: - scoped_refptr<webkit::gpu::ContextProviderInProcess> - offscreen_compositor_contexts_; - scoped_refptr<webkit::gpu::ContextProviderInProcess> - shared_main_thread_contexts_; - - DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); -}; - -// The factory that creates test contexts. -class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory { - public: - TestContextFactory(); - virtual ~TestContextFactory(); - - // ContextFactory implementation - virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( - Compositor* compositor) OVERRIDE; - - virtual scoped_refptr<Reflector> CreateReflector( - Compositor* mirrored_compositor, - Layer* mirroring_layer) OVERRIDE; - virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE; - - virtual scoped_refptr<cc::ContextProvider> - OffscreenCompositorContextProvider() OVERRIDE; - virtual scoped_refptr<cc::ContextProvider> - SharedMainThreadContextProvider() OVERRIDE; - virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; - virtual bool DoesCreateTestContexts() OVERRIDE; - - private: - scoped_refptr<cc::TestContextProvider> offscreen_compositor_contexts_; - scoped_refptr<cc::TestContextProvider> shared_main_thread_contexts_; - - DISALLOW_COPY_AND_ASSIGN(TestContextFactory); -}; - // Texture provide an abstraction over the external texture that can be passed // to a layer. class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { @@ -288,14 +225,6 @@ 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(); |