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

Unified Diff: third_party/tcmalloc/chromium/src/base/sysinfo.cc

Issue 14645016: Use system properties for heap profiler in Android instead of environment variables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed the comment 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
Index: third_party/tcmalloc/chromium/src/base/sysinfo.cc
diff --git a/third_party/tcmalloc/chromium/src/base/sysinfo.cc b/third_party/tcmalloc/chromium/src/base/sysinfo.cc
index ee8e6f58e7860af7ca7b34e22f733a52a406438b..82f3f56a90e71ef81f7ecc7b4e2c566025223a33 100644
--- a/third_party/tcmalloc/chromium/src/base/sysinfo.cc
+++ b/third_party/tcmalloc/chromium/src/base/sysinfo.cc
@@ -30,6 +30,8 @@
#include <config.h>
#if (defined(_WIN32) || defined(__MINGW32__)) && !defined(__CYGWIN__) && !defined(__CYGWIN32)
# define PLATFORM_WINDOWS 1
+#elif defined(__ANDROID__) || defined(ANDROID)
+# define PLATFORM_ANDROID 1
#endif
#include <ctype.h> // for isspace()
@@ -54,6 +56,8 @@
#include <process.h> // for getpid() (actually, _getpid())
#include <shlwapi.h> // for SHGetValueA()
#include <tlhelp32.h> // for Module32First()
+#elif defined(PLATFORM_ANDROID)
+#include <sys/system_properties.h>
#endif
#include "base/sysinfo.h"
#include "base/commandlineflags.h"
@@ -192,7 +196,12 @@ const char* GetenvBeforeMain(const char* name) {
// In Chromium this hack is intentionally disabled, because the path is not
// re-initialized upon fork.
bool GetUniquePathFromEnv(const char* env_name, char* path) {
+#if defined(PLATFORM_ANDROID)
+ char envval[PROP_VALUE_MAX];
+ __system_property_get(env_name, envval);
+#else
char* envval = getenv(env_name);
+#endif
if (envval == NULL || *envval == '\0')
return false;
if (envval[0] & 128) { // high bit is set
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/commandlineflags.h ('k') | third_party/tcmalloc/chromium/src/deep-heap-profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698