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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gl/gl_switches.h" | 9 #include "ui/gl/gl_switches.h" |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #if defined(OS_MACOSX) | 66 #if defined(OS_MACOSX) |
67 // Create a pixel format that lasts the lifespan of Chrome, so Chrome | 67 // Create a pixel format that lasts the lifespan of Chrome, so Chrome |
68 // stays on the discrete GPU. | 68 // stays on the discrete GPU. |
69 SwitchToDiscreteGpuMac(); | 69 SwitchToDiscreteGpuMac(); |
70 #endif // OS_MACOSX | 70 #endif // OS_MACOSX |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 bool GpuSwitchingManager::SupportsDualGpus() { | 74 bool GpuSwitchingManager::SupportsDualGpus() { |
75 if (!supports_dual_gpus_set_) { | 75 if (!supports_dual_gpus_set_) { |
76 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 76 const base::CommandLine& command_line = |
| 77 *base::CommandLine::ForCurrentProcess(); |
77 bool flag = false; | 78 bool flag = false; |
78 if (command_line.HasSwitch(switches::kSupportsDualGpus)) { | 79 if (command_line.HasSwitch(switches::kSupportsDualGpus)) { |
79 // GPU process, flag is passed down from browser process. | 80 // GPU process, flag is passed down from browser process. |
80 std::string flag_string = command_line.GetSwitchValueASCII( | 81 std::string flag_string = command_line.GetSwitchValueASCII( |
81 switches::kSupportsDualGpus); | 82 switches::kSupportsDualGpus); |
82 if (flag_string == "true") { | 83 if (flag_string == "true") { |
83 flag = true; | 84 flag = true; |
84 } else if (flag_string == "false") { | 85 } else if (flag_string == "false") { |
85 flag = false; | 86 flag = false; |
86 } else { | 87 } else { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return; | 136 return; |
136 CGLPixelFormatAttribute attribs[1]; | 137 CGLPixelFormatAttribute attribs[1]; |
137 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); | 138 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); |
138 GLint num_pixel_formats = 0; | 139 GLint num_pixel_formats = 0; |
139 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format, | 140 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format, |
140 &num_pixel_formats); | 141 &num_pixel_formats); |
141 } | 142 } |
142 #endif // OS_MACOSX | 143 #endif // OS_MACOSX |
143 | 144 |
144 } // namespace ui | 145 } // namespace ui |
OLD | NEW |