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

Unified Diff: base/linux_util.cc

Issue 303018: Simplify GetLinuxDistro() for Chrome OS. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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: base/linux_util.cc
===================================================================
--- base/linux_util.cc (revision 29623)
+++ base/linux_util.cc (working copy)
@@ -46,6 +46,8 @@
}
};
+// Not needed for OS_CHROMEOS.
+#if defined(OS_LINUX)
enum LinuxDistroState {
STATE_DID_NOT_CHECK = 0,
STATE_CHECK_STARTED = 1,
@@ -88,6 +90,7 @@
Lock lock_;
LinuxDistroState state_;
};
+#endif // if defined(OS_LINUX)
} // anonymous namespace
@@ -115,15 +118,20 @@
// We use this static string to hold the Linux distro info. If we
// crash, the crash handler code will send this in the crash dump.
-std::string linux_distro = "Unknown";
+std::string linux_distro =
+#if defined(OS_CHROMEOS)
+ "CrOS";
+#else // if defined(OS_LINUX)
+ "Unknown";
+#endif
std::string GetLinuxDistro() {
+#if defined(OS_CHROMEOS)
+ return linux_distro;
+#else // if defined(OS_LINUX)
LinuxDistroHelper* distro_state_singleton = LinuxDistroHelper::Get();
LinuxDistroState state = distro_state_singleton->State();
if (STATE_DID_NOT_CHECK == state) {
-#if defined(OS_CHROMEOS)
- linux_distro = "CrOS";
-#else // if defined(OS_LINUX)
// We do this check only once per process. If it fails, there's
// little reason to believe it will work if we attempt to run
// lsb_release again.
@@ -138,7 +146,6 @@
if (output.compare(0, field.length(), field) == 0)
linux_distro = output.substr(field.length());
}
-#endif
distro_state_singleton->CheckFinished();
return linux_distro;
} else if (STATE_CHECK_STARTED == state) {
@@ -149,6 +156,7 @@
// In STATE_CHECK_FINISHED, no more writing to |linux_distro|.
return linux_distro;
}
+#endif
}
// static
« 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