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..94b1617b353b25ec45ef57eed9385fd11a81b073 100644 |
--- a/components/nacl/browser/nacl_process_host.cc |
+++ b/components/nacl/browser/nacl_process_host.cc |
@@ -15,6 +15,7 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/metrics/histogram.h" |
#include "base/path_service.h" |
+#include "base/platform_file.h" |
#include "base/process/launch.h" |
#include "base/process/process_iterator.h" |
#include "base/rand_util.h" |
@@ -257,6 +258,9 @@ unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = |
ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; |
NaClProcessHost::NaClProcessHost(const GURL& manifest_url, |
+ base::PlatformFile nexe_file, |
+ uint64_t nexe_token_lo, |
+ uint64_t nexe_token_hi, |
int render_view_id, |
uint32 permission_bits, |
bool uses_irt, |
@@ -267,6 +271,9 @@ NaClProcessHost::NaClProcessHost(const GURL& manifest_url, |
bool off_the_record, |
const base::FilePath& profile_directory) |
: manifest_url_(manifest_url), |
+ nexe_file_(nexe_file), |
+ nexe_token_lo_(nexe_token_lo), |
+ nexe_token_hi_(nexe_token_hi), |
permissions_(GetNaClPermissions(permission_bits)), |
#if defined(OS_WIN) |
process_launched_by_broker_(false), |
@@ -300,6 +307,9 @@ NaClProcessHost::NaClProcessHost(const GURL& manifest_url, |
} |
NaClProcessHost::~NaClProcessHost() { |
+ if (nexe_file_ != base::kInvalidPlatformFileValue) |
+ base::ClosePlatformFile(nexe_file_); |
+ |
// Report exit status only if the process was successfully started. |
if (process_->GetData().handle != base::kNullProcessHandle) { |
int exit_code = 0; |
@@ -455,6 +465,9 @@ void NaClProcessHost::Launch( |
} |
} |
+ // TODO(hidehiko): We no longer use imc socket channel for non-SFI mode. |
+ // Do not create them. |
+ |
// 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 +832,17 @@ 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) |
+ params.nexe_file = base::FileDescriptor(nexe_file_, true); |
+ params.nexe_token_lo = nexe_token_lo_; |
+ params.nexe_token_hi = nexe_token_hi_; |
+#endif |
+ } else { |
params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); |
params.validation_cache_key = nacl_browser->GetValidationCacheKey(); |
params.version = NaClBrowser::GetDelegate()->GetVersionString(); |
@@ -884,6 +905,10 @@ bool NaClProcessHost::StartNaClExecution() { |
process_->Send(new NaClProcessMsg_Start(params)); |
+ if (uses_nonsfi_mode_) { |
+ // Moved the ownership of nexe_file to params. |
+ nexe_file_ = base::kInvalidPlatformFileValue; |
+ } |
internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE; |
return true; |
} |