From 032b23bdf5cee5eb23e4764580173f0459dfd9ca Mon Sep 17 00:00:00 2001 From: "ccameron@chromium.org" Date: Tue, 3 Dec 2013 13:00:08 +0000 Subject: Fall back to software mode if Aura can't create a GL context Wire up fallback from Compositor::CreateOutputSurface to ContextFactory::CreateOutputSurface, so that we force using the software compositor after failing to create a GL context enough times. BUG=319267 Review URL: https://codereview.chromium.org/93593002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238382 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/compositor/compositor.cc | 2 +- ui/compositor/compositor.h | 2 +- ui/compositor/test/default_context_factory.cc | 3 ++- ui/compositor/test/default_context_factory.h | 2 +- ui/compositor/test/test_context_factory.cc | 3 ++- ui/compositor/test/test_context_factory.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) (limited to 'ui/compositor') diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index b2eea11..da0bcde 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -508,7 +508,7 @@ void Compositor::Layout() { } scoped_ptr Compositor::CreateOutputSurface(bool fallback) { - return ContextFactory::GetInstance()->CreateOutputSurface(this); + return ContextFactory::GetInstance()->CreateOutputSurface(this, fallback); } void Compositor::DidCommit() { diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 7dabd53..f74abe0 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -86,7 +86,7 @@ class COMPOSITOR_EXPORT ContextFactory { // per-compositor data (e.g. a shared context), that needs to be cleaned up // by calling RemoveCompositor when the compositor gets destroyed. virtual scoped_ptr CreateOutputSurface( - Compositor* compositor) = 0; + Compositor* compositor, bool software_fallback) = 0; // Creates a reflector that copies the content of the |mirrored_compositor| // onto |mirroing_layer|. diff --git a/ui/compositor/test/default_context_factory.cc b/ui/compositor/test/default_context_factory.cc index f5601c9..4839e1f1 100644 --- a/ui/compositor/test/default_context_factory.cc +++ b/ui/compositor/test/default_context_factory.cc @@ -30,7 +30,8 @@ bool DefaultContextFactory::Initialize() { } scoped_ptr DefaultContextFactory::CreateOutputSurface( - Compositor* compositor) { + Compositor* compositor, bool software_fallback) { + DCHECK(!software_fallback); blink::WebGraphicsContext3D::Attributes attrs; attrs.depth = false; attrs.stencil = false; diff --git a/ui/compositor/test/default_context_factory.h b/ui/compositor/test/default_context_factory.h index b89bdd8..7b8501b 100644 --- a/ui/compositor/test/default_context_factory.h +++ b/ui/compositor/test/default_context_factory.h @@ -23,7 +23,7 @@ class DefaultContextFactory : public ContextFactory { // ContextFactory implementation virtual scoped_ptr CreateOutputSurface( - Compositor* compositor) OVERRIDE; + Compositor* compositor, bool software_fallback) OVERRIDE; virtual scoped_refptr CreateReflector( Compositor* compositor, diff --git a/ui/compositor/test/test_context_factory.cc b/ui/compositor/test/test_context_factory.cc index d47dec9..0c4b274 100644 --- a/ui/compositor/test/test_context_factory.cc +++ b/ui/compositor/test/test_context_factory.cc @@ -15,7 +15,8 @@ TestContextFactory::TestContextFactory() {} TestContextFactory::~TestContextFactory() {} scoped_ptr TestContextFactory::CreateOutputSurface( - Compositor* compositor) { + Compositor* compositor, bool software_fallback) { + DCHECK(!software_fallback); return make_scoped_ptr( new cc::OutputSurface(cc::TestContextProvider::Create())); } diff --git a/ui/compositor/test/test_context_factory.h b/ui/compositor/test/test_context_factory.h index d419292..9b4bd9d 100644 --- a/ui/compositor/test/test_context_factory.h +++ b/ui/compositor/test/test_context_factory.h @@ -19,7 +19,7 @@ class TestContextFactory : public ContextFactory { // ContextFactory implementation virtual scoped_ptr CreateOutputSurface( - Compositor* compositor) OVERRIDE; + Compositor* compositor, bool software_fallback) OVERRIDE; virtual scoped_refptr CreateReflector( Compositor* mirrored_compositor, -- cgit v1.1