OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GL_GL_CONTEXT_H_ | 5 #ifndef UI_GL_GL_CONTEXT_H_ |
6 #define UI_GL_GL_CONTEXT_H_ | 6 #define UI_GL_GL_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 // Returns the GL version string. The context must be current. | 111 // Returns the GL version string. The context must be current. |
112 virtual std::string GetGLVersion(); | 112 virtual std::string GetGLVersion(); |
113 | 113 |
114 // Returns the GL renderer string. The context must be current. | 114 // Returns the GL renderer string. The context must be current. |
115 virtual std::string GetGLRenderer(); | 115 virtual std::string GetGLRenderer(); |
116 | 116 |
117 protected: | 117 protected: |
118 virtual ~GLContext(); | 118 virtual ~GLContext(); |
119 | 119 |
| 120 // Will release the current context when going out of scope, unless canceled. |
| 121 class ScopedReleaseCurrent { |
| 122 public: |
| 123 ScopedReleaseCurrent(); |
| 124 ~ScopedReleaseCurrent(); |
| 125 |
| 126 void Cancel(); |
| 127 |
| 128 private: |
| 129 bool canceled_; |
| 130 }; |
| 131 |
120 // Sets the GL api to the real hardware API (vs the VirtualAPI) | 132 // Sets the GL api to the real hardware API (vs the VirtualAPI) |
121 static void SetRealGLApi(); | 133 static void SetRealGLApi(); |
122 virtual void SetCurrent(GLSurface* surface); | 134 virtual void SetCurrent(GLSurface* surface); |
123 | 135 |
124 // Initialize function pointers to functions where the bound version depends | 136 // Initialize function pointers to functions where the bound version depends |
125 // on GL version or supported extensions. Should be called immediately after | 137 // on GL version or supported extensions. Should be called immediately after |
126 // this context is made current. | 138 // this context is made current. |
127 bool InitializeDynamicBindings(); | 139 bool InitializeDynamicBindings(); |
128 | 140 |
129 // Returns the last real (non-virtual) GLContext made current. | 141 // Returns the last real (non-virtual) GLContext made current. |
(...skipping 22 matching lines...) Expand all Loading... |
152 | 164 |
153 virtual void SetCurrent(GLSurface* surface) OVERRIDE; | 165 virtual void SetCurrent(GLSurface* surface) OVERRIDE; |
154 | 166 |
155 private: | 167 private: |
156 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 168 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
157 }; | 169 }; |
158 | 170 |
159 } // namespace gfx | 171 } // namespace gfx |
160 | 172 |
161 #endif // UI_GL_GL_CONTEXT_H_ | 173 #endif // UI_GL_GL_CONTEXT_H_ |
OLD | NEW |