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

Unified Diff: ui/gfx/gl/gl_surface_wgl.cc

Issue 8588009: use-gl=desktop mode got broken in r109111. GL proc addresses were not being found because ::GetPr... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gl/gl_surface_wgl.cc
===================================================================
--- ui/gfx/gl/gl_surface_wgl.cc (revision 110321)
+++ ui/gfx/gl/gl_surface_wgl.cc (working copy)
@@ -5,6 +5,7 @@
#include "ui/gfx/gl/gl_surface_wgl.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "ui/gfx/gl/gl_bindings.h"
namespace gfx {
@@ -157,13 +158,30 @@
return true;
DCHECK(g_display == NULL);
- g_display = new DisplayWGL;
- if (!g_display->Init()) {
- delete g_display;
- g_display = NULL;
+ scoped_ptr<DisplayWGL> wgl_display(new DisplayWGL);
+ if (!wgl_display->Init())
return false;
+
+ // Create a temporary GL context to bind to extension entry points.
+ HGLRC gl_context = wglCreateContext(wgl_display->device_context());
+ if (!gl_context) {
+ LOG(ERROR) << "Failed to create temporary context.";
+ return false;
}
+ if (!wglMakeCurrent(wgl_display->device_context(), gl_context)) {
+ LOG(ERROR) << "Failed to make temporary GL context current.";
+ wglDeleteContext(gl_context);
+ return false;
+ }
+ // Get bindings to extension functions that cannot be acquired without a
+ // current context.
+ InitializeGLBindingsGL();
+ InitializeGLBindingsWGL();
+ wglMakeCurrent(NULL, NULL);
+ wglDeleteContext(gl_context);
+
+ g_display = wgl_display.release();
initialized = true;
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698