Index: gpu/config/gpu_info_collector_linux.cc |
diff --git a/gpu/config/gpu_info_collector_linux.cc b/gpu/config/gpu_info_collector_linux.cc |
index 050c33d246d391afb8edea0fbd0ed753fdd4c8ee..c16ee9cd8614905f48bfba62e9d52735ae4b7d87 100644 |
--- a/gpu/config/gpu_info_collector_linux.cc |
+++ b/gpu/config/gpu_info_collector_linux.cc |
@@ -247,8 +247,6 @@ CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { |
DCHECK(gpu_info); |
std::string gl_version = gpu_info->gl_version; |
- if (base::StartsWith(gl_version, "OpenGL ES", base::CompareCase::SENSITIVE)) |
- gl_version = gl_version.substr(10); |
std::vector<std::string> pieces = base::SplitString( |
gl_version, base::kWhitespaceASCII, base::KEEP_WHITESPACE, |
base::SPLIT_WANT_NONEMPTY); |
@@ -257,14 +255,23 @@ CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { |
if (pieces.size() < 3) |
return kCollectInfoNonFatalFailure; |
- std::string driver_version = pieces[2]; |
- size_t pos = driver_version.find_first_not_of("0123456789."); |
- if (pos == 0) |
+ // Search from the end for the first piece that contains at least one digit. |
Ken Russell (switch to Gerrit)
2016/07/21 23:54:54
Why not just use a regexp? Something which matches
Julien Isorce Samsung
2016/07/22 07:38:29
Done.
|
+ // But assume the driver version cannot be the first two pieces. |
+ std::string driver_version; |
+ auto it = pieces.rbegin(); |
+ while (it + 2 != pieces.rend()) { |
Ken Russell (switch to Gerrit)
2016/07/21 23:54:54
This looks risky. Please do something else which i
Julien Isorce Samsung
2016/07/22 07:38:29
Done.
|
+ size_t pos = it->find_first_not_of("0123456789."); |
+ if (pos != 0) { |
+ driver_version = it->substr(0, pos); |
+ break; |
+ } |
+ ++it; |
+ } |
+ |
+ if (driver_version.empty()) |
return kCollectInfoNonFatalFailure; |
- if (pos != std::string::npos) |
- driver_version = driver_version.substr(0, pos); |
- gpu_info->driver_vendor = pieces[1]; |
+ gpu_info->driver_vendor = *(++it); |
gpu_info->driver_version = driver_version; |
return kCollectInfoSuccess; |
} |