Chromium Code Reviews| Index: components/nacl/browser/nacl_process_host.cc |
| diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc |
| index cbb716c9197524929435a25d6e14e3fcdc3013b2..8a49131c1039747b1aa412faceb88c5ba3649890 100644 |
| --- a/components/nacl/browser/nacl_process_host.cc |
| +++ b/components/nacl/browser/nacl_process_host.cc |
| @@ -257,6 +257,7 @@ unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = |
| ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; |
| NaClProcessHost::NaClProcessHost(const GURL& manifest_url, |
| + base::File nexe_file, |
| int render_view_id, |
| uint32 permission_bits, |
| bool uses_irt, |
| @@ -267,6 +268,7 @@ NaClProcessHost::NaClProcessHost(const GURL& manifest_url, |
| bool off_the_record, |
| const base::FilePath& profile_directory) |
| : manifest_url_(manifest_url), |
| + nexe_file_(nexe_file.Pass()), |
| permissions_(GetNaClPermissions(permission_bits)), |
| #if defined(OS_WIN) |
| process_launched_by_broker_(false), |
| @@ -455,6 +457,9 @@ void NaClProcessHost::Launch( |
| } |
| } |
| + // TODO(hidehiko): We no longer use imc socket channel for non-SFI mode. |
| + // Do not create it. |
| + |
| // Rather than creating a socket pair in the renderer, and passing |
| // one side through the browser to sel_ldr, socket pairs are created |
| // in the browser and then passed to the renderer and sel_ldr. |
| @@ -819,9 +824,20 @@ bool NaClProcessHost::StartNaClExecution() { |
| NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
| NaClStartParams params; |
| + |
| // Enable PPAPI proxy channel creation only for renderer processes. |
| params.enable_ipc_proxy = enable_ppapi_proxy(); |
| - if (!uses_nonsfi_mode_) { |
| + if (uses_nonsfi_mode_) { |
| + // Currently, non-SFI mode is supported only on Linux. |
| +#if defined(OS_LINUX) |
| + // nexe_file_ still keeps the ownership at this moment, because |params| |
| + // may just be destroyed before sending IPC is properly processed. |
| + // Note that although we set auto_close=true for FileDescriptor's |
| + // constructor, it is not automatically handled in its destructor as RAII. |
| + params.nexe_file = |
| + base::FileDescriptor(nexe_file_.GetPlatformFile(), true); |
| +#endif |
| + } else { |
| params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); |
| params.validation_cache_key = nacl_browser->GetValidationCacheKey(); |
| params.version = NaClBrowser::GetDelegate()->GetVersionString(); |
| @@ -882,9 +898,14 @@ bool NaClProcessHost::StartNaClExecution() { |
| } |
| #endif |
| - process_->Send(new NaClProcessMsg_Start(params)); |
| - |
| + // Here we are about sending the IPC, so release file descriptors to delegate |
|
Mark Seaborn
2014/06/19 22:36:48
Nit: "about to send the IPC"
hidehiko
2014/06/20 04:02:50
Done.
|
| + // the ownership to the message. |
| + if (uses_nonsfi_mode_) { |
| + nexe_file_.TakePlatformFile(); |
| + } |
| internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE; |
| + |
| + process_->Send(new NaClProcessMsg_Start(params)); |
| return true; |
| } |