Chromium Code Reviews| Index: chrome/nacl/nacl_listener.cc |
| =================================================================== |
| --- chrome/nacl/nacl_listener.cc (revision 134969) |
| +++ chrome/nacl/nacl_listener.cc (working copy) |
| @@ -14,9 +14,10 @@ |
| #include "chrome/common/nacl_messages.h" |
| #include "chrome/nacl/nacl_validation_db.h" |
| #include "chrome/nacl/nacl_validation_query.h" |
| +#include "ipc/ipc_channel_handle.h" |
| +#include "ipc/ipc_switches.h" |
| #include "ipc/ipc_sync_channel.h" |
| #include "ipc/ipc_sync_message_filter.h" |
| -#include "ipc/ipc_switches.h" |
| #include "native_client/src/trusted/service_runtime/sel_main_chrome.h" |
| #if defined(OS_LINUX) |
| @@ -173,6 +174,28 @@ |
| return handled; |
| } |
| +class MyListener : public IPC::Channel::Listener |
| +{ |
| + virtual bool OnMessageReceived(const IPC::Message& message) { |
| + return true; |
| + } |
| + |
| + virtual void OnChannelConnected(int32 peer_pid) { |
| + } |
| + |
| + virtual void OnChannelError() { |
| + } |
| +}; |
| + |
| +class MyFilter : public IPC::ChannelProxy::MessageFilter |
| +{ |
| + virtual bool OnMessageReceived(const IPC::Message& message) { |
| + return true; |
| + } |
| +}; |
| + |
| +static MyListener test_listener; |
|
dmichael (off chromium)
2012/05/04 22:51:42
Does it make sense for this to be a file-scope sta
bbudge
2012/05/07 18:08:53
This is just experimental hacking to verify that t
|
| + |
| void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) { |
| struct NaClChromeMainArgs *args = NaClChromeMainArgsCreate(); |
| if (args == NULL) { |
| @@ -180,6 +203,18 @@ |
| return; |
| } |
| + // Create the server side of the channel and notify the process host so it |
| + // can reply to the renderer, which will then try to connect as client. |
| + IPC::ChannelHandle channel_handle = |
| + IPC::Channel::GenerateVerifiedChannelID("nacl"); |
| + ppapi_channel_.reset( |
| + new IPC::SyncChannel(&test_listener, io_thread_.message_loop_proxy(), |
| + &shutdown_event_)); |
| + ppapi_channel_->AddFilter(new MyFilter); |
| + ppapi_channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true); |
| + |
| + Send(new NaClProcessHostMsg_PpapiChannelCreated(channel_handle)); |
| + |
| std::vector<nacl::FileDescriptor> handles = params.handles; |
| #if defined(OS_LINUX) || defined(OS_MACOSX) |