| 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 #include "ui/gl/gpu_switching_manager.h" | 5 #include "ui/gl/gpu_switching_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace gfx { | 9 namespace gfx { |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 void GpuSwitchingManager::ForceUseOfDiscreteGpu() { | 27 void GpuSwitchingManager::ForceUseOfDiscreteGpu() { |
| 28 gpu_switching_option_.clear(); | 28 gpu_switching_option_.clear(); |
| 29 gpu_switching_option_.push_back(PreferDiscreteGpu); | 29 gpu_switching_option_.push_back(PreferDiscreteGpu); |
| 30 } | 30 } |
| 31 | 31 |
| 32 GpuPreference GpuSwitchingManager::AdjustGpuPreference( | 32 GpuPreference GpuSwitchingManager::AdjustGpuPreference( |
| 33 GpuPreference gpu_preference) { | 33 GpuPreference gpu_preference) { |
| 34 if (gpu_switching_option_.size() == 0) | 34 if (gpu_switching_option_.size() == 0) |
| 35 return gpu_preference; | 35 return gpu_preference; |
| 36 DCHECK_EQ(gpu_switching_option_.size(), 1u); | 36 DCHECK_EQ(gpu_switching_option_.size(), 1u); |
| 37 #if defined(OS_MACOSX) |
| 38 // Create a pixel format that lasts the lifespan of Chrome, so Chrome |
| 39 // stays on the discrete GPU. |
| 40 if (gpu_switching_option_[0] == PreferDiscreteGpu) |
| 41 GLContextCGL::ForceUseOfDiscreteGPU(); |
| 42 #endif // OS_MACOSX |
| 37 return gpu_switching_option_[0]; | 43 return gpu_switching_option_[0]; |
| 38 } | 44 } |
| 39 | 45 |
| 40 } // namespace gfx | 46 } // namespace gfx |
| 47 |
| OLD | NEW |