diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 19:04:17 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 19:04:17 +0000 |
commit | 78f6f515693bd355555eb0f4eb114124ccaec762 (patch) | |
tree | 379c8c3765c05b543a1f023d20da07f369654977 /base/linux_util.cc | |
parent | d716545b1110698777186418a0411c617730f0f7 (diff) | |
download | chromium_src-78f6f515693bd355555eb0f4eb114124ccaec762.zip chromium_src-78f6f515693bd355555eb0f4eb114124ccaec762.tar.gz chromium_src-78f6f515693bd355555eb0f4eb114124ccaec762.tar.bz2 |
Simplify GetLinuxDistro() for Chrome OS.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/303018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/linux_util.cc')
-rw-r--r-- | base/linux_util.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/base/linux_util.cc b/base/linux_util.cc index fa40f53..c3198f6 100644 --- a/base/linux_util.cc +++ b/base/linux_util.cc @@ -46,6 +46,8 @@ class EnvironmentVariableGetterImpl } }; +// Not needed for OS_CHROMEOS. +#if defined(OS_LINUX) enum LinuxDistroState { STATE_DID_NOT_CHECK = 0, STATE_CHECK_STARTED = 1, @@ -88,6 +90,7 @@ class LinuxDistroHelper { Lock lock_; LinuxDistroState state_; }; +#endif // if defined(OS_LINUX) } // anonymous namespace @@ -115,15 +118,20 @@ uint8_t* BGRAToRGBA(const uint8_t* pixels, int width, int height, int stride) { // 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 @@ std::string GetLinuxDistro() { 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 @@ std::string GetLinuxDistro() { // In STATE_CHECK_FINISHED, no more writing to |linux_distro|. return linux_distro; } +#endif } // static |