#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "third_party/mesa/src/include/GL/osmesa.h"
#include "ui/gl/GL/glextchromium.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_implementation.h"
namespace gfx {
-namespace {
-
-// scoped_ptr functor for XFree(). Use as follows:
-// scoped_ptr_malloc<XVisualInfo, ScopedPtrXFree> foo(...);
-// where "XVisualInfo" is any X type that is freed with XFree.
-class ScopedPtrXFree {
- public:
- void operator()(void* x) const {
- ::XFree(x);
- }
-};
-
-} // namespace
-
GLContextGLX::GLContextGLX(GLShareGroup* share_group)
: GLContextReal(share_group),
context_(NULL),
if (IsCurrent(surface))
return true;
+ ScopedReleaseCurrent release_current;
TRACE_EVENT0("gpu", "GLContextGLX::MakeCurrent");
if (!glXMakeContextCurrent(
display_,
SetCurrent(surface);
if (!InitializeDynamicBindings()) {
- ReleaseCurrent(surface);
Destroy();
return false;
}
if (!surface->OnMakeCurrent(this)) {
LOG(ERROR) << "Could not make current.";
- ReleaseCurrent(surface);
Destroy();
return false;
}
+ release_current.Cancel();
return true;
}