diff --git a/base/command_line.cc b/base/command_line.cc index 2e6021dc2ca863..3308e80d7501a6 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -224,7 +224,7 @@ void CommandLine::Init(int argc, const char* const* argv) { #endif } -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL) // static void CommandLine::SetProcTitle() { // Build a single string which consists of all the arguments separated diff --git a/base/logging.cc b/base/logging.cc index 2658519d89917b..74f9a87ffc97b5 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -19,7 +19,12 @@ typedef HANDLE MutexHandle; #include #include #elif defined(OS_POSIX) +#if defined(OS_NACL) +#include +#include // timespec doesn't seem to be in +#else #include +#endif #include #endif @@ -128,6 +133,8 @@ int32 CurrentThreadId() { #elif defined(OS_FREEBSD) // TODO(BSD): find a better thread ID return reinterpret_cast(pthread_self()); +#elif defined(OS_NACL) + return pthread_self(); #endif } @@ -136,6 +143,10 @@ uint64 TickCount() { return GetTickCount(); #elif defined(OS_MACOSX) return mach_absolute_time(); +#elif defined(OS_NACL) + // NaCl sadly does not have _POSIX_TIMERS enabled in sys/features.h + // So we have to use clock() for now. + return clock(); #elif defined(OS_POSIX) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/build/build_config.h b/build/build_config.h index e2d26cbad97b80..3218a05560fc4a 100644 --- a/build/build_config.h +++ b/build/build_config.h @@ -17,6 +17,8 @@ // A set of macros to use for platform detection. #if defined(__APPLE__) #define OS_MACOSX 1 +#elif defined(__native_client__) +#define OS_NACL 1 #elif defined(__linux__) #define OS_LINUX 1 // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined. @@ -60,7 +62,7 @@ // For access to standard POSIXish features, use OS_POSIX instead of a // more specific macro. #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \ - defined(OS_OPENBSD) || defined(OS_SOLARIS) + defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_NACL) #define OS_POSIX 1 // Use base::DataPack for name/value pairs. #define USE_BASE_DATA_PACK 1