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

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: Address comments 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
« no previous file with comments | « mojo/edk/embedder/embedder.cc ('k') | mojo/edk/embedder/platform_channel_utils_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4dcf48bd71bfe417588e9ba2d0dfd7b1bb67d65f 100644
--- a/mojo/edk/embedder/platform_channel_pair_posix.cc
+++ b/mojo/edk/embedder/platform_channel_pair_posix.cc
@@ -7,7 +7,6 @@
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
-#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
@@ -21,6 +20,12 @@
#include "build/build_config.h"
#include "mojo/edk/embedder/platform_handle.h"
+#if !defined(OS_NACL) || defined(OS_NACL_NONSFI)
+#include <sys/socket.h>
+#else
+#include "native_client/src/public/imc_syscalls.h"
+#endif
+
#if !defined(SO_PEEK_OFF)
#define SO_PEEK_OFF 42
#endif
@@ -47,6 +52,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 +72,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());
« no previous file with comments | « mojo/edk/embedder/embedder.cc ('k') | mojo/edk/embedder/platform_channel_utils_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698