summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhidehiko <hidehiko@chromium.org>2014-10-28 04:57:21 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-28 11:57:41 +0000
commitf7295f2e7b0c17a7784f23e06b924ab966fea3a8 (patch)
tree76c5f52938cf3ce9f7d3cfe5054f89dba671a24b
parent8dfbf87e5975b82a20147bd57df21adbb01ce0fb (diff)
downloadchromium_src-f7295f2e7b0c17a7784f23e06b924ab966fea3a8.zip
chromium_src-f7295f2e7b0c17a7784f23e06b924ab966fea3a8.tar.gz
chromium_src-f7295f2e7b0c17a7784f23e06b924ab966fea3a8.tar.bz2
Introduce OS_NACL_SFI and OS_NACL_NONSFI macros.
PNaCl toolchain starts to support "Non-SFI build binary" mode. Some sources are built both for SFI binary and for Non-SFI binary, but, in some cases, there are small diffs which need to be guarded by #ifdef. In "Non-SFI build binary" mode, __native_client_nonsfi__ is defined. This CL introduce OS_NACL_SFI and OS_NACL_NONSFI which can be used among the chrome code, to slightly simplify the #ifdef conditions. This CL is the follow up of crrev.com/659243002 BUG=358465 TEST=Ran trybot. Review URL: https://codereview.chromium.org/664373003 Cr-Commit-Position: refs/heads/master@{#301603}
-rw-r--r--PRESUBMIT.py2
-rw-r--r--build/build_config.h11
-rw-r--r--ipc/ipc_channel.h5
-rw-r--r--ipc/ipc_channel_proxy.cc3
-rw-r--r--ipc/ipc_channel_proxy.h3
5 files changed, 16 insertions, 8 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 8ec7f53..2c40565 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -265,6 +265,8 @@ _VALID_OS_MACROS = (
'OS_LINUX',
'OS_MACOSX',
'OS_NACL',
+ 'OS_NACL_NONSFI',
+ 'OS_NACL_SFI',
'OS_OPENBSD',
'OS_POSIX',
'OS_QNX',
diff --git a/build/build_config.h b/build/build_config.h
index 5534846..b07660d 100644
--- a/build/build_config.h
+++ b/build/build_config.h
@@ -4,7 +4,8 @@
// This file adds defines about the platform we're currently building on.
// Operating System:
-// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) / OS_NACL
+// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) /
+// OS_NACL (NACL_SFI or NACL_NONSFI) / OS_NACL_SFI / OS_NACL_NONSFI
// Compiler:
// COMPILER_MSVC / COMPILER_GCC
// Processor:
@@ -18,6 +19,14 @@
#if defined(__native_client__)
// __native_client__ must be first, so that other OS_ defines are not set.
#define OS_NACL 1
+// OS_NACL comes in two sandboxing technology flavors, SFI or Non-SFI.
+// PNaCl toolchain defines __native_client_nonsfi__ macro in Non-SFI build
+// mode, while it does not in SFI build mode.
+#if defined(__native_client_nonsfi__)
+#define OS_NACL_NONSFI
+#else
+#define OS_NACL_SFI
+#endif
#elif defined(ANDROID)
#define OS_ANDROID 1
#elif defined(__APPLE__)
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h
index 3ed5e6a..f077def 100644
--- a/ipc/ipc_channel.h
+++ b/ipc/ipc_channel.h
@@ -182,8 +182,7 @@ class IPC_EXPORT Channel : public Sender {
// NaCl in Non-SFI mode runs on Linux directly, and the following functions
// compiled on Linux are also needed. Please see also comments in
// components/nacl_nonsfi.gyp for more details.
-#if defined(OS_POSIX) && \
- (!defined(OS_NACL) || defined(__native_client_nonsfi__))
+#if defined(OS_POSIX) && !defined(OS_NACL_SFI)
// On POSIX an IPC::Channel wraps a socketpair(), this method returns the
// FD # for the client end of the socket.
// This method may only be called on the server side of a channel.
@@ -200,7 +199,7 @@ class IPC_EXPORT Channel : public Sender {
// ID. Even if true, the server may have already accepted a connection.
static bool IsNamedServerInitialized(const std::string& channel_id);
-#if !defined(OS_NACL) || defined(__native_client_nonsfi__)
+#if !defined(OS_NACL_SFI)
// Generates a channel ID that's non-predictable and unique.
static std::string GenerateUniqueRandomChannelID();
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index 07f9552..64fab8f 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -434,8 +434,7 @@ void ChannelProxy::ClearIPCTaskRunner() {
context()->ClearIPCTaskRunner();
}
-#if defined(OS_POSIX) && \
- (!defined(OS_NACL) || defined(__native_client_nonsfi__))
+#if defined(OS_POSIX) && !defined(OS_NACL_SFI)
// See the TODO regarding lazy initialization of the channel in
// ChannelProxy::Init().
int ChannelProxy::GetClientFileDescriptor() {
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h
index e2ad4a9..dda5fa5 100644
--- a/ipc/ipc_channel_proxy.h
+++ b/ipc/ipc_channel_proxy.h
@@ -119,8 +119,7 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe {
// Returns base::kNullProcessId if the peer is not connected yet.
base::ProcessId GetPeerPID() const { return context_->peer_pid_; }
-#if defined(OS_POSIX) && \
- (!defined(OS_NACL) || defined(__native_client_nonsfi__))
+#if defined(OS_POSIX) && !defined(OS_NACL_SFI)
// Calls through to the underlying channel's methods.
int GetClientFileDescriptor();
base::ScopedFD TakeClientFileDescriptor();