| 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_export.h" | 16 #include "ui/gl/gl_export.h" |
| 17 #include "ui/gl/gl_share_group.h" | 17 #include "ui/gl/gl_share_group.h" |
| 18 #include "ui/gl/gl_state_restorer.h" | 18 #include "ui/gl/gl_state_restorer.h" |
| 19 #include "ui/gl/gpu_preference.h" | 19 #include "ui/gl/gpu_preference.h" |
| 20 | 20 |
| 21 namespace gl { | 21 namespace gl { |
| 22 class YUVToRGBConverter; | 22 class YUVToRGBConverter; |
| 23 } // namespace gl | 23 } // namespace gl |
| 24 | 24 |
| 25 namespace gpu { | 25 namespace gpu { |
| 26 class GLContextVirtual; | 26 class GLContextVirtual; |
| 27 } // namespace gpu | 27 } // namespace gpu |
| 28 | 28 |
| 29 namespace gfx { | 29 namespace gl { |
| 30 | 30 |
| 31 class GLSurface; | 31 class GLSurface; |
| 32 class GPUTiming; | 32 class GPUTiming; |
| 33 class GPUTimingClient; | 33 class GPUTimingClient; |
| 34 class VirtualGLApi; | 34 class VirtualGLApi; |
| 35 struct GLVersionInfo; | 35 struct GLVersionInfo; |
| 36 | 36 |
| 37 // Encapsulates an OpenGL context, hiding platform specific management. | 37 // Encapsulates an OpenGL context, hiding platform specific management. |
| 38 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { | 38 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { |
| 39 public: | 39 public: |
| (...skipping 13 matching lines...) Expand all 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<gfx::GPUTimingClient> CreateGPUTimingClient() = 0; | 63 virtual scoped_refptr<gl::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 105 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<gfx::GPUTimingClient> CreateGPUTimingClient() override; | 189 scoped_refptr<gl::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<gfx::GPUTiming> gpu_timing_; | 197 std::unique_ptr<gl::GPUTiming> gpu_timing_; |
| 198 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 198 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 } // namespace gfx | 201 } // namespace gl |
| 202 | 202 |
| 203 #endif // UI_GL_GL_CONTEXT_H_ | 203 #endif // UI_GL_GL_CONTEXT_H_ |
| OLD | NEW |