Chromium Code Reviews| Index: ppapi/proxy/plugin_main_nacl.cc |
| diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc |
| index 90ebfd484874e18fe77da9f949eca9f187bd3e04..62deece543e04501deba8fe6fcef51c3d1dea084 100644 |
| --- a/ppapi/proxy/plugin_main_nacl.cc |
| +++ b/ppapi/proxy/plugin_main_nacl.cc |
| @@ -12,6 +12,7 @@ |
| // ViewMsgLog et al. functions. |
| #include "base/command_line.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/synchronization/waitable_event.h" |
| @@ -56,9 +57,10 @@ namespace { |
| // This class manages communication between the plugin and the browser, and |
| // manages the PluginDispatcher instances for communication between the plugin |
| // and the renderer. |
| -class PpapiDispatcher : public ProxyChannel, |
| - public PluginDispatcher::PluginDelegate, |
| - public PluginProxyDelegate { |
| +class PpapiDispatcher : public PluginDispatcher::PluginDelegate, |
| + public PluginProxyDelegate, |
| + public IPC::Listener, |
| + public IPC::Sender { |
| public: |
| explicit PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop); |
| @@ -86,6 +88,10 @@ class PpapiDispatcher : public ProxyChannel, |
| // IPC::Listener implementation. |
| virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| + virtual void OnChannelError() OVERRIDE; |
| + |
| + // IPC::Sender implementation |
| + virtual bool Send(IPC::Message* message) OVERRIDE; |
| private: |
| void OnMsgInitializeNaClDispatcher(const ppapi::PpapiNaClPluginArgs& args); |
| @@ -98,6 +104,7 @@ class PpapiDispatcher : public ProxyChannel, |
| uint32 next_plugin_dispatcher_id_; |
| scoped_refptr<base::MessageLoopProxy> message_loop_; |
| base::WaitableEvent shutdown_event_; |
| + scoped_ptr<IPC::SyncChannel> channel_; |
| }; |
| PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop) |
| @@ -110,11 +117,13 @@ PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop) |
| "NaCl IPC", base::FileDescriptor(NACL_CHROME_DESC_BASE, false)); |
| // We don't have/need a PID since handle sharing happens outside of the |
| // NaCl sandbox. |
| - InitWithChannel(this, base::kNullProcessId, channel_handle, |
| - false); // Channel is server. |
| - channel()->AddFilter(new ppapi::proxy::PluginMessageFilter( |
| + channel_.reset(new IPC::SyncChannel( |
| + channel_handle, IPC::Channel::MODE_SERVER, this, |
| + GetIPCMessageLoop(), true, GetShutdownEvent())); |
| + |
| + channel_->AddFilter(new ppapi::proxy::PluginMessageFilter( |
| NULL, PluginGlobals::Get()->resource_reply_thread_registrar())); |
| - channel()->AddFilter( |
| + channel_->AddFilter( |
| new tracing::ChildTraceMessageFilter(message_loop_.get())); |
| } |
| @@ -194,6 +203,14 @@ bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| return true; |
| } |
| +void PpapiDispatcher::OnChannelError() { |
| + channel_.reset(); |
|
dmichael (off chromium)
2014/02/19 19:23:51
I wonder if we should exit() here...
|
| +} |
| + |
| +bool PpapiDispatcher::Send(IPC::Message* msg) { |
| + return channel_->Send(msg); |
| +} |
| + |
| void PpapiDispatcher::OnMsgInitializeNaClDispatcher( |
| const ppapi::PpapiNaClPluginArgs& args) { |
| static bool command_line_and_logging_initialized = false; |