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_GPU_SWITCHING_MANAGER_H_ | 5 #ifndef UI_GL_GPU_SWITCHING_MANAGER_H_ |
6 #define UI_GL_GPU_SWITCHING_MANAGER_H_ | 6 #define UI_GL_GPU_SWITCHING_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "ui/gl/gl_export.h" | 12 #include "ui/gl/gl_export.h" |
13 #include "ui/gl/gpu_preference.h" | 13 #include "ui/gl/gpu_preference.h" |
14 #include "ui/gl/gpu_switching_observer.h" | 14 #include "ui/gl/gpu_switching_observer.h" |
15 | 15 |
16 #if defined(OS_MACOSX) | |
17 #include <OpenGL/OpenGL.h> | |
18 #endif // OS_MACOSX | |
19 | |
20 namespace ui { | 16 namespace ui { |
21 | 17 |
22 class GL_EXPORT GpuSwitchingManager { | 18 class GL_EXPORT GpuSwitchingManager { |
23 public: | 19 public: |
24 // Getter for the singleton. This will return NULL on failure. | 20 // Getter for the singleton. This will return NULL on failure. |
25 static GpuSwitchingManager* GetInstance(); | 21 static GpuSwitchingManager* GetInstance(); |
26 | 22 |
27 // Set the switching option to PreferIntegratedGpu. | 23 // Set the switching option to PreferIntegratedGpu. |
28 void ForceUseOfIntegratedGpu(); | 24 void ForceUseOfIntegratedGpu(); |
29 // Set the switching option to PreferDiscreteGpu; switch to discrete GPU | 25 // Set the switching option to PreferDiscreteGpu; switch to discrete GPU |
(...skipping 23 matching lines...) Expand all Loading... |
53 void NotifyGpuSwitched(); | 49 void NotifyGpuSwitched(); |
54 | 50 |
55 private: | 51 private: |
56 friend struct DefaultSingletonTraits<GpuSwitchingManager>; | 52 friend struct DefaultSingletonTraits<GpuSwitchingManager>; |
57 | 53 |
58 GpuSwitchingManager(); | 54 GpuSwitchingManager(); |
59 virtual ~GpuSwitchingManager(); | 55 virtual ~GpuSwitchingManager(); |
60 | 56 |
61 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
62 void SwitchToDiscreteGpuMac(); | 58 void SwitchToDiscreteGpuMac(); |
63 | |
64 CGLPixelFormatObj discrete_pixel_format_; | |
65 #endif // OS_MACOSX | 59 #endif // OS_MACOSX |
66 | 60 |
67 gfx::GpuPreference gpu_switching_option_; | 61 gfx::GpuPreference gpu_switching_option_; |
68 bool gpu_switching_option_set_; | 62 bool gpu_switching_option_set_; |
69 | 63 |
70 bool supports_dual_gpus_; | 64 bool supports_dual_gpus_; |
71 bool supports_dual_gpus_set_; | 65 bool supports_dual_gpus_set_; |
72 | 66 |
73 size_t gpu_count_; | 67 size_t gpu_count_; |
74 | 68 |
| 69 struct PlatformSpecific; |
| 70 scoped_ptr<PlatformSpecific> platform_specific_; |
| 71 |
75 ObserverList<GpuSwitchingObserver> observer_list_; | 72 ObserverList<GpuSwitchingObserver> observer_list_; |
76 | 73 |
77 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); | 74 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); |
78 }; | 75 }; |
79 | 76 |
80 } // namespace ui | 77 } // namespace ui |
81 | 78 |
82 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ | 79 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ |
OLD | NEW |