Chromium Code Reviews| Index: chrome/browser/nacl_host/nacl_process_host.cc |
| =================================================================== |
| --- chrome/browser/nacl_host/nacl_process_host.cc (revision 143375) |
| +++ chrome/browser/nacl_host/nacl_process_host.cc (working copy) |
| @@ -145,6 +145,10 @@ |
| getenv("NACL_UNTRUSTED_EXCEPTION_HANDLING") != NULL) { |
| enable_exception_handling_ = true; |
| } |
| + |
| + enable_ipc_proxy_ = |
| + CommandLine::ForCurrentProcess()->HasSwitch( |
|
Mark Seaborn
2012/06/21 19:49:49
Nit: this would fit on the previous line
bbudge
2012/06/21 21:20:01
Done.
|
| + switches::kEnableNaClIPCProxy); |
| } |
| NaClProcessHost::~NaClProcessHost() { |
| @@ -537,6 +541,8 @@ |
| IPC_MESSAGE_HANDLER_DELAY_REPLY(NaClProcessMsg_AttachDebugExceptionHandler, |
| OnAttachDebugExceptionHandler) |
| #endif |
| + IPC_MESSAGE_HANDLER(NaClProcessHostMsg_PpapiChannelCreated, |
| + OnPpapiChannelCreated) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| return handled; |
| @@ -556,7 +562,8 @@ |
| } |
| } |
| -bool NaClProcessHost::ReplyToRenderer() { |
| +bool NaClProcessHost::ReplyToRenderer( |
| + const IPC::ChannelHandle& channel_handle) { |
| std::vector<nacl::FileDescriptor> handles_for_renderer; |
| for (size_t i = 0; i < internal_->sockets_for_renderer.size(); i++) { |
| #if defined(OS_WIN) |
| @@ -600,7 +607,7 @@ |
| #endif |
| ChromeViewHostMsg_LaunchNaCl::WriteReplyParams( |
| - reply_msg_, handles_for_renderer); |
| + reply_msg_, handles_for_renderer, channel_handle); |
| chrome_render_message_filter_->Send(reply_msg_); |
| chrome_render_message_filter_ = NULL; |
| reply_msg_ = NULL; |
| @@ -618,6 +625,7 @@ |
| params.enable_exception_handling = enable_exception_handling_; |
| params.enable_debug_stub = |
| CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug); |
| + params.enable_ipc_proxy = enable_ipc_proxy_; |
| base::PlatformFile irt_file = nacl_browser->IrtFile(); |
| CHECK_NE(irt_file, base::kInvalidPlatformFileValue); |
| @@ -665,9 +673,19 @@ |
| } |
| bool NaClProcessHost::SendStart() { |
| - return ReplyToRenderer() && StartNaClExecution(); |
| + if (!enable_ipc_proxy_) { |
| + if (!ReplyToRenderer(IPC::ChannelHandle())) |
| + return false; |
| + } |
| + return StartNaClExecution(); |
| } |
| +void NaClProcessHost::OnPpapiChannelCreated( |
| + const IPC::ChannelHandle& channel_handle) { |
| + DCHECK(enable_ipc_proxy_); |
| + ReplyToRenderer(channel_handle); |
| +} |
| + |
| bool NaClProcessHost::StartWithLaunchedProcess() { |
| #if defined(OS_LINUX) |
| if (wait_for_nacl_gdb_) { |