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

Unified Diff: base/logging.cc

Issue 2692273008: Hacky slashy (Closed)
Patch Set: wip Created 3 years, 10 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: base/logging.cc
diff --git a/base/logging.cc b/base/logging.cc
index cea6edae4a37cef2519ff32045c46c0a3c73e4d0..aaf5c0f9f1f443ea906c7d101dcd37b42e858fcd 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -46,6 +46,14 @@ typedef FILE* FileHandle;
typedef pthread_mutex_t* MutexHandle;
#endif
+#if defined(OS_FUCHSIA)
+#include <magenta/syscalls.h>
+#include <threads.h>
+#include <unistd.h>
+typedef FILE* FileHandle;
+typedef mtx_t MutexHandle;
+#endif
+
#include <algorithm>
#include <cstring>
#include <ctime>
@@ -67,7 +75,7 @@ typedef pthread_mutex_t* MutexHandle;
#include "base/synchronization/lock_impl.h"
#include "base/threading/platform_thread.h"
#include "base/vlog.h"
-#if defined(OS_POSIX)
+#if defined(OS_POSIX) || defined(OS_FUCHSIA)
#include "base/posix/safe_strerror.h"
#endif
@@ -131,7 +139,7 @@ LogMessageHandlerFunction log_message_handler = nullptr;
int32_t CurrentProcessId() {
#if defined(OS_WIN)
return GetCurrentProcessId();
-#elif defined(OS_POSIX)
+#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
return getpid();
#endif
}
@@ -153,6 +161,8 @@ uint64_t TickCount() {
static_cast<int64_t>(ts.tv_nsec) / 1000;
return absolute_micro;
+#elif defined(OS_FUCHSIA)
+ return mx_time_get(MX_CLOCK_MONOTONIC) / 1000;
#endif
}
@@ -178,7 +188,7 @@ PathString GetDefaultLogFile() {
log_name.erase(last_backslash + 1);
log_name += L"debug.log";
return log_name;
-#elif defined(OS_POSIX)
+#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
// On other platforms we just use the current directory.
return PathString("debug.log");
#endif
@@ -830,7 +840,7 @@ typedef DWORD SystemErrorCode;
SystemErrorCode GetLastSystemErrorCode() {
#if defined(OS_WIN)
return ::GetLastError();
-#elif defined(OS_POSIX)
+#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
return errno;
#else
#error Not implemented
@@ -852,7 +862,7 @@ BASE_EXPORT std::string SystemErrorCodeToString(SystemErrorCode error_code) {
return base::StringPrintf("Error (0x%X) while retrieving error. (0x%X)",
GetLastError(), error_code);
}
-#elif defined(OS_POSIX)
+#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
BASE_EXPORT std::string SystemErrorCodeToString(SystemErrorCode error_code) {
return base::safe_strerror(error_code);
}

Powered by Google App Engine
This is Rietveld 408576698