OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "gpu/config/gpu_info_collector_linux.h" | 5 #include "gpu/config/gpu_info_collector_linux.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 gpu_info->basic_info_state = result; | 240 gpu_info->basic_info_state = result; |
241 return result; | 241 return result; |
242 } | 242 } |
243 | 243 |
244 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { | 244 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { |
245 DCHECK(gpu_info); | 245 DCHECK(gpu_info); |
246 | 246 |
247 std::string gl_version = gpu_info->gl_version; | 247 std::string gl_version = gpu_info->gl_version; |
248 if (base::StartsWith(gl_version, "OpenGL ES", base::CompareCase::SENSITIVE)) | 248 if (base::StartsWith(gl_version, "OpenGL ES", base::CompareCase::SENSITIVE)) |
249 gl_version = gl_version.substr(10); | 249 gl_version = gl_version.substr(10); |
250 std::vector<std::string> pieces; | 250 std::vector<std::string> pieces = base::SplitString( |
251 base::SplitStringAlongWhitespace(gl_version, &pieces); | 251 gl_version, base::kWhitespaceASCII, base::KEEP_WHITESPACE, |
| 252 base::SPLIT_WANT_NONEMPTY); |
252 // In linux, the gl version string might be in the format of | 253 // In linux, the gl version string might be in the format of |
253 // GLVersion DriverVendor DriverVersion | 254 // GLVersion DriverVendor DriverVersion |
254 if (pieces.size() < 3) | 255 if (pieces.size() < 3) |
255 return kCollectInfoNonFatalFailure; | 256 return kCollectInfoNonFatalFailure; |
256 | 257 |
257 std::string driver_version = pieces[2]; | 258 std::string driver_version = pieces[2]; |
258 size_t pos = driver_version.find_first_not_of("0123456789."); | 259 size_t pos = driver_version.find_first_not_of("0123456789."); |
259 if (pos == 0) | 260 if (pos == 0) |
260 return kCollectInfoNonFatalFailure; | 261 return kCollectInfoNonFatalFailure; |
261 if (pos != std::string::npos) | 262 if (pos != std::string::npos) |
262 driver_version = driver_version.substr(0, pos); | 263 driver_version = driver_version.substr(0, pos); |
263 | 264 |
264 gpu_info->driver_vendor = pieces[1]; | 265 gpu_info->driver_vendor = pieces[1]; |
265 gpu_info->driver_version = driver_version; | 266 gpu_info->driver_version = driver_version; |
266 return kCollectInfoSuccess; | 267 return kCollectInfoSuccess; |
267 } | 268 } |
268 | 269 |
269 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 270 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
270 const GPUInfo& context_gpu_info) { | 271 const GPUInfo& context_gpu_info) { |
271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 272 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
272 } | 273 } |
273 | 274 |
274 } // namespace gpu | 275 } // namespace gpu |
OLD | NEW |