Index: ui/gl/gl_surface_win.cc |
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc |
index 62bd4980df6f50f9b2fa7aee1070f894293af320..929147039759311bb223d087411afe77f9d0497b 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; |
} |