From a3d4bda4805547161217ebc79c7305b525e8c38b Mon Sep 17 00:00:00 2001 From: "danakj@chromium.org" Date: Thu, 30 Jan 2014 01:04:53 +0000 Subject: 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. R=piman, sievers BUG=270918 Review URL: https://codereview.chromium.org/135213003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247793 0039d316-1c4b-4281-b951-d872f2087c98 --- gpu/tools/compositor_model_bench/compositor_model_bench.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gpu/tools/compositor_model_bench') diff --git a/gpu/tools/compositor_model_bench/compositor_model_bench.cc b/gpu/tools/compositor_model_bench/compositor_model_bench.cc index 44ce333..6c60382 100644 --- a/gpu/tools/compositor_model_bench/compositor_model_bench.cc +++ b/gpu/tools/compositor_model_bench/compositor_model_bench.cc @@ -31,11 +31,10 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/time/time.h" - #include "gpu/tools/compositor_model_bench/render_model_utils.h" #include "gpu/tools/compositor_model_bench/render_models.h" #include "gpu/tools/compositor_model_bench/render_tree.h" - +#include "ui/gl/gl_surface.h" using base::TimeTicks; using base::DirectoryExists; @@ -186,8 +185,8 @@ class Simulator { // Initialize the OpenGL context. bool InitGLContext() { - if (!InitializeStaticGLBindings(gfx::kGLImplementationDesktopGL)) { - LOG(FATAL) << "InitializeStaticGLBindings failed"; + if (!gfx::GLSurface::InitializeOneOff()) { + LOG(FATAL) << "gfx::GLSurface::InitializeOneOff failed"; return false; } -- cgit v1.1