| 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> |
| 11 | 11 |
| 12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/synchronization/cancellation_flag.h" | 15 #include "base/synchronization/cancellation_flag.h" |
| 16 #include "ui/gl/gl_share_group.h" | 16 #include "ui/gl/gl_share_group.h" |
| 17 #include "ui/gl/gl_state_restorer.h" | 17 #include "ui/gl/gl_state_restorer.h" |
| 18 #include "ui/gl/gpu_preference.h" | 18 #include "ui/gl/gpu_preference.h" |
| 19 | 19 |
| 20 namespace gpu { | 20 namespace gpu { |
| 21 class GLContextVirtual; | 21 class GLContextVirtual; |
| 22 } // namespace gpu | 22 } // namespace gpu |
| 23 | 23 |
| 24 namespace gfx { | 24 namespace gfx { |
| 25 | 25 |
| 26 class GLSurface; | 26 class GLSurface; |
| 27 class GPUTiming; | 27 class GPUTiming; |
| 28 class GPUTimingClient; | 28 class GPUTimingClient; |
| 29 class VirtualGLApi; | 29 class VirtualGLApi; |
| 30 class YUV420RGBConverter; |
| 30 struct GLVersionInfo; | 31 struct GLVersionInfo; |
| 31 | 32 |
| 32 | |
| 33 // Encapsulates an OpenGL context, hiding platform specific management. | 33 // Encapsulates an OpenGL context, hiding platform specific management. |
| 34 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { | 34 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { |
| 35 public: | 35 public: |
| 36 explicit GLContext(GLShareGroup* share_group); | 36 explicit GLContext(GLShareGroup* share_group); |
| 37 | 37 |
| 38 // Initializes the GL context to be compatible with the given surface. The GL | 38 // Initializes the GL context to be compatible with the given surface. The GL |
| 39 // context can be made with other surface's of the same type. The compatible | 39 // context can be made with other surface's of the same type. The compatible |
| 40 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It | 40 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It |
| 41 // should be specific for all platforms though. | 41 // should be specific for all platforms though. |
| 42 virtual bool Initialize( | 42 virtual bool Initialize( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Notify this context that |virtual_context|, that was using us, is | 120 // Notify this context that |virtual_context|, that was using us, is |
| 121 // being released or destroyed. | 121 // being released or destroyed. |
| 122 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); | 122 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); |
| 123 | 123 |
| 124 // Returns the GL version string. The context must be current. | 124 // Returns the GL version string. The context must be current. |
| 125 virtual std::string GetGLVersion(); | 125 virtual std::string GetGLVersion(); |
| 126 | 126 |
| 127 // Returns the GL renderer string. The context must be current. | 127 // Returns the GL renderer string. The context must be current. |
| 128 virtual std::string GetGLRenderer(); | 128 virtual std::string GetGLRenderer(); |
| 129 | 129 |
| 130 // Returns a helper structure to convert biplanar YUV 420 IOSurface to RGB |
| 131 // textures. |
| 132 virtual YUV420RGBConverter* GetYUV420RGBConverter(); |
| 133 |
| 130 protected: | 134 protected: |
| 131 virtual ~GLContext(); | 135 virtual ~GLContext(); |
| 132 | 136 |
| 133 // Will release the current context when going out of scope, unless canceled. | 137 // Will release the current context when going out of scope, unless canceled. |
| 134 class ScopedReleaseCurrent { | 138 class ScopedReleaseCurrent { |
| 135 public: | 139 public: |
| 136 ScopedReleaseCurrent(); | 140 ScopedReleaseCurrent(); |
| 137 ~ScopedReleaseCurrent(); | 141 ~ScopedReleaseCurrent(); |
| 138 | 142 |
| 139 void Cancel(); | 143 void Cancel(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void SetCurrent(GLSurface* surface) override; | 190 void SetCurrent(GLSurface* surface) override; |
| 187 | 191 |
| 188 private: | 192 private: |
| 189 std::unique_ptr<gfx::GPUTiming> gpu_timing_; | 193 std::unique_ptr<gfx::GPUTiming> gpu_timing_; |
| 190 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 194 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
| 191 }; | 195 }; |
| 192 | 196 |
| 193 } // namespace gfx | 197 } // namespace gfx |
| 194 | 198 |
| 195 #endif // UI_GL_GL_CONTEXT_H_ | 199 #endif // UI_GL_GL_CONTEXT_H_ |
| OLD | NEW |