Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: content/gpu/gpu_main.cc

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: compile3 Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_main.cc
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index f7650e7bd31410c0f700a0a2703e5e44d660e3bb..9e6160df18233afb38486087db7ffa7a60e1092e 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -219,8 +219,25 @@ int GpuMain(const MainFunctionParams& parameters) {
base::TimeTicks before_initialize_one_off = base::TimeTicks::Now();
+ // Determine if we need to initialize GL here or it has already been done.
+ bool gl_already_initialized = false;
+#if defined(OS_MACOSX)
+ // On Mac, GLSurface::InitializeOneOff() is called from the sandbox warmup
+ // code before getting here.
+ gl_already_initialized = true;
+#endif
+ if (command_line.HasSwitch(switches::kInProcessGPU)) {
+ // With in-process GPU, GLSurface::InitializeOneOff() is called from
+ // GpuChildThread before getting here.
+ gl_already_initialized = true;
+ }
+
// Load and initialize the GL implementation and locate the GL entry points.
- if (gfx::GLSurface::InitializeOneOff()) {
+ bool gl_initialized =
+ gl_already_initialized
+ ? gfx::GetGLImplementation() != gfx::kGLImplementationNone
+ : gfx::GLSurface::InitializeOneOff();
+ if (gl_initialized) {
// We need to collect GL strings (VENDOR, RENDERER) for blacklisting
// purposes. However, on Mac we don't actually use them. As documented in
// crbug.com/222934, due to some driver issues, glGetString could take
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698