Index: ppapi/native_client/src/trusted/plugin/plugin.cc |
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc |
index 2dffec6928d3d49a4332b71c774a189bdcaee6d1..5439a9a6d09a0028fbf097a27e07f8726b52404e 100644 |
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc |
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc |
@@ -41,6 +41,12 @@ const int64_t kTimeSmallMin = 1; // in ms |
const int64_t kTimeSmallMax = 20000; // in ms |
const uint32_t kTimeSmallBuckets = 100; |
+const PP_NaClFileInfo kInvalidNaClFileInfo = { |
+ PP_kInvalidFileHandle, |
+ 0, // token_lo |
+ 0, // token_hi |
+}; |
+ |
} // namespace |
void Plugin::ShutDownSubprocesses() { |
@@ -72,7 +78,9 @@ bool Plugin::LoadNaClModuleFromBackgroundThread( |
const SelLdrStartParams& params) { |
CHECK(!pp::Module::Get()->core()->IsMainThread()); |
ServiceRuntime* service_runtime = |
- new ServiceRuntime(this, false, uses_nonsfi_mode_, |
+ new ServiceRuntime(this, |
+ false, // non main_service_runtime |
+ false, // no non-SFI mode. (i.e. in SFI-mode). |
pp::BlockUntilComplete(), pp::BlockUntilComplete()); |
subprocess->set_service_runtime(service_runtime); |
PLUGIN_PRINTF(("Plugin::LoadNaClModuleFromBackgroundThread " |
@@ -167,10 +175,24 @@ void Plugin::LoadNaClModule(PP_NaClFileInfo file_info, |
pp::Var manifest_base_url = |
pp::Var(pp::PASS_REF, nacl_interface_->GetManifestBaseURL(pp_instance())); |
std::string manifest_base_url_str = manifest_base_url.AsString(); |
+ |
+ PP_NaClFileInfo launch_sel_ldr_file_info; |
+ PP_NaClFileInfo load_module_file_info; |
+ if (uses_nonsfi_mode) { |
+ // In non-SFI mode, LaunchSelLdr is used to pass the nexe file's descriptor |
+ // to the plugin. |
+ launch_sel_ldr_file_info = file_info; |
+ load_module_file_info = kInvalidNaClFileInfo; |
+ } else { |
+ // Otherwise (i.e. in SFI-mode), LoadModule SRPC is still being used. |
+ launch_sel_ldr_file_info = kInvalidNaClFileInfo; |
+ load_module_file_info = file_info; |
+ } |
+ |
SelLdrStartParams params(manifest_base_url_str, |
+ launch_sel_ldr_file_info, |
true /* uses_irt */, |
true /* uses_ppapi */, |
- uses_nonsfi_mode, |
enable_dyncode_syscalls, |
enable_exception_handling, |
enable_crash_throttling); |
@@ -193,7 +215,7 @@ void Plugin::LoadNaClModule(PP_NaClFileInfo file_info, |
// callback here for |callback|. |
pp::CompletionCallback callback = callback_factory_.NewCallback( |
&Plugin::LoadNexeAndStart, |
- service_runtime, file_info, pp::CompletionCallback()); |
+ service_runtime, load_module_file_info, pp::CompletionCallback()); |
StartSelLdrOnMainThread( |
static_cast<int32_t>(PP_OK), service_runtime, params, callback); |
} |
@@ -248,10 +270,16 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url, |
// TODO(sehr): define new UMA stats for translator related nexe events. |
// NOTE: The PNaCl translator nexes are not built to use the IRT. This is |
// done to save on address space and swap space. |
+ // |
+ // Currently, this works only in SFI-mode. So, LoadModule SRPC is still used. |
+ // So, pass kInvalidNaClFileInfo here, and instead |file_handle| is passed |
+ // to LoadNaClModuleFromBackgroundThread() below. |
+ // TODO(teravest, hidehiko): Pass file_handle to params, so that LaunchSelLdr |
+ // will look at the info. |
SelLdrStartParams params(helper_url, |
+ kInvalidNaClFileInfo, |
false /* uses_irt */, |
false /* uses_ppapi */, |
- false /* uses_nonsfi_mode */, |
false /* enable_dyncode_syscalls */, |
false /* enable_exception_handling */, |
true /* enable_crash_throttling */); |