summaryrefslogtreecommitdiffstats
path: root/ui/gl/scoped_make_current.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gl/scoped_make_current.h')
-rw-r--r--ui/gl/scoped_make_current.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/ui/gl/scoped_make_current.h b/ui/gl/scoped_make_current.h
new file mode 100644
index 0000000..3c336f3
--- /dev/null
+++ b/ui/gl/scoped_make_current.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 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.
+
+#ifndef UI_GL_SCOPED_MAKE_CURRENT_H_
+#define UI_GL_SCOPED_MAKE_CURRENT_H_
+#pragma once
+
+#include "ui/gl/gl_context.h"
+#include "ui/gl/gl_surface.h"
+
+namespace gfx {
+
+class GL_EXPORT ScopedMakeCurrent {
+ public:
+ explicit ScopedMakeCurrent(GLContext* context, GLSurface* surface);
+ ~ScopedMakeCurrent();
+
+ bool Succeeded();
+
+ private:
+ scoped_refptr<GLContext> previous_context_;
+ scoped_refptr<GLSurface> previous_surface_;
+ scoped_refptr<GLContext> context_;
+ scoped_refptr<GLSurface> surface_;
+ bool succeeded_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedMakeCurrent);
+};
+
+} // namespace gfx
+
+#endif // UI_GL_SCOPED_MAKE_CURRENT_H_