| Index: ui/gl/gl_context.cc
|
| diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc
|
| index cd9a28c387dcfabd66c18b7ccf7bbd3b88c3ff44..6003dee17eaa2c7133705cde9ad5c55365ba5ca7 100644
|
| --- a/ui/gl/gl_context.cc
|
| +++ b/ui/gl/gl_context.cc
|
| @@ -26,6 +26,25 @@ base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky
|
| current_real_context_ = LAZY_INSTANCE_INITIALIZER;
|
| } // namespace
|
|
|
| +GLContext::ScopedReleaseCurrent::ScopedReleaseCurrent(GLContext* context,
|
| + GLSurface* surface)
|
| + : context_(context), surface_(surface) {
|
| + DCHECK(context && surface);
|
| + DCHECK(context->IsCurrent(surface));
|
| +}
|
| +
|
| +GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() {
|
| + if (surface_) {
|
| + DCHECK(context_);
|
| + context_->ReleaseCurrent(surface_);
|
| + }
|
| +}
|
| +
|
| +void GLContext::ScopedReleaseCurrent::Release() {
|
| + context_ = NULL;
|
| + surface_ = NULL;
|
| +}
|
| +
|
| GLContext::GLContext(GLShareGroup* share_group) : share_group_(share_group) {
|
| if (!share_group_.get())
|
| share_group_ = new GLShareGroup;
|
| @@ -125,6 +144,8 @@ GLContext* GLContext::GetRealCurrent() {
|
| void GLContext::SetCurrent(GLSurface* surface) {
|
| current_context_.Pointer()->Set(surface ? this : NULL);
|
| GLSurface::SetCurrent(surface);
|
| + if (!surface)
|
| + SetGLApiToNoContext();
|
| }
|
|
|
| GLStateRestorer* GLContext::GetGLStateRestorer() {
|
|
|