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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // If no GPU is forced, return the original GpuPreference; otherwise, return | 29 // If no GPU is forced, return the original GpuPreference; otherwise, return |
30 // the forced GPU. | 30 // the forced GPU. |
31 gfx::GpuPreference AdjustGpuPreference(gfx::GpuPreference gpu_preference); | 31 gfx::GpuPreference AdjustGpuPreference(gfx::GpuPreference gpu_preference); |
32 | 32 |
33 // In the browser process, the value for this flag is computed the first time | 33 // In the browser process, the value for this flag is computed the first time |
34 // this function is called. | 34 // this function is called. |
35 // In the GPU process, the value is passed from the browser process using the | 35 // In the GPU process, the value is passed from the browser process using the |
36 // --supports-dual-gpus commandline switch. | 36 // --supports-dual-gpus commandline switch. |
37 bool SupportsDualGpus(); | 37 bool SupportsDualGpus(); |
38 | 38 |
39 void SetGpuCount(size_t gpu_count); | 39 // Sets the vendor IDs of the GPUs on the system. The length of this |
| 40 // vector defines the count of GPUs. |
| 41 void SetGpuVendorIds(const std::vector<uint32>& vendor_ids); |
40 | 42 |
41 void AddObserver(GpuSwitchingObserver* observer); | 43 void AddObserver(GpuSwitchingObserver* observer); |
42 void RemoveObserver(GpuSwitchingObserver* observer); | 44 void RemoveObserver(GpuSwitchingObserver* observer); |
43 | 45 |
44 // Called when a GPU switch is noticed by the system. In the browser process | 46 // Called when a GPU switch is noticed by the system. In the browser process |
45 // this is occurs as a result of a system observer. In the GPU process, this | 47 // this is occurs as a result of a system observer. In the GPU process, this |
46 // occurs as a result of an IPC from the browser. The system observer is kept | 48 // occurs as a result of an IPC from the browser. The system observer is kept |
47 // in the browser process only so that any workarounds or blacklisting can | 49 // in the browser process only so that any workarounds or blacklisting can |
48 // be applied there. | 50 // be applied there. |
49 void NotifyGpuSwitched(); | 51 void NotifyGpuSwitched(); |
50 | 52 |
51 private: | 53 private: |
52 friend struct DefaultSingletonTraits<GpuSwitchingManager>; | 54 friend struct DefaultSingletonTraits<GpuSwitchingManager>; |
53 | 55 |
54 GpuSwitchingManager(); | 56 GpuSwitchingManager(); |
55 virtual ~GpuSwitchingManager(); | 57 virtual ~GpuSwitchingManager(); |
56 | 58 |
57 #if defined(OS_MACOSX) | 59 #if defined(OS_MACOSX) |
58 void SwitchToDiscreteGpuMac(); | 60 void SwitchToDiscreteGpuMac(); |
59 #endif // OS_MACOSX | 61 #endif // OS_MACOSX |
60 | 62 |
61 gfx::GpuPreference gpu_switching_option_; | 63 gfx::GpuPreference gpu_switching_option_; |
62 bool gpu_switching_option_set_; | 64 bool gpu_switching_option_set_; |
63 | 65 |
| 66 std::vector<uint32> vendor_ids_; |
| 67 |
64 bool supports_dual_gpus_; | 68 bool supports_dual_gpus_; |
65 bool supports_dual_gpus_set_; | 69 bool supports_dual_gpus_set_; |
66 | 70 |
67 size_t gpu_count_; | |
68 | |
69 struct PlatformSpecific; | 71 struct PlatformSpecific; |
70 scoped_ptr<PlatformSpecific> platform_specific_; | 72 scoped_ptr<PlatformSpecific> platform_specific_; |
71 | 73 |
72 ObserverList<GpuSwitchingObserver> observer_list_; | 74 ObserverList<GpuSwitchingObserver> observer_list_; |
73 | 75 |
74 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); | 76 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); |
75 }; | 77 }; |
76 | 78 |
77 } // namespace ui | 79 } // namespace ui |
78 | 80 |
79 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ | 81 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ |
OLD | NEW |