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 = base::SplitString( | 250 std::vector<std::string> pieces; |
251 gl_version, base::kWhitespaceASCII, base::KEEP_WHITESPACE, | 251 base::SplitStringAlongWhitespace(gl_version, &pieces); |
252 base::SPLIT_WANT_NONEMPTY); | |
253 // In linux, the gl version string might be in the format of | 252 // In linux, the gl version string might be in the format of |
254 // GLVersion DriverVendor DriverVersion | 253 // GLVersion DriverVendor DriverVersion |
255 if (pieces.size() < 3) | 254 if (pieces.size() < 3) |
256 return kCollectInfoNonFatalFailure; | 255 return kCollectInfoNonFatalFailure; |
257 | 256 |
258 std::string driver_version = pieces[2]; | 257 std::string driver_version = pieces[2]; |
259 size_t pos = driver_version.find_first_not_of("0123456789."); | 258 size_t pos = driver_version.find_first_not_of("0123456789."); |
260 if (pos == 0) | 259 if (pos == 0) |
261 return kCollectInfoNonFatalFailure; | 260 return kCollectInfoNonFatalFailure; |
262 if (pos != std::string::npos) | 261 if (pos != std::string::npos) |
263 driver_version = driver_version.substr(0, pos); | 262 driver_version = driver_version.substr(0, pos); |
264 | 263 |
265 gpu_info->driver_vendor = pieces[1]; | 264 gpu_info->driver_vendor = pieces[1]; |
266 gpu_info->driver_version = driver_version; | 265 gpu_info->driver_version = driver_version; |
267 return kCollectInfoSuccess; | 266 return kCollectInfoSuccess; |
268 } | 267 } |
269 | 268 |
270 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 269 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
271 const GPUInfo& context_gpu_info) { | 270 const GPUInfo& context_gpu_info) { |
272 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
273 } | 272 } |
274 | 273 |
275 } // namespace gpu | 274 } // namespace gpu |
OLD | NEW |