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 16c0da391ec5a3f7881786ecaf7d018e3e04756f..f9f015eafb5ba3c9d073b5d30bf2ba71837f12a5 100644 |
| --- a/components/nacl/browser/nacl_process_host.cc |
| +++ b/components/nacl/browser/nacl_process_host.cc |
| @@ -235,19 +235,56 @@ 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::ResourceFileInfo::ResourceFileInfo() |
| + : file_token_() { |
| +} |
| + |
| +NaClProcessHost::ResourceFileInfo::ResourceFileInfo( |
| + base::File file, |
| + const NaClFileToken& file_token, |
| + const std::string& file_key) |
| + : file_(file.Pass()), |
| + file_token_(file_token), |
| + file_key_(file_key) { |
| +} |
| + |
| +NaClProcessHost::ResourceFileInfo::~ResourceFileInfo() { |
| +} |
| + |
| +NaClProcessHost::ResourceFileInfo::ResourceFileInfo(RValue other) |
| + : file_(other.object->file_.Pass()), |
| + file_token_(other.object->file_token()), |
| + file_key_(other.object->file_key()) { |
| +} |
| + |
| +NaClProcessHost::ResourceFileInfo& |
| +NaClProcessHost::ResourceFileInfo::operator=(RValue other) { |
| + if (this != other.object) { |
| + file_ = other.object->file_.Pass(); |
| + file_token_ = other.object->file_token(); |
| + file_key_ = other.object->file_key(); |
| + } |
| + return *this; |
| +} |
| + |
| +NaClProcessHost::NaClProcessHost( |
| + const GURL& manifest_url, |
| + base::File nexe_file, |
| + const NaClFileToken& nexe_token, |
| + scoped_ptr<NaClProcessHost::ResourceFileInfo[]> resource_files_info, |
| + size_t resource_files_info_len, |
| + 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.Pass()), |
| + resource_files_info_len_(resource_files_info_len), |
| permissions_(permissions), |
| #if defined(OS_WIN) |
| process_launched_by_broker_(false), |
| @@ -880,10 +917,18 @@ bool NaClProcessHost::StartNaClExecution() { |
| // 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)) { |
| + if (uses_nonsfi_mode_) { |
|
hidehiko
2015/01/28 09:05:19
nit:
if (nonsfi) {
// Don't retrieve the file p
Yusuke Sato
2015/02/04 02:00:28
Done.
|
| + for (size_t i = 0; i < resource_files_info_len_; ++i) { |
|
hidehiko
2015/01/28 09:05:19
Could you add a short comment why this is needed o
Yusuke Sato
2015/02/04 02:00:28
Done.
|
| + IPC::PlatformFileForTransit file = IPC::TakeFileHandleForProcess( |
| + resource_files_info_[i].file().Pass(), process_->GetData().handle); |
| + std::string file_key = resource_files_info_[i].file_key(); |
| + params.resource_files.push_back( |
| + // Pass an empty base::FilePath since Non-SFI mode does not use it. |
| + NaClStartParams::ResourceFileInfo(file, base::FilePath(), file_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. |
| @@ -903,6 +948,8 @@ bool NaClProcessHost::StartNaClExecution() { |
| params.nexe_file = IPC::TakeFileHandleForProcess(nexe_file_.Pass(), |
| process_->GetData().handle); |
| + |
| + params.CheckNumOfDescriptors(); |
| process_->Send(new NaClProcessMsg_Start(params)); |
| return true; |
| } |