Support use_glib==0 on Linux in base

This makes base build on Linux when use_glib is set to 0. The only glib
bits we are currently using in that configuration are g_get_home_dir()
and g_try_malloc().

Use of g_get_home_dir() is not essential. Without glib, we can just rely
on the $HOME environment variable always.

Use of g_try_malloc() is just a way to cause a large memory allocation
from a shared library. We can achieve the same effect using asprintf().

BUG=318315, 318413, 170408

Review URL: https://codereview.chromium.org/69953025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236162 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 6ec70cc7ef252a95464f34ede4fcd86ff34f1bfd
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index a2dd19b..134935c 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -24,7 +24,7 @@
 #if defined(OS_MACOSX)
 #include <AvailabilityMacros.h>
 #include "base/mac/foundation_util.h"
-#elif !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
+#elif !defined(OS_CHROMEOS) && defined(USE_GLIB)
 #include <glib.h>  // for g_get_home_dir()
 #endif
 
@@ -778,7 +778,7 @@
 
 #if defined(OS_ANDROID)
   DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented.";
-#elif !defined(OS_CHROMEOS)
+#elif defined(USE_GLIB) && !defined(OS_CHROMEOS)
   // g_get_home_dir calls getpwent, which can fall through to LDAP calls.
   base::ThreadRestrictions::AssertIOAllowed();