| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // system stability issues. http://crbug.com/113703 | 143 // system stability issues. http://crbug.com/113703 |
| 144 std::string model; | 144 std::string model; |
| 145 int32 model_major, model_minor; | 145 int32 model_major, model_minor; |
| 146 if (!base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), | 146 if (!base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), |
| 147 &model, &model_major, &model_minor)) { | 147 &model, &model_major, &model_minor)) { |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 | 150 |
| 151 const int kMacBookProFirstDualAMDIntelGPUModel = 8; | 151 const int kMacBookProFirstDualAMDIntelGPUModel = 8; |
| 152 | 152 |
| 153 // Do not overwrite commandline switches to honor a user's decision. |
| 153 bool forcibly_disable = | 154 bool forcibly_disable = |
| 154 ((model == "MacBookPro") && | 155 ((model == "MacBookPro") && |
| 155 (model_major < kMacBookProFirstDualAMDIntelGPUModel)) || | 156 (model_major < kMacBookProFirstDualAMDIntelGPUModel)) && |
| 156 CommandLine::ForCurrentProcess()->HasSwitch( | 157 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kGpuSwitching); |
| 157 switches::kDisableGpuSwitching); | |
| 158 | 158 |
| 159 if (forcibly_disable) { | 159 if (forcibly_disable) { |
| 160 GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); | 160 GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 supports_dual_gpus = true; | 164 supports_dual_gpus = true; |
| 165 } | 165 } |
| 166 | 166 |
| 167 return supports_dual_gpus; | 167 return supports_dual_gpus; |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace gfx | 170 } // namespace gfx |
| OLD | NEW |