summaryrefslogtreecommitdiffstats
path: root/content/gpu/gpu_child_thread.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-30 01:04:53 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-30 01:04:53 +0000
commita3d4bda4805547161217ebc79c7305b525e8c38b (patch)
tree380dae77b9f0793c7524c46828f6714ede976a43 /content/gpu/gpu_child_thread.cc
parentb773065a8fcd6d50575bf290836aa65a02ee0fa5 (diff)
downloadchromium_src-a3d4bda4805547161217ebc79c7305b525e8c38b.zip
chromium_src-a3d4bda4805547161217ebc79c7305b525e8c38b.tar.gz
chromium_src-a3d4bda4805547161217ebc79c7305b525e8c38b.tar.bz2
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
Diffstat (limited to 'content/gpu/gpu_child_thread.cc')
-rw-r--r--content/gpu/gpu_child_thread.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index 170b364..63f850f 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -65,11 +65,14 @@ GpuChildThread::GpuChildThread(const std::string& channel_id)
DCHECK(
CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) ||
CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU));
+#if !defined(OS_ANDROID)
// For single process and in-process GPU mode, we need to load and
// initialize the GL implementation and locate the GL entry points here.
- if (!gfx::GLSurface::InitializeOneOff()) {
- VLOG(1) << "gfx::GLSurface::InitializeOneOff()";
- }
+ // On Android, GLSurface::InitializeOneOff() is called from BrowserMainLoop
+ // before getting here. crbug.com/326295
+ if (!gfx::GLSurface::InitializeOneOff())
+ VLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
+#endif
g_thread_safe_sender.Get() = thread_safe_sender();
}