From 40034cfd142fa1a9801434d545ade1c85146ab7c Mon Sep 17 00:00:00 2001 From: "piman@chromium.org" Date: Wed, 13 Mar 2013 05:05:37 +0000 Subject: 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 --- ui/compositor/compositor.h | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'ui/compositor/compositor.h') 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 share_group_; - class DefaultContextProvider; - scoped_refptr offscreen_contexts_main_thread_; - scoped_refptr offscreen_contexts_compositor_thread_; + scoped_refptr + offscreen_contexts_main_thread_; + scoped_refptr + 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 + OffscreenContextProviderForMainThread() OVERRIDE; + virtual scoped_refptr + OffscreenContextProviderForCompositorThread() OVERRIDE; + virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; + + private: + scoped_refptr + offscreen_contexts_main_thread_; + scoped_refptr + 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 { -- cgit v1.1