diff options
Diffstat (limited to 'ipc')
-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 |
5 files changed, 49 insertions, 15 deletions
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() { |