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

Unified Diff: chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc

Issue 13888010: Improve the code added in r194423 by using the Version class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: int Created 7 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
===================================================================
--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc (revision 194467)
+++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc (working copy)
@@ -5,7 +5,6 @@
#include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
#include <string>
-#include <vector>
#include "base/bind.h"
#include "base/command_line.h"
@@ -24,8 +23,7 @@
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
#include <gnu/libc-version.h>
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
+#include "base/version.h"
#endif
namespace {
@@ -69,23 +67,18 @@
void RecordLinuxGlibcVersion() {
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- std::string glibc_version_string(gnu_get_libc_version());
- std::vector<std::string> split_glibc_version;
- base::SplitString(glibc_version_string, '.', &split_glibc_version);
+ Version version(gnu_get_libc_version());
UMALinuxGlibcVersion glibc_version_result = UMA_LINUX_GLIBC_NOT_PARSEABLE;
- unsigned glibc_major_version = 0;
- unsigned glibc_minor_version = 0;
- if (split_glibc_version.size() == 2 &&
- base::StringToUint(split_glibc_version[0], &glibc_major_version) &&
- base::StringToUint(split_glibc_version[1], &glibc_minor_version)) {
+ if (version.IsValid() && version.components().size() == 2) {
glibc_version_result = UMA_LINUX_GLIBC_UNKNOWN;
+ int glibc_major_version = version.components()[0];
+ int glibc_minor_version = version.components()[1];
if (glibc_major_version == 2) {
// A constant to translate glibc 2.x minor versions to their
// equivalent UMALinuxGlibcVersion values.
- const unsigned kGlibcMinorVersionTranslationOffset =
- 11 - UMA_LINUX_GLIBC_2_11;
- unsigned translated_glibc_minor_version =
+ const int kGlibcMinorVersionTranslationOffset = 11 - UMA_LINUX_GLIBC_2_11;
+ int translated_glibc_minor_version =
glibc_minor_version - kGlibcMinorVersionTranslationOffset;
if (translated_glibc_minor_version >= UMA_LINUX_GLIBC_2_11 &&
translated_glibc_minor_version <= UMA_LINUX_GLIBC_2_19) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698