| Index: ui/gl/scoped_cgl.cc
|
| diff --git a/ui/gl/scoped_cgl.cc b/ui/gl/scoped_cgl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9fef3851c1ab17501f73cdddf5b4050c28131bdc
|
| --- /dev/null
|
| +++ b/ui/gl/scoped_cgl.cc
|
| @@ -0,0 +1,21 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/logging.h"
|
| +#include "ui/gl/scoped_cgl.h"
|
| +
|
| +namespace gfx {
|
| +
|
| +ScopedCGLSetCurrentContext::ScopedCGLSetCurrentContext(CGLContextObj context)
|
| + : previous_context_(CGLGetCurrentContext(), base::scoped_policy::RETAIN) {
|
| + CGLError error = CGLSetCurrentContext(context);
|
| + DCHECK_EQ(error, kCGLNoError) << "CGLSetCurrentContext should never fail";
|
| +}
|
| +
|
| +ScopedCGLSetCurrentContext::~ScopedCGLSetCurrentContext() {
|
| + CGLError error = CGLSetCurrentContext(previous_context_);
|
| + DCHECK_EQ(error, kCGLNoError) << "CGLSetCurrentContext should never fail";
|
| +}
|
| +
|
| +} // namespace gfx
|
|
|