Chromium Code Reviews| Index: third_party/tcmalloc/chromium/src/base/logging.h |
| diff --git a/third_party/tcmalloc/chromium/src/base/logging.h b/third_party/tcmalloc/chromium/src/base/logging.h |
| index 5b5b5dbfd69566a0b6e9152a0d99725d07765d4e..f2c328a2afbcfc8b49c8479b70727b0cbbbb59b2 100644 |
| --- a/third_party/tcmalloc/chromium/src/base/logging.h |
| +++ b/third_party/tcmalloc/chromium/src/base/logging.h |
| @@ -56,6 +56,10 @@ |
| // do logging on a best-effort basis. |
| #if defined(_MSC_VER) |
| #define WRITE_TO_STDERR(buf, len) WriteToStderr(buf, len); // in port.cc |
| +#elif defined(__ANDROID__) || defined(ANDROID) |
| +#include <android/log.h> |
| +#define WRITE_TO_STDERR(buf, len) \ |
| + __android_log_write(ANDROID_LOG_ERROR, "gperftools", buf) |
| #elif defined(HAVE_SYS_SYSCALL_H) |
| #include <sys/syscall.h> |
| #define WRITE_TO_STDERR(buf, len) syscall(SYS_write, STDERR_FILENO, buf, len) |
| @@ -204,7 +208,26 @@ inline void LogPrintf(int severity, const char* pat, va_list ap) { |
| assert(strlen(buf)+1 < sizeof(buf)); |
| strcat(buf, "\n"); |
| } |
| +#if defined(__ANDROID__) || defined(ANDROID) |
| + android_LogPriority priority = ANDROID_LOG_UNKNOWN; |
| + switch (severity) { |
| + case INFO: |
|
willchan no longer on Chromium
2013/05/07 14:45:36
Indentation is off. Please follow the format in ht
Dai Mikurube (NOT FULLTIME)
2013/05/07 17:10:15
Done.
|
| + priority = ANDROID_LOG_INFO; |
| + break; |
| + case WARNING: |
| + priority = ANDROID_LOG_WARN; |
| + break; |
| + case ERROR: |
| + priority = ANDROID_LOG_ERROR; |
| + break; |
| + case FATAL: |
| + priority = ANDROID_LOG_FATAL; |
| + break; |
| + } |
| + __android_log_write(priority, "gperftools", buf); |
| +#else // defined(__ANDROID__) || defined(ANDROID) |
| WRITE_TO_STDERR(buf, strlen(buf)); |
| +#endif // defined(__ANDROID__) || defined(ANDROID) |
| if ((severity) == FATAL) { |
| // LOG(FATAL) indicates a big problem, so don't run atexit() calls |
| tcmalloc::Abort(); |