diff options
-rw-r--r-- | base/tracked_objects.cc | 4 | ||||
-rw-r--r-- | ipc/ipc_channel.cc | 8 | ||||
-rw-r--r-- | ipc/ipc_channel.h | 2 | ||||
-rw-r--r-- | ipc/ipc_channel_nacl.cc | 44 | ||||
-rw-r--r-- | ipc/ipc_channel_nacl.h | 8 | ||||
-rw-r--r-- | ipc/ipc_channel_proxy.cc | 2 | ||||
-rw-r--r-- | ppapi/ppapi_proxy_untrusted.gyp | 5 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.cc | 4 |
8 files changed, 61 insertions, 16 deletions
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index 38b9320..fe3f712 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -868,7 +868,11 @@ ParentChildPairSnapshot::~ParentChildPairSnapshot() { // ProcessDataSnapshot ProcessDataSnapshot::ProcessDataSnapshot() +#if !defined(OS_NACL) : process_id(base::GetCurrentProcId()) { +#else + : process_id(0) { +#endif } ProcessDataSnapshot::~ProcessDataSnapshot() { diff --git a/ipc/ipc_channel.cc b/ipc/ipc_channel.cc index 5973f72..d81d73b 100644 --- a/ipc/ipc_channel.cc +++ b/ipc/ipc_channel.cc @@ -30,8 +30,14 @@ std::string Channel::GenerateUniqueRandomChannelID() { // component. The strong random component prevents other processes from // hijacking or squatting on predictable channel names. + int process_id; +#if !defined(OS_NACL) + process_id = base::GetCurrentProcId(); +#else + process_id = 0; +#endif return base::StringPrintf("%d.%u.%d", - base::GetCurrentProcId(), + process_id, g_last_id.GetNext(), base::RandInt(0, std::numeric_limits<int32>::max())); } diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index 5557306..2aeca1f 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h @@ -160,7 +160,7 @@ class IPC_EXPORT Channel : public Message::Sender { // deleted once the contents of the Message have been sent. virtual bool Send(Message* message) OVERRIDE; -#if defined(OS_POSIX) && !defined(OS_NACL) +#if defined(OS_POSIX) // 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. diff --git a/ipc/ipc_channel_nacl.cc b/ipc/ipc_channel_nacl.cc index 0d929db..683353e 100644 --- a/ipc/ipc_channel_nacl.cc +++ b/ipc/ipc_channel_nacl.cc @@ -12,62 +12,80 @@ namespace IPC { -ChannelImpl::ChannelImpl(const IPC::ChannelHandle& channel_handle, +Channel::ChannelImpl::ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode, Listener* listener) : ChannelReader(listener) { } -ChannelImpl::~ChannelImpl() { +Channel::ChannelImpl::~ChannelImpl() { Close(); } -bool ChannelImpl::Connect() { +bool Channel::ChannelImpl::Connect() { NOTIMPLEMENTED(); return false; } -void ChannelImpl::Close() { +void Channel::ChannelImpl::Close() { NOTIMPLEMENTED(); } -bool ChannelImpl::Send(Message* message) { +bool Channel::ChannelImpl::Send(Message* message) { NOTIMPLEMENTED(); } -int ChannelImpl::GetClientFileDescriptor() const { +int Channel::ChannelImpl::GetClientFileDescriptor() const { NOTIMPLEMENTED(); return -1; } -int ChannelImpl::TakeClientFileDescriptor() { +int Channel::ChannelImpl::TakeClientFileDescriptor() { NOTIMPLEMENTED(); return -1; } -bool ChannelImpl::AcceptsConnections() const { +bool Channel::ChannelImpl::AcceptsConnections() const { NOTIMPLEMENTED(); return false; } -bool ChannelImpl::HasAcceptedConnection() const { +bool Channel::ChannelImpl::HasAcceptedConnection() const { NOTIMPLEMENTED(); return false; } -bool ChannelImpl::GetClientEuid(uid_t* client_euid) const { +bool Channel::ChannelImpl::GetClientEuid(uid_t* client_euid) const { NOTIMPLEMENTED(); return false; } -void ChannelImpl::ResetToAcceptingConnectionState() { +void Channel::ChannelImpl::ResetToAcceptingConnectionState() { NOTIMPLEMENTED(); } +Channel::ChannelImpl::ReadState + Channel::ChannelImpl::ReadData(char* buffer, + int buffer_len, + int* bytes_read) { + return Channel::ChannelImpl::ReadState(); +} + +bool Channel::ChannelImpl::WillDispatchInputMessage(Message* msg) { + return false; +} + +bool Channel::ChannelImpl::DidEmptyInputBuffers() { + return false; +} + +void Channel::ChannelImpl::HandleHelloMessage(const Message& msg) { +} + // static bool Channel::ChannelImpl::IsNamedServerInitialized( const std::string& channel_id) { - return file_util::PathExists(FilePath(channel_id)); + return false; //file_util::PathExists(FilePath(channel_id)); } //------------------------------------------------------------------------------ @@ -123,6 +141,8 @@ void Channel::ResetToAcceptingConnectionState() { channel_impl_->ResetToAcceptingConnectionState(); } +base::ProcessId Channel::peer_pid() const { return 0; } + // static bool Channel::IsNamedServerInitialized(const std::string& channel_id) { return ChannelImpl::IsNamedServerInitialized(channel_id); diff --git a/ipc/ipc_channel_nacl.h b/ipc/ipc_channel_nacl.h index cffa34a..2747263 100644 --- a/ipc/ipc_channel_nacl.h +++ b/ipc/ipc_channel_nacl.h @@ -7,6 +7,7 @@ #pragma once #include "ipc/ipc_channel.h" +#include "ipc/ipc_channel_reader.h" namespace IPC { @@ -33,6 +34,13 @@ class Channel::ChannelImpl : public internal::ChannelReader { void ResetToAcceptingConnectionState(); static bool IsNamedServerInitialized(const std::string& channel_id); + virtual ReadState ReadData(char* buffer, + int buffer_len, + int* bytes_read) OVERRIDE; + virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; + virtual bool DidEmptyInputBuffers() OVERRIDE; + virtual void HandleHelloMessage(const Message& msg) OVERRIDE; + private: DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); }; diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index ce0d595..7eed1bd 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -387,7 +387,7 @@ void ChannelProxy::ClearIPCMessageLoop() { context()->ClearIPCMessageLoop(); } -#if defined(OS_POSIX) && !defined(OS_NACL) +#if defined(OS_POSIX) // See the TODO regarding lazy initialization of the channel in // ChannelProxy::Init(). int ChannelProxy::GetClientFileDescriptor() { diff --git a/ppapi/ppapi_proxy_untrusted.gyp b/ppapi/ppapi_proxy_untrusted.gyp index c640a23..396b97c 100644 --- a/ppapi/ppapi_proxy_untrusted.gyp +++ b/ppapi/ppapi_proxy_untrusted.gyp @@ -202,11 +202,14 @@ ], 'sources': [ '../ipc/file_descriptor_set_posix.cc', -# '../ipc/ipc_channel_posix.cc', + '../ipc/ipc_channel.cc', + '../ipc/ipc_channel_nacl.cc', '../ipc/ipc_channel_proxy.cc', + '../ipc/ipc_channel_reader.cc', '../ipc/ipc_logging.cc', '../ipc/ipc_message.cc', '../ipc/ipc_message_utils.cc', + '../ipc/ipc_platform_file.cc', '../ipc/ipc_sync_channel.cc', '../ipc/ipc_sync_message.cc', '../ipc/ipc_sync_message_filter.cc', diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 88e6521..77afa30 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -413,6 +413,7 @@ PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, PP_MouseCursor_Type type, PP_Resource image, const PP_Point* hot_spot) { +#if !defined(OS_NACL) // Some of these parameters are important for security. This check is in the // plugin process just for the convenience of the caller (since we don't // bother returning errors from the other process with a sync message). The @@ -433,6 +434,9 @@ PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, API_ID_PPB_INSTANCE, instance, static_cast<int32_t>(type), image_host_resource, hot_spot ? *hot_spot : PP_MakePoint(0, 0))); return PP_TRUE; +#else // defined(OS_NACL) + return PP_FALSE; +#endif } int32_t PPB_Instance_Proxy::LockMouse(PP_Instance instance, |