diff options
author | nileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-18 01:49:22 +0000 |
---|---|---|
committer | nileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-18 01:49:22 +0000 |
commit | 84a1ab5ab074ca54f092a9affe8aa76bf2d0d411 (patch) | |
tree | 53b598e482acb59c4e02f8ce3b43d23ad1f1d990 /base/linux_util.cc | |
parent | e5cb599e1fd51dc7b764a8b901e90eff20fdc252 (diff) | |
download | chromium_src-84a1ab5ab074ca54f092a9affe8aa76bf2d0d411.zip chromium_src-84a1ab5ab074ca54f092a9affe8aa76bf2d0d411.tar.gz chromium_src-84a1ab5ab074ca54f092a9affe8aa76bf2d0d411.tar.bz2 |
Include linux_util for android.
Android uses linux breakpad (USE_LINUX_BREAKPAD is set) and hence needs
base::GetLinuxDistro
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/10785008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/linux_util.cc')
-rw-r--r-- | base/linux_util.cc | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/base/linux_util.cc b/base/linux_util.cc index 44ce12f..fa20093 100644 --- a/base/linux_util.cc +++ b/base/linux_util.cc @@ -7,7 +7,6 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> -#include <glib.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> @@ -142,42 +141,40 @@ char g_linux_distro[kDistroSize] = "CrOS Aura"; #elif defined(OS_CHROMEOS) "CrOS"; +#elif defined(OS_ANDROID) + "Android"; #else // if defined(OS_LINUX) "Unknown"; #endif std::string GetLinuxDistro() { -#if defined(OS_CHROMEOS) +#if defined(OS_CHROMEOS) || defined(OS_ANDROID) return g_linux_distro; #elif defined(OS_LINUX) LinuxDistroHelper* distro_state_singleton = LinuxDistroHelper::GetInstance(); LinuxDistroState state = distro_state_singleton->State(); - if (STATE_DID_NOT_CHECK == state) { - // 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. - std::vector<std::string> argv; - argv.push_back("lsb_release"); - argv.push_back("-d"); - std::string output; - base::GetAppOutput(CommandLine(argv), &output); - if (output.length() > 0) { - // lsb_release -d should return: Description:<tab>Distro Info - const char field[] = "Description:\t"; - if (output.compare(0, strlen(field), field) == 0) { - SetLinuxDistro(output.substr(strlen(field))); - } - } - distro_state_singleton->CheckFinished(); - return g_linux_distro; - } else if (STATE_CHECK_STARTED == state) { - // If the distro check above is in progress in some other thread, we're - // not going to wait for the results. - return "Unknown"; - } else { - // In STATE_CHECK_FINISHED, no more writing to |linux_distro|. + if (STATE_CHECK_FINISHED == state) return g_linux_distro; + if (STATE_CHECK_STARTED == state) + return "Unknown"; // Don't wait for other thread to finish. + DCHECK_EQ(state, STATE_DID_NOT_CHECK); + // 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. + std::vector<std::string> argv; + argv.push_back("lsb_release"); + argv.push_back("-d"); + std::string output; + base::GetAppOutput(CommandLine(argv), &output); + if (output.length() > 0) { + // lsb_release -d should return: Description:<tab>Distro Info + const char field[] = "Description:\t"; + if (output.compare(0, strlen(field), field) == 0) { + SetLinuxDistro(output.substr(strlen(field))); + } } + distro_state_singleton->CheckFinished(); + return g_linux_distro; #else NOTIMPLEMENTED(); return "Unknown"; |