OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GL_GPU_SWITCHING_MANAGER_H_ |
| 6 #define UI_GL_GPU_SWITCHING_MANAGER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/singleton.h" |
| 11 #include "ui/gl/gl_export.h" |
| 12 #include "ui/gl/gpu_preference.h" |
| 13 |
| 14 namespace gfx { |
| 15 |
| 16 class GL_EXPORT GpuSwitchingManager { |
| 17 public: |
| 18 // Getter for the singleton. This will return NULL on failure. |
| 19 static GpuSwitchingManager* GetInstance(); |
| 20 |
| 21 // Set the switching option, but don't take any actions until later |
| 22 // we access GPU. |
| 23 void ForceUseOfIntegratedGpu(); |
| 24 void ForceUseOfDiscreteGpu(); |
| 25 |
| 26 // Adjust GpuPreference based on the current switching option. |
| 27 // If none is set, return the original GpuPreference. |
| 28 GpuPreference AdjustGpuPreference(GpuPreference gpu_preference); |
| 29 |
| 30 private: |
| 31 friend struct DefaultSingletonTraits<GpuSwitchingManager>; |
| 32 |
| 33 GpuSwitchingManager(); |
| 34 virtual ~GpuSwitchingManager(); |
| 35 |
| 36 std::vector<GpuPreference> gpu_switching_option_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); |
| 39 }; |
| 40 |
| 41 } // namespace gfx |
| 42 |
| 43 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ |
| 44 |
OLD | NEW |