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 GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "gpu/gpu_export.h" | 13 #include "gpu/gpu_export.h" |
14 #include "ui/gl/gl_context.h" | 14 #include "ui/gl/gl_context.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gl { |
17 class GPUPreference; | 17 class GPUPreference; |
18 class GPUTimingClient; | 18 class GPUTimingClient; |
19 class GLShareGroup; | 19 class GLShareGroup; |
20 class GLSurface; | 20 class GLSurface; |
21 } | 21 } |
22 | 22 |
23 namespace gpu { | 23 namespace gpu { |
24 namespace gles2 { | 24 namespace gles2 { |
25 class GLES2Decoder; | 25 class GLES2Decoder; |
26 } | 26 } |
27 | 27 |
28 // Encapsulates a virtual OpenGL context. | 28 // Encapsulates a virtual OpenGL context. |
29 class GPU_EXPORT GLContextVirtual : public gfx::GLContext { | 29 class GPU_EXPORT GLContextVirtual : public gl::GLContext { |
30 public: | 30 public: |
31 GLContextVirtual( | 31 GLContextVirtual(gl::GLShareGroup* share_group, |
32 gfx::GLShareGroup* share_group, | 32 gl::GLContext* shared_context, |
33 gfx::GLContext* shared_context, | 33 base::WeakPtr<gles2::GLES2Decoder> decoder); |
34 base::WeakPtr<gles2::GLES2Decoder> decoder); | |
35 | 34 |
36 // Implement GLContext. | 35 // Implement GLContext. |
37 bool Initialize(gfx::GLSurface* compatible_surface, | 36 bool Initialize(gl::GLSurface* compatible_surface, |
38 gfx::GpuPreference gpu_preference) override; | 37 gl::GpuPreference gpu_preference) override; |
39 bool MakeCurrent(gfx::GLSurface* surface) override; | 38 bool MakeCurrent(gl::GLSurface* surface) override; |
40 void ReleaseCurrent(gfx::GLSurface* surface) override; | 39 void ReleaseCurrent(gl::GLSurface* surface) override; |
41 bool IsCurrent(gfx::GLSurface* surface) override; | 40 bool IsCurrent(gl::GLSurface* surface) override; |
42 void* GetHandle() override; | 41 void* GetHandle() override; |
43 scoped_refptr<gfx::GPUTimingClient> CreateGPUTimingClient() override; | 42 scoped_refptr<gl::GPUTimingClient> CreateGPUTimingClient() override; |
44 void OnSetSwapInterval(int interval) override; | 43 void OnSetSwapInterval(int interval) override; |
45 std::string GetExtensions() override; | 44 std::string GetExtensions() override; |
46 void SetSafeToForceGpuSwitch() override; | 45 void SetSafeToForceGpuSwitch() override; |
47 bool WasAllocatedUsingRobustnessExtension() override; | 46 bool WasAllocatedUsingRobustnessExtension() override; |
48 void SetUnbindFboOnMakeCurrent() override; | 47 void SetUnbindFboOnMakeCurrent() override; |
49 gl::YUVToRGBConverter* GetYUVToRGBConverter() override; | 48 gl::YUVToRGBConverter* GetYUVToRGBConverter() override; |
50 | 49 |
51 protected: | 50 protected: |
52 ~GLContextVirtual() override; | 51 ~GLContextVirtual() override; |
53 | 52 |
54 private: | 53 private: |
55 void Destroy(); | 54 void Destroy(); |
56 | 55 |
57 scoped_refptr<gfx::GLContext> shared_context_; | 56 scoped_refptr<gl::GLContext> shared_context_; |
58 base::WeakPtr<gles2::GLES2Decoder> decoder_; | 57 base::WeakPtr<gles2::GLES2Decoder> decoder_; |
59 | 58 |
60 DISALLOW_COPY_AND_ASSIGN(GLContextVirtual); | 59 DISALLOW_COPY_AND_ASSIGN(GLContextVirtual); |
61 }; | 60 }; |
62 | 61 |
63 } // namespace gpu | 62 } // namespace gpu |
64 | 63 |
65 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ | 64 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ |
OLD | NEW |