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 e273204194852c306dbadd64996e59d12ffdbd7c..d7e2b8983b7fa9f0a2c0f9bb504db124981a01c0 100644 |
| --- a/components/nacl/browser/nacl_process_host.cc |
| +++ b/components/nacl/browser/nacl_process_host.cc |
| @@ -235,19 +235,22 @@ void CloseFile(base::File file) { |
| unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = |
| ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; |
| -NaClProcessHost::NaClProcessHost(const GURL& manifest_url, |
| - base::File nexe_file, |
| - const NaClFileToken& nexe_token, |
| - ppapi::PpapiPermissions permissions, |
| - int render_view_id, |
| - uint32 permission_bits, |
| - bool uses_nonsfi_mode, |
| - bool off_the_record, |
| - NaClAppProcessType process_type, |
| - const base::FilePath& profile_directory) |
| +NaClProcessHost::NaClProcessHost( |
| + const GURL& manifest_url, |
| + base::File nexe_file, |
| + const NaClFileToken& nexe_token, |
| + const std::vector<NaClResourceFileInfo>& resource_files_info, |
|
Mark Seaborn
2015/02/12 03:57:33
I walked through the IPC flow to refresh my memory
Yusuke Sato
2015/02/13 23:01:16
I didn't do this originally mainly because I wante
|
| + ppapi::PpapiPermissions permissions, |
| + int render_view_id, |
| + uint32 permission_bits, |
| + bool uses_nonsfi_mode, |
| + bool off_the_record, |
| + NaClAppProcessType process_type, |
| + const base::FilePath& profile_directory) |
| : manifest_url_(manifest_url), |
| nexe_file_(nexe_file.Pass()), |
| nexe_token_(nexe_token), |
| + resource_files_info_(resource_files_info), |
| permissions_(permissions), |
| #if defined(OS_WIN) |
| process_launched_by_broker_(false), |
| @@ -886,32 +889,43 @@ bool NaClProcessHost::StartNaClExecution() { |
| } |
| base::FilePath file_path; |
| - // Don't retrieve the file path when using nonsfi mode; there's no validation |
| - // caching in that case, so it's unnecessary work, and would expose the file |
| - // path to the plugin. |
| - if (!uses_nonsfi_mode_ && |
| - NaClBrowser::GetInstance()->GetFilePath(nexe_token_.lo, |
| - nexe_token_.hi, |
| - &file_path)) { |
| - // We have to reopen the file in the browser process; we don't want a |
| - // compromised renderer to pass an arbitrary fd that could get loaded |
| - // into the plugin process. |
| - if (base::PostTaskAndReplyWithResult( |
| - content::BrowserThread::GetBlockingPool(), |
| - FROM_HERE, |
| - base::Bind(OpenNaClReadExecImpl, |
| - file_path, |
| - true /* is_executable */), |
| - base::Bind(&NaClProcessHost::StartNaClFileResolved, |
| - weak_factory_.GetWeakPtr(), |
| - params, |
| - file_path))) { |
| - return true; |
| + if (uses_nonsfi_mode_) { |
| + // Don't retrieve the file path when using nonsfi mode; there's no |
| + // validation caching in that case, so it's unnecessary work, and would |
| + // expose the file path to the plugin. |
| + for (size_t i = 0; i < resource_files_info_.size(); ++i) { |
| + params.resource_files.push_back( |
| + NaClStartParams::ResourceFileInfo(resource_files_info_[i].file, |
| + base::FilePath(), |
|
Mark Seaborn
2015/02/12 03:57:33
See comment in nonsfi_listener.cc -- you can add a
Yusuke Sato
2015/02/13 23:01:16
Done.
|
| + resource_files_info_[i].key)); |
| + } |
| + } else { |
| + if (NaClBrowser::GetInstance()->GetFilePath(nexe_token_.lo, |
| + nexe_token_.hi, |
| + &file_path)) { |
| + // We have to reopen the file in the browser process; we don't want a |
| + // compromised renderer to pass an arbitrary fd that could get loaded |
| + // into the plugin process. |
| + if (base::PostTaskAndReplyWithResult( |
| + content::BrowserThread::GetBlockingPool(), |
| + FROM_HERE, |
| + base::Bind(OpenNaClReadExecImpl, |
| + file_path, |
| + true /* is_executable */), |
| + base::Bind(&NaClProcessHost::StartNaClFileResolved, |
| + weak_factory_.GetWeakPtr(), |
| + params, |
| + file_path))) { |
| + return true; |
| + } |
| } |
| + // TODO(yusukes): Handle |resource_files_info_| for SFI-NaCl. |
| } |
| params.nexe_file = IPC::TakeFileHandleForProcess(nexe_file_.Pass(), |
| process_->GetData().handle); |
| + |
| + params.CheckNumOfDescriptors(); |
| process_->Send(new NaClProcessMsg_Start(params)); |
| return true; |
| } |