Index: ppapi/proxy/proxy_channel.cc |
diff --git a/ppapi/proxy/proxy_channel.cc b/ppapi/proxy/proxy_channel.cc |
index d1c47a5fbec8596471323b6be2802ef0d1eb1679..81eb9a45553ca6629a8e2601d0cb3701eff9ea30 100644 |
--- a/ppapi/proxy/proxy_channel.cc |
+++ b/ppapi/proxy/proxy_channel.cc |
@@ -4,6 +4,8 @@ |
#include "ppapi/proxy/proxy_channel.h" |
+#include "base/logging.h" |
+#include "base/process_util.h" |
#include "ipc/ipc_platform_file.h" |
#include "ipc/ipc_test_sink.h" |
@@ -16,6 +18,7 @@ namespace proxy { |
ProxyChannel::ProxyChannel() |
: delegate_(NULL), |
+ peer_pid_(base::kNullProcessId), |
test_sink_(NULL) { |
} |
@@ -24,9 +27,11 @@ ProxyChannel::~ProxyChannel() { |
} |
bool ProxyChannel::InitWithChannel(Delegate* delegate, |
+ base::ProcessId peer_pid, |
const IPC::ChannelHandle& channel_handle, |
bool is_client) { |
delegate_ = delegate; |
+ peer_pid_ = peer_pid; |
IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT |
: IPC::Channel::MODE_SERVER; |
channel_.reset(new IPC::SyncChannel(channel_handle, mode, this, |
@@ -38,6 +43,9 @@ bool ProxyChannel::InitWithChannel(Delegate* delegate, |
void ProxyChannel::InitWithTestSink(IPC::TestSink* test_sink) { |
DCHECK(!test_sink_); |
test_sink_ = test_sink; |
+#if !defined(OS_NACL) |
+ peer_pid_ = base::GetCurrentProcId(); |
+#endif |
} |
void ProxyChannel::OnChannelError() { |
@@ -65,7 +73,8 @@ IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote( |
} |
return IPC::InvalidPlatformFileForTransit(); |
} |
- return delegate_->ShareHandleWithRemote(handle, *channel_, |
+ DCHECK(peer_pid_ != base::kNullProcessId); |
+ return delegate_->ShareHandleWithRemote(handle, peer_pid_, |
should_close_source); |
} |