Ensure GL initialization only happens once, and provide common init path
Currently tests initialize GL by calling into methods that should be
internal to the gl bindings code. Instead, everyone should go through
GLSurface::InitializeOneOff.
Also GLSurface::InitializeOneOff early outs if it was already called,
leading to a pattern of initializing GL all over the place just in case
and not having a clear idea of where it should be set up. Instead, DCHECK
that it is not called more than once, and move calls to this method to
be during process startup for unit test suites instead of mid-test.
This adds two test variants of InitializeOneOff for tests to call, that
set up OSMesa or Mock GL bindings, via GLSurface::InitializeOneOff.
[email protected], [email protected], [email protected], piman, sievers
BUG=270918
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=247793
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=248049
Review URL: https://codereview.chromium.org/135213003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248557 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gl/gl_implementation_x11.cc b/ui/gl/gl_implementation_x11.cc
index 7588a37f..c19b39e3 100644
--- a/ui/gl/gl_implementation_x11.cc
+++ b/ui/gl/gl_implementation_x11.cc
@@ -43,8 +43,7 @@
// Prevent reinitialization with a different implementation. Once the gpu
// unit tests have initialized with kGLImplementationMock, we don't want to
// later switch to another GL implementation.
- if (GetGLImplementation() != kGLImplementationNone)
- return true;
+ DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
// Allow the main thread or another to initialize these bindings
// after instituting restrictions on I/O. Going forward they will