diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 05:05:37 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 05:05:37 +0000 |
commit | 40034cfd142fa1a9801434d545ade1c85146ab7c (patch) | |
tree | 4a4cb8c60bd819a80b532e8b5dddfde679710a81 /ui/compositor/compositor.h | |
parent | 8d8e2f67a179aa07c8e9b8206c81a31cb46028f0 (diff) | |
download | chromium_src-40034cfd142fa1a9801434d545ade1c85146ab7c.zip chromium_src-40034cfd142fa1a9801434d545ade1c85146ab7c.tar.gz chromium_src-40034cfd142fa1a9801434d545ade1c85146ab7c.tar.bz2 |
Aura: sanitize --test-compositor to act like a proper ContextFactory
Previous code would initialize GL in the browser_tests browser process even
though we'll either use test (noop) contexts, or GPU process ones. This causes
issues with some drivers as we try to fork after the GL library is loaded.
BUG=180753
Review URL: https://chromiumcodereview.appspot.com/12575003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor/compositor.h')
-rw-r--r-- | ui/compositor/compositor.h | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 1f263e2..b5b1f0c 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -43,6 +43,7 @@ namespace ui { class Compositor; class CompositorObserver; +class ContextProviderFromContextFactory; class Layer; class PostedSwapQueue; @@ -97,23 +98,44 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { bool Initialize(); - void set_share_group(gfx::GLShareGroup* share_group) { - share_group_ = share_group; - } - private: WebKit::WebGraphicsContext3D* CreateContextCommon( Compositor* compositor, bool offscreen); - scoped_refptr<gfx::GLShareGroup> share_group_; - class DefaultContextProvider; - scoped_refptr<DefaultContextProvider> offscreen_contexts_main_thread_; - scoped_refptr<DefaultContextProvider> offscreen_contexts_compositor_thread_; + scoped_refptr<ContextProviderFromContextFactory> + offscreen_contexts_main_thread_; + scoped_refptr<ContextProviderFromContextFactory> + offscreen_contexts_compositor_thread_; DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); }; +// The factory that creates test contexts. +class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory { + public: + TestContextFactory(); + virtual ~TestContextFactory(); + + // ContextFactory implementation + virtual cc::OutputSurface* CreateOutputSurface( + Compositor* compositor) OVERRIDE; + virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; + virtual scoped_refptr<cc::ContextProvider> + OffscreenContextProviderForMainThread() OVERRIDE; + virtual scoped_refptr<cc::ContextProvider> + OffscreenContextProviderForCompositorThread() OVERRIDE; + virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; + + private: + scoped_refptr<ContextProviderFromContextFactory> + offscreen_contexts_main_thread_; + scoped_refptr<ContextProviderFromContextFactory> + offscreen_contexts_compositor_thread_; + + 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> { |