summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/broker_dispatcher.cc5
-rw-r--r--ppapi/proxy/host_dispatcher.cc5
-rw-r--r--ppapi/proxy/plugin_dispatcher.cc5
-rw-r--r--ppapi/proxy/proxy_channel.cc17
-rw-r--r--ppapi/proxy/proxy_channel.h19
5 files changed, 26 insertions, 25 deletions
diff --git a/ppapi/proxy/broker_dispatcher.cc b/ppapi/proxy/broker_dispatcher.cc
index 7187852..6095679 100644
--- a/ppapi/proxy/broker_dispatcher.cc
+++ b/ppapi/proxy/broker_dispatcher.cc
@@ -24,8 +24,9 @@ bool BrokerDispatcher::InitBrokerWithChannel(
base::ProcessId peer_pid,
const IPC::ChannelHandle& channel_handle,
bool is_client) {
- return ProxyChannel::InitWithChannel(delegate, peer_pid, channel_handle,
- is_client);
+ InitWithChannel(delegate, peer_pid);
+ ConnectChannel(channel_handle, is_client);
+ return true;
}
bool BrokerDispatcher::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index cea7ab3..691f424 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -91,10 +91,9 @@ bool HostDispatcher::InitHostWithChannel(
const IPC::ChannelHandle& channel_handle,
bool is_client,
const ppapi::Preferences& preferences) {
- if (!Dispatcher::InitWithChannel(delegate, peer_pid, channel_handle,
- is_client))
- return false;
+ InitWithChannel(delegate, peer_pid);
AddIOThreadMessageFilter(sync_status_.get());
+ ConnectChannel(channel_handle, is_client);
Send(new PpapiMsg_SetPreferences(preferences));
return true;
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index 6cd0ab4..f99ec9e 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -161,9 +161,7 @@ bool PluginDispatcher::InitPluginWithChannel(
base::ProcessId peer_pid,
const IPC::ChannelHandle& channel_handle,
bool is_client) {
- if (!Dispatcher::InitWithChannel(delegate, peer_pid, channel_handle,
- is_client))
- return false;
+ InitWithChannel(delegate, peer_pid);
plugin_delegate_ = delegate;
plugin_dispatcher_id_ = plugin_delegate_->Register(this);
@@ -176,6 +174,7 @@ bool PluginDispatcher::InitPluginWithChannel(
new PluginMessageFilter(
delegate->GetGloballySeenInstanceIDSet(),
PluginGlobals::Get()->resource_reply_thread_registrar()));
+ ConnectChannel(channel_handle, is_client);
return true;
}
diff --git a/ppapi/proxy/proxy_channel.cc b/ppapi/proxy/proxy_channel.cc
index b7f8a82..1623401 100644
--- a/ppapi/proxy/proxy_channel.cc
+++ b/ppapi/proxy/proxy_channel.cc
@@ -25,18 +25,19 @@ ProxyChannel::~ProxyChannel() {
DVLOG(1) << "ProxyChannel::~ProxyChannel()";
}
-bool ProxyChannel::InitWithChannel(Delegate* delegate,
- base::ProcessId peer_pid,
- const IPC::ChannelHandle& channel_handle,
- bool is_client) {
+void ProxyChannel::InitWithChannel(Delegate* delegate,
+ base::ProcessId peer_pid) {
delegate_ = delegate;
peer_pid_ = peer_pid;
+ channel_.reset(new IPC::SyncChannel(this, delegate->GetIPCMessageLoop(),
+ delegate->GetShutdownEvent()));
+}
+
+void ProxyChannel::ConnectChannel(const IPC::ChannelHandle& channel_handle,
+ bool is_client) {
IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT
: IPC::Channel::MODE_SERVER;
- channel_.reset(new IPC::SyncChannel(channel_handle, mode, this,
- delegate->GetIPCMessageLoop(), true,
- delegate->GetShutdownEvent()));
- return true;
+ channel_->Init(channel_handle, mode, true);
}
void ProxyChannel::InitWithTestSink(IPC::TestSink* test_sink) {
diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h
index 6c9f1f6..64b8a77 100644
--- a/ppapi/proxy/proxy_channel.h
+++ b/ppapi/proxy/proxy_channel.h
@@ -53,10 +53,10 @@ class PPAPI_PROXY_EXPORT ProxyChannel
virtual ~ProxyChannel();
- // Alternative to InitWithChannel() for unit tests that want to send all
- // messages sent via this channel to the given test sink. The test sink
- // must outlive this class. In this case, the peer PID will be the current
- // process ID.
+ // Alternative to InitWithChannel()/ConnectChannel() for unit tests that want
+ // to send all messages sent via this channel to the given test sink. The
+ // test sink must outlive this class. In this case, the peer PID will be the
+ // current process ID.
void InitWithTestSink(IPC::TestSink* test_sink);
// Shares a file handle (HANDLE / file descriptor) with the remote side. It
@@ -87,13 +87,14 @@ class PPAPI_PROXY_EXPORT ProxyChannel
protected:
explicit ProxyChannel();
- // You must call this function before anything else. Returns true on success.
+ // You must call this function before anything else.
// The delegate pointer must outlive this class, ownership is not
// transferred.
- virtual bool InitWithChannel(Delegate* delegate,
- base::ProcessId peer_pid,
- const IPC::ChannelHandle& channel_handle,
- bool is_client);
+ void InitWithChannel(Delegate* delegate, base::ProcessId peer_pid);
+
+ // You must call this function after InitWithChannel(), and after adding any
+ // desired filters to the underlying channel, but before anything else.
+ void ConnectChannel(const IPC::ChannelHandle& channel_handle, bool is_client);
ProxyChannel::Delegate* delegate() const {
return delegate_;