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 #include "ui/gl/gpu_switching_manager.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 namespace gfx { |
| 10 |
| 11 // static |
| 12 GpuSwitchingManager* GpuSwitchingManager::GetInstance() { |
| 13 return Singleton<GpuSwitchingManager>::get(); |
| 14 } |
| 15 |
| 16 GpuSwitchingManager::GpuSwitchingManager() { |
| 17 } |
| 18 |
| 19 GpuSwitchingManager::~GpuSwitchingManager() { |
| 20 } |
| 21 |
| 22 void GpuSwitchingManager::ForceUseOfIntegratedGpu() { |
| 23 gpu_switching_option_.clear(); |
| 24 gpu_switching_option_.push_back(PreferIntegratedGpu); |
| 25 } |
| 26 |
| 27 void GpuSwitchingManager::ForceUseOfDiscreteGpu() { |
| 28 gpu_switching_option_.clear(); |
| 29 gpu_switching_option_.push_back(PreferDiscreteGpu); |
| 30 } |
| 31 |
| 32 GpuPreference GpuSwitchingManager::AdjustGpuPreference( |
| 33 GpuPreference gpu_preference) { |
| 34 if (gpu_switching_option_.size() == 0) |
| 35 return gpu_preference; |
| 36 DCHECK_EQ(gpu_switching_option_.size(), 1u); |
| 37 return gpu_switching_option_[0]; |
| 38 } |
| 39 |
| 40 } // namespace gfx |
| 41 |
OLD | NEW |