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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 virtual void ReleaseCurrent(GLSurface* surface) = 0; | 53 virtual void ReleaseCurrent(GLSurface* surface) = 0; |
54 | 54 |
55 // Returns true if this context and surface is current. Pass a null surface | 55 // Returns true if this context and surface is current. Pass a null surface |
56 // if the current surface is not important. | 56 // if the current surface is not important. |
57 virtual bool IsCurrent(GLSurface* surface) = 0; | 57 virtual bool IsCurrent(GLSurface* surface) = 0; |
58 | 58 |
59 // Get the underlying platform specific GL context "handle". | 59 // Get the underlying platform specific GL context "handle". |
60 virtual void* GetHandle() = 0; | 60 virtual void* GetHandle() = 0; |
61 | 61 |
62 // Creates a GPUTimingClient class which abstracts various GPU Timing exts. | 62 // Creates a GPUTimingClient class which abstracts various GPU Timing exts. |
63 virtual scoped_refptr<gl::GPUTimingClient> CreateGPUTimingClient() = 0; | 63 virtual scoped_refptr<GPUTimingClient> CreateGPUTimingClient() = 0; |
64 | 64 |
65 // Gets the GLStateRestorer for the context. | 65 // Gets the GLStateRestorer for the context. |
66 GLStateRestorer* GetGLStateRestorer(); | 66 GLStateRestorer* GetGLStateRestorer(); |
67 | 67 |
68 // Sets the GLStateRestorer for the context (takes ownership). | 68 // Sets the GLStateRestorer for the context (takes ownership). |
69 void SetGLStateRestorer(GLStateRestorer* state_restorer); | 69 void SetGLStateRestorer(GLStateRestorer* state_restorer); |
70 | 70 |
71 // Set swap interval. This context must be current. | 71 // Set swap interval. This context must be current. |
72 void SetSwapInterval(int interval); | 72 void SetSwapInterval(int interval); |
73 | 73 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // being released or destroyed. | 126 // being released or destroyed. |
127 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); | 127 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); |
128 | 128 |
129 // Returns the GL version string. The context must be current. | 129 // Returns the GL version string. The context must be current. |
130 virtual std::string GetGLVersion(); | 130 virtual std::string GetGLVersion(); |
131 | 131 |
132 // Returns the GL renderer string. The context must be current. | 132 // Returns the GL renderer string. The context must be current. |
133 virtual std::string GetGLRenderer(); | 133 virtual std::string GetGLRenderer(); |
134 | 134 |
135 // Returns a helper structure to convert YUV textures to RGB textures. | 135 // Returns a helper structure to convert YUV textures to RGB textures. |
136 virtual gl::YUVToRGBConverter* GetYUVToRGBConverter(); | 136 virtual YUVToRGBConverter* GetYUVToRGBConverter(); |
137 | 137 |
138 protected: | 138 protected: |
139 virtual ~GLContext(); | 139 virtual ~GLContext(); |
140 | 140 |
141 // Will release the current context when going out of scope, unless canceled. | 141 // Will release the current context when going out of scope, unless canceled. |
142 class ScopedReleaseCurrent { | 142 class ScopedReleaseCurrent { |
143 public: | 143 public: |
144 ScopedReleaseCurrent(); | 144 ScopedReleaseCurrent(); |
145 ~ScopedReleaseCurrent(); | 145 ~ScopedReleaseCurrent(); |
146 | 146 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 int swap_interval_; | 180 int swap_interval_; |
181 bool force_swap_interval_zero_; | 181 bool force_swap_interval_zero_; |
182 | 182 |
183 DISALLOW_COPY_AND_ASSIGN(GLContext); | 183 DISALLOW_COPY_AND_ASSIGN(GLContext); |
184 }; | 184 }; |
185 | 185 |
186 class GL_EXPORT GLContextReal : public GLContext { | 186 class GL_EXPORT GLContextReal : public GLContext { |
187 public: | 187 public: |
188 explicit GLContextReal(GLShareGroup* share_group); | 188 explicit GLContextReal(GLShareGroup* share_group); |
189 scoped_refptr<gl::GPUTimingClient> CreateGPUTimingClient() override; | 189 scoped_refptr<GPUTimingClient> CreateGPUTimingClient() override; |
190 | 190 |
191 protected: | 191 protected: |
192 ~GLContextReal() override; | 192 ~GLContextReal() override; |
193 | 193 |
194 void SetCurrent(GLSurface* surface) override; | 194 void SetCurrent(GLSurface* surface) override; |
195 | 195 |
196 private: | 196 private: |
197 std::unique_ptr<gl::GPUTiming> gpu_timing_; | 197 std::unique_ptr<GPUTiming> gpu_timing_; |
198 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 198 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
199 }; | 199 }; |
200 | 200 |
201 } // namespace gl | 201 } // namespace gl |
202 | 202 |
203 #endif // UI_GL_GL_CONTEXT_H_ | 203 #endif // UI_GL_GL_CONTEXT_H_ |
OLD | NEW |