Skip to content

Commit

Permalink
Bring up IPC in NaCl.
Browse files Browse the repository at this point in the history
This patch gets a bunch of the IPC and Base libraries compiling (but not
linking) in NaCl.  There's obviously a bunch more work to do, but this patch is
a starting point.

Original patch by Eric Seidel.

Review URL: http://codereview.chromium.org/4812002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65920 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
abarth@chromium.org committed Nov 12, 2010
1 parent eda3c36 commit 19ea84c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/command_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ typedef HANDLE MutexHandle;
#include <mach/mach_time.h>
#include <mach-o/dyld.h>
#elif defined(OS_POSIX)
#if defined(OS_NACL)
#include <sys/nacl_syscalls.h>
#include <sys/time.h> // timespec doesn't seem to be in <time.h>
#else
#include <sys/syscall.h>
#endif
#include <time.h>
#endif

Expand Down Expand Up @@ -128,6 +133,8 @@ int32 CurrentThreadId() {
#elif defined(OS_FREEBSD)
// TODO(BSD): find a better thread ID
return reinterpret_cast<int64>(pthread_self());
#elif defined(OS_NACL)
return pthread_self();
#endif
}

Expand All @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion build/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 19ea84c

Please sign in to comment.