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_CGL_H_ | 5 #ifndef UI_GL_GL_CONTEXT_CGL_H_ |
6 #define UI_GL_GL_CONTEXT_CGL_H_ | 6 #define UI_GL_GL_CONTEXT_CGL_H_ |
7 | 7 |
8 #include <OpenGL/CGLTypes.h> | 8 #include <OpenGL/CGLTypes.h> |
9 | 9 |
10 #include "base/memory/scoped_generic_obj.h" | 10 #include "base/memory/scoped_generic_obj.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; | 31 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; |
32 | 32 |
33 // Helper for dual-GPU support on systems where this is necessary | 33 // Helper for dual-GPU support on systems where this is necessary |
34 // for stability reasons. | 34 // for stability reasons. |
35 static void ForceUseOfDiscreteGPU(); | 35 static void ForceUseOfDiscreteGPU(); |
36 | 36 |
37 protected: | 37 protected: |
38 virtual ~GLContextCGL(); | 38 virtual ~GLContextCGL(); |
39 | 39 |
40 private: | 40 private: |
| 41 // Expose ForceUseOfDiscreteGPU only to GLContext implementation. |
| 42 friend class GLContext; |
| 43 |
41 GpuPreference GetGpuPreference(); | 44 GpuPreference GetGpuPreference(); |
42 | 45 |
| 46 // Helper for dual-GPU support on systems where this is necessary |
| 47 // for stability reasons. |
| 48 static void ForceUseOfDiscreteGPU(); |
| 49 |
43 void* context_; | 50 void* context_; |
44 GpuPreference gpu_preference_; | 51 GpuPreference gpu_preference_; |
45 | 52 |
46 CGLPixelFormatObj discrete_pixelformat_; | 53 CGLPixelFormatObj discrete_pixelformat_; |
47 | 54 |
48 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); | 55 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); |
49 }; | 56 }; |
50 | 57 |
51 class ScopedCGLDestroyRendererInfo { | 58 class ScopedCGLDestroyRendererInfo { |
52 public: | 59 public: |
53 void operator()(CGLRendererInfoObj x) const; | 60 void operator()(CGLRendererInfoObj x) const; |
54 }; | 61 }; |
55 | 62 |
56 typedef ScopedGenericObj<CGLRendererInfoObj, ScopedCGLDestroyRendererInfo> | 63 typedef ScopedGenericObj<CGLRendererInfoObj, ScopedCGLDestroyRendererInfo> |
57 ScopedCGLRendererInfoObj; | 64 ScopedCGLRendererInfoObj; |
58 | 65 |
59 } // namespace gfx | 66 } // namespace gfx |
60 | 67 |
61 #endif // UI_GL_GL_CONTEXT_CGL_H_ | 68 #endif // UI_GL_GL_CONTEXT_CGL_H_ |
OLD | NEW |