Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: gpu/config/gpu_info_collector_linux.cc

Issue 2198243002: Revert of On Linux rework driver_version/vendor extraction from gl version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/config/gpu_driver_bug_list_json.cc ('k') | gpu/config/gpu_info_collector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 66ab3775f21c930a859b8d522e5154cf05a35e7c..050c33d246d391afb8edea0fbd0ed753fdd4c8ee 100644
--- a/gpu/config/gpu_info_collector_linux.cc
+++ b/gpu/config/gpu_info_collector_linux.cc
@@ -19,7 +19,6 @@
#include "base/strings/string_util.h"
#include "base/trace_event/trace_event.h"
#include "gpu/config/gpu_info_collector.h"
-#include "third_party/re2/src/re2/re2.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
@@ -248,6 +247,8 @@
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);
@@ -256,23 +257,14 @@
if (pieces.size() < 3)
return kCollectInfoNonFatalFailure;
- // Search from the end for the first piece that starts with major.minor or
- // major.minor.micro but assume the driver version cannot be in the first two
- // pieces.
- re2::RE2 pattern("([\\d]+\\.[\\d]+(\\.[\\d]+)?).*");
- std::string driver_version;
- auto it = pieces.rbegin();
- while (pieces.rend() - it > 2) {
- bool parsed = re2::RE2::FullMatch(*it, pattern, &driver_version);
- if (parsed)
- break;
- ++it;
- }
-
- if (driver_version.empty())
- return kCollectInfoNonFatalFailure;
-
- gpu_info->driver_vendor = *(++it);
+ std::string driver_version = pieces[2];
+ size_t pos = driver_version.find_first_not_of("0123456789.");
+ if (pos == 0)
+ return kCollectInfoNonFatalFailure;
+ if (pos != std::string::npos)
+ driver_version = driver_version.substr(0, pos);
+
+ gpu_info->driver_vendor = pieces[1];
gpu_info->driver_version = driver_version;
return kCollectInfoSuccess;
}
« no previous file with comments | « gpu/config/gpu_driver_bug_list_json.cc ('k') | gpu/config/gpu_info_collector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698