summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorDaniel Erat <derat@google.com>2015-08-17 20:43:00 -0600
committerDaniel Erat <derat@google.com>2015-08-19 22:11:54 +0000
commitf0d9a7aa9bcf9e047928bf55d2174eebd1a14aa6 (patch)
treec55a1998758ab0374101acc0f464e4e02c0b134d /base
parent3ca9d0096f5618f5bbad8b1363a069d13fc3026e (diff)
downloadlibchrome-f0d9a7aa9bcf9e047928bf55d2174eebd1a14aa6.tar.gz
Enable logging and use __ANDROID__ instead of __BRILLO__.
Drop the __BRILLO__ #define, instead using the existing __ANDROID__ define set by the toolchain and setting a new __ANDROID_HOST__ define when building for the host. Also use Android logging when __ANDROID__ is defined. Bug: 23358460 Change-Id: I0d86eac8af381b002a3d46d8a95434c7e24518bd
Diffstat (limited to 'base')
-rw-r--r--base/files/file_util_posix.cc2
-rw-r--r--base/logging.cc8
-rw-r--r--base/message_loop/message_pump_libevent.cc2
3 files changed, 8 insertions, 4 deletions
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc
index 3def74e866..48c969d0e4 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -454,7 +454,7 @@ bool GetTempDir(FilePath* path) {
} else {
#if defined(OS_ANDROID)
return PathService::Get(base::DIR_CACHE, path);
-#elif (defined(__BRILLO__) && !defined(HOST))
+#elif defined(__ANDROID__)
*path = FilePath("/data/local/tmp");
#else
*path = FilePath("/tmp");
diff --git a/base/logging.cc b/base/logging.cc
index 71528ad3f4..594c222450 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -62,7 +62,7 @@ typedef pthread_mutex_t* MutexHandle;
#include "base/posix/safe_strerror.h"
#endif
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) || defined(__ANDROID__)
#include <android/log.h>
#endif
@@ -559,7 +559,7 @@ LogMessage::~LogMessage() {
if ((g_logging_destination & LOG_TO_SYSTEM_DEBUG_LOG) != 0) {
#if defined(OS_WIN)
OutputDebugStringA(str_newline.c_str());
-#elif defined(OS_ANDROID)
+#elif defined(OS_ANDROID) || defined(__ANDROID__)
android_LogPriority priority =
(severity_ < 0) ? ANDROID_LOG_VERBOSE : ANDROID_LOG_UNKNOWN;
switch (severity_) {
@@ -576,7 +576,11 @@ LogMessage::~LogMessage() {
priority = ANDROID_LOG_FATAL;
break;
}
+#if defined(OS_ANDROID)
__android_log_write(priority, "chromium", str_newline.c_str());
+#else
+ __android_log_write(priority, NULL, str_newline.c_str());
+#endif // defined(OS_ANDROID)
#endif
ignore_result(fwrite(str_newline.data(), str_newline.size(), 1, stderr));
fflush(stderr);
diff --git a/base/message_loop/message_pump_libevent.cc b/base/message_loop/message_pump_libevent.cc
index 66296e3999..e022c8c989 100644
--- a/base/message_loop/message_pump_libevent.cc
+++ b/base/message_loop/message_pump_libevent.cc
@@ -17,7 +17,7 @@
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
-#if defined(__BRILLO__)
+#if defined(__ANDROID__) || defined(__ANDROID_HOST__)
#include <event2/event.h>
#include <event2/event_compat.h>
#include <event2/event_struct.h>