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

Unified Diff: mojo/edk/embedder/platform_channel_pair_posix.cc

Issue 2039713004: [mojo-edk] Make the Mojo EDK compile under NaCl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build. Created 4 years, 6 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: mojo/edk/embedder/platform_channel_pair_posix.cc
diff --git a/mojo/edk/embedder/platform_channel_pair_posix.cc b/mojo/edk/embedder/platform_channel_pair_posix.cc
index 9c3883922fdb004d3ba0a6f11628f71835818953..071be90f69b2d6c5a60aedba78c8dc0f3dcd5761 100644
--- a/mojo/edk/embedder/platform_channel_pair_posix.cc
+++ b/mojo/edk/embedder/platform_channel_pair_posix.cc
@@ -7,7 +7,9 @@
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
+#if !defined(OS_NACL) || defined(OS_NACL_NONSFI)
Ken Rockot(use gerrit already) 2016/06/06 02:58:33 nit: The style guide doesn't make a clear statemen
Anand Mistry (off Chromium) 2016/06/06 03:47:02 Done.
#include <sys/socket.h>
+#endif
#include <sys/types.h>
#include <unistd.h>
@@ -21,6 +23,10 @@
#include "build/build_config.h"
#include "mojo/edk/embedder/platform_handle.h"
+#if defined(OS_NACL)
+#include "native_client/src/public/imc_syscalls.h"
+#endif
+
#if !defined(SO_PEEK_OFF)
#define SO_PEEK_OFF 42
#endif
@@ -47,6 +53,9 @@ PlatformChannelPair::PlatformChannelPair(bool client_is_blocking) {
int fds[2];
// TODO(vtl): Maybe fail gracefully if |socketpair()| fails.
+#if defined(OS_NACL) && !defined(OS_NACL_NONSFI)
+ PCHECK(imc_socketpair(fds) == 0);
+#else
PCHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0);
// Set the ends to nonblocking.
@@ -64,6 +73,7 @@ PlatformChannelPair::PlatformChannelPair(bool client_is_blocking) {
PCHECK(setsockopt(fds[1], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe,
sizeof(no_sigpipe)) == 0);
#endif // defined(OS_MACOSX)
+#endif // defined(OS_NACL) && !defined(OS_NACL_NONSFI)
server_handle_.reset(PlatformHandle(fds[0]));
DCHECK(server_handle_.is_valid());

Powered by Google App Engine
This is Rietveld 408576698