1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/logging.h"
6 #include "ui/gl/scoped_cgl.h"
10 ScopedCGLSetCurrentContext::ScopedCGLSetCurrentContext(CGLContextObj context)
11 : previous_context_(CGLGetCurrentContext(), base::scoped_policy::RETAIN) {
12 CGLError error = CGLSetCurrentContext(context);
13 DCHECK_EQ(error, kCGLNoError) << "CGLSetCurrentContext should never fail";
16 ScopedCGLSetCurrentContext::~ScopedCGLSetCurrentContext() {
17 CGLError error = CGLSetCurrentContext(previous_context_);
18 DCHECK_EQ(error, kCGLNoError) << "CGLSetCurrentContext should never fail";