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 #include "ui/gfx/gl/gl_context.h" | 5 #include "ui/gfx/gl/gl_context.h" |
6 | 6 |
7 namespace gfx { | 7 namespace gfx { |
8 | 8 |
9 class GLSurface; | 9 class GLSurface; |
10 | 10 |
11 // Encapsulates a CGL OpenGL context. | 11 // Encapsulates a CGL OpenGL context. |
12 class GLContextCGL : public GLContext { | 12 class GLContextCGL : public GLContext { |
13 public: | 13 public: |
14 explicit GLContextCGL(GLShareGroup* share_group); | 14 explicit GLContextCGL(GLShareGroup* share_group); |
15 virtual ~GLContextCGL(); | |
16 | 15 |
17 // Implement GLContext. | 16 // Implement GLContext. |
18 virtual bool Initialize( | 17 virtual bool Initialize(GLSurface* compatible_surface, |
19 GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE; | 18 GpuPreference gpu_preference) OVERRIDE; |
20 virtual void Destroy() OVERRIDE; | 19 virtual void Destroy() OVERRIDE; |
21 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; | 20 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; |
22 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; | 21 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; |
23 virtual bool IsCurrent(GLSurface* surface) OVERRIDE; | 22 virtual bool IsCurrent(GLSurface* surface) OVERRIDE; |
24 virtual void* GetHandle() OVERRIDE; | 23 virtual void* GetHandle() OVERRIDE; |
25 virtual void SetSwapInterval(int interval) OVERRIDE; | 24 virtual void SetSwapInterval(int interval) OVERRIDE; |
26 | 25 |
| 26 protected: |
| 27 virtual ~GLContextCGL(); |
| 28 |
| 29 private: |
27 // Expose ForceUseOfDiscreteGPU only to GLContext implementation. | 30 // Expose ForceUseOfDiscreteGPU only to GLContext implementation. |
28 friend class GLContext; | 31 friend class GLContext; |
29 | 32 |
30 private: | |
31 void* context_; | |
32 GpuPreference gpu_preference_; | |
33 | |
34 GpuPreference GetGpuPreference(); | 33 GpuPreference GetGpuPreference(); |
35 | 34 |
36 // Helper for dual-GPU support on systems where this is necessary | 35 // Helper for dual-GPU support on systems where this is necessary |
37 // for stability reasons. | 36 // for stability reasons. |
38 static void ForceUseOfDiscreteGPU(); | 37 static void ForceUseOfDiscreteGPU(); |
39 | 38 |
| 39 void* context_; |
| 40 GpuPreference gpu_preference_; |
| 41 |
40 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); | 42 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); |
41 }; | 43 }; |
42 | 44 |
43 } // namespace gfx | 45 } // namespace gfx |
OLD | NEW |