Index: ui/gl/gl_surface_win.cc |
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc |
index ff2ed84267ccf6d0fd2bee91ff977495481b3b45..77073a034850dc24c23c6ae1b32d4e48804b365d 100644 |
--- a/ui/gl/gl_surface_win.cc |
+++ b/ui/gl/gl_surface_win.cc |
@@ -82,22 +82,26 @@ class DWMVSyncProvider : public VSyncProvider { |
DISALLOW_COPY_AND_ASSIGN(DWMVSyncProvider); |
}; |
-// Helper routine that does one-off initialization like determining the |
-// pixel format and initializing the GL bindings. |
+// Helper routine that does one-off initialization like determining the pixel |
+// format, executed before the GL bindings are initialized. |
+bool GLSurface::InitializePreBindingsInternal(GLImplementation impl) { |
+ if (impl == kGLImplementationDesktopGL) { |
+ // The surface needs to be initialized in order to create a context needed |
+ // for initializing bindings. |
+ if (!GLSurfaceWGL::InitializeOneOff()) { |
+ LOG(ERROR) << "GLSurfaceWGL::InitializeOneOff failed."; |
+ return false; |
+ } |
+ } |
+ return true; |
+} |
+ |
bool GLSurface::InitializeOneOffInternal() { |
- switch (GetGLImplementation()) { |
- case kGLImplementationDesktopGL: |
- if (!GLSurfaceWGL::InitializeOneOff()) { |
- LOG(ERROR) << "GLSurfaceWGL::InitializeOneOff failed."; |
- return false; |
- } |
- break; |
- case kGLImplementationEGLGLES2: |
- if (!GLSurfaceEGL::InitializeOneOff()) { |
- LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
- return false; |
- } |
- break; |
+ if (GetGLImplementation() == kGLImplementationEGLGLES2) { |
+ if (!GLSurfaceEGL::InitializeOneOff()) { |
+ LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
+ return false; |
+ } |
} |
return true; |
} |