| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/gpu/gpu_info_collector.h" | 5 #include "content/gpu/gpu_info_collector.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 case 2: | 104 case 2: |
| 105 if (video_card_list[0].vendor_id == kIntelVendorId && | 105 if (video_card_list[0].vendor_id == kIntelVendorId && |
| 106 video_card_list[1].vendor_id != kIntelVendorId) | 106 video_card_list[1].vendor_id != kIntelVendorId) |
| 107 found = 1; | 107 found = 1; |
| 108 else if (video_card_list[0].vendor_id != kIntelVendorId && | 108 else if (video_card_list[0].vendor_id != kIntelVendorId && |
| 109 video_card_list[1].vendor_id == kIntelVendorId) | 109 video_card_list[1].vendor_id == kIntelVendorId) |
| 110 found = 0; | 110 found = 0; |
| 111 break; | 111 break; |
| 112 } | 112 } |
| 113 if (found < video_card_list.size()) { | 113 if (found < video_card_list.size()) { |
| 114 gpu_info->vendor_id = video_card_list[found].vendor_id; | 114 gpu_info->gpu.vendor_id = video_card_list[found].vendor_id; |
| 115 gpu_info->device_id = video_card_list[found].device_id; | 115 gpu_info->gpu.device_id = video_card_list[found].device_id; |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace anonymous | 121 } // namespace anonymous |
| 122 | 122 |
| 123 namespace gpu_info_collector { | 123 namespace gpu_info_collector { |
| 124 | 124 |
| 125 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { | 125 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 150 if (vendor_id_ref) { | 150 if (vendor_id_ref) { |
| 151 vendor_id = IntValueOfCFData((CFDataRef)vendor_id_ref); | 151 vendor_id = IntValueOfCFData((CFDataRef)vendor_id_ref); |
| 152 CFRelease(vendor_id_ref); | 152 CFRelease(vendor_id_ref); |
| 153 } | 153 } |
| 154 CFTypeRef device_id_ref = SearchPortForProperty(dsp_port, CFSTR("device-id")); | 154 CFTypeRef device_id_ref = SearchPortForProperty(dsp_port, CFSTR("device-id")); |
| 155 if (device_id_ref) { | 155 if (device_id_ref) { |
| 156 device_id = IntValueOfCFData((CFDataRef)device_id_ref); | 156 device_id = IntValueOfCFData((CFDataRef)device_id_ref); |
| 157 CFRelease(device_id_ref); | 157 CFRelease(device_id_ref); |
| 158 } | 158 } |
| 159 | 159 |
| 160 gpu_info->vendor_id = vendor_id; | 160 gpu_info->gpu.vendor_id = vendor_id; |
| 161 gpu_info->device_id = device_id; | 161 gpu_info->gpu.device_id = device_id; |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool CollectDriverInfoGL(content::GPUInfo* gpu_info) { | 165 bool CollectDriverInfoGL(content::GPUInfo* gpu_info) { |
| 166 DCHECK(gpu_info); | 166 DCHECK(gpu_info); |
| 167 | 167 |
| 168 // Extract the OpenGL driver version string from the GL_VERSION string. | 168 // Extract the OpenGL driver version string from the GL_VERSION string. |
| 169 // Mac OpenGL drivers have the driver version | 169 // Mac OpenGL drivers have the driver version |
| 170 // at the end of the gl version string preceded by a dash. | 170 // at the end of the gl version string preceded by a dash. |
| 171 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. | 171 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. |
| 172 std::string gl_version_string = gpu_info->gl_version_string; | 172 std::string gl_version_string = gpu_info->gl_version_string; |
| 173 size_t pos = gl_version_string.find_last_of('-'); | 173 size_t pos = gl_version_string.find_last_of('-'); |
| 174 if (pos == std::string::npos) | 174 if (pos == std::string::npos) |
| 175 return false; | 175 return false; |
| 176 gpu_info->driver_version = gl_version_string.substr(pos + 1); | 176 gpu_info->driver_version = gl_version_string.substr(pos + 1); |
| 177 return true; | 177 return true; |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace gpu_info_collector | 180 } // namespace gpu_info_collector |
| OLD | NEW |