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 given context and surface when going out of scope, | |
121 // unless Release() is called. | |
122 class ScopedReleaseCurrent { | |
123 public: | |
124 ScopedReleaseCurrent(GLContext* context, GLSurface* surface); | |
125 ~ScopedReleaseCurrent(); | |
126 | |
127 void Release(); | |
128 | |
129 private: | |
130 GLContext* context_; | |
piman
2014/04/01 23:00:02
nit: scoped_refptr? (below too)
| |
131 GLSurface* surface_; | |
132 }; | |
133 | |
120 // Sets the GL api to the real hardware API (vs the VirtualAPI) | 134 // Sets the GL api to the real hardware API (vs the VirtualAPI) |
121 static void SetRealGLApi(); | 135 static void SetRealGLApi(); |
122 virtual void SetCurrent(GLSurface* surface); | 136 virtual void SetCurrent(GLSurface* surface); |
123 | 137 |
124 // Initialize function pointers to functions where the bound version depends | 138 // Initialize function pointers to functions where the bound version depends |
125 // on GL version or supported extensions. Should be called immediately after | 139 // on GL version or supported extensions. Should be called immediately after |
126 // this context is made current. | 140 // this context is made current. |
127 bool InitializeDynamicBindings(); | 141 bool InitializeDynamicBindings(); |
128 | 142 |
129 // Returns the last real (non-virtual) GLContext made current. | 143 // Returns the last real (non-virtual) GLContext made current. |
(...skipping 22 matching lines...) Expand all Loading... | |
152 | 166 |
153 virtual void SetCurrent(GLSurface* surface) OVERRIDE; | 167 virtual void SetCurrent(GLSurface* surface) OVERRIDE; |
154 | 168 |
155 private: | 169 private: |
156 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 170 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
157 }; | 171 }; |
158 | 172 |
159 } // namespace gfx | 173 } // namespace gfx |
160 | 174 |
161 #endif // UI_GL_GL_CONTEXT_H_ | 175 #endif // UI_GL_GL_CONTEXT_H_ |
OLD | NEW |