| Index: trunk/src/ppapi/native_client/src/trusted/plugin/plugin.cc
|
| ===================================================================
|
| --- trunk/src/ppapi/native_client/src/trusted/plugin/plugin.cc (revision 285116)
|
| +++ trunk/src/ppapi/native_client/src/trusted/plugin/plugin.cc (working copy)
|
| @@ -66,8 +66,9 @@
|
| kTimeSmallBuckets);
|
| }
|
|
|
| -bool Plugin::LoadHelperNaClModuleInternal(NaClSubprocess* subprocess,
|
| - const SelLdrStartParams& params) {
|
| +bool Plugin::LoadHelperNaClModule(PP_NaClFileInfo file_info,
|
| + NaClSubprocess* subprocess,
|
| + const SelLdrStartParams& params) {
|
| CHECK(!pp::Module::Get()->core()->IsMainThread());
|
| ServiceRuntime* service_runtime =
|
| new ServiceRuntime(this,
|
| @@ -74,8 +75,7 @@
|
| pp_instance(),
|
| false, // No main_service_runtime.
|
| false, // No non-SFI mode (i.e. in SFI-mode).
|
| - pp::BlockUntilComplete(),
|
| - pp::BlockUntilComplete());
|
| + pp::BlockUntilComplete(), pp::BlockUntilComplete());
|
| subprocess->set_service_runtime(service_runtime);
|
| PLUGIN_PRINTF(("Plugin::LoadHelperNaClModule "
|
| "(service_runtime=%p)\n",
|
| @@ -102,7 +102,7 @@
|
| if (!service_runtime_started)
|
| return false;
|
|
|
| - // Now actually start the nexe.
|
| + // Now actually load the nexe, which can happen on a background thread.
|
| //
|
| // We can't use pp::BlockUntilComplete() inside an in-process plugin, so we
|
| // have to roll our own blocking logic, similar to WaitForSelLdrStart()
|
| @@ -109,7 +109,10 @@
|
| // above, except without timeout logic.
|
| pp::Module::Get()->core()->CallOnMainThread(
|
| 0,
|
| - callback_factory_.NewCallback(&Plugin::StartNexe, service_runtime));
|
| + callback_factory_.NewCallback(
|
| + &Plugin::LoadNexeAndStart,
|
| + service_runtime,
|
| + file_info));
|
| return service_runtime->WaitForNexeStart();
|
| }
|
|
|
| @@ -150,8 +153,19 @@
|
| pp::Var(pp::PASS_REF, nacl_interface_->GetManifestBaseURL(pp_instance()));
|
| std::string manifest_base_url_str = manifest_base_url.AsString();
|
|
|
| + PP_NaClFileInfo file_info_for_srpc = kInvalidNaClFileInfo;
|
| + PP_NaClFileInfo file_info_for_ipc = kInvalidNaClFileInfo;
|
| + if (uses_nonsfi_mode) {
|
| + // In non-SFI mode, LaunchSelLdr is used to pass the nexe file's descriptor
|
| + // to the NaCl loader process.
|
| + file_info_for_ipc = file_info;
|
| + } else {
|
| + // Otherwise (i.e. in SFI-mode), LoadModule SRPC is still being used.
|
| + file_info_for_srpc = file_info;
|
| + }
|
| +
|
| SelLdrStartParams params(manifest_base_url_str,
|
| - file_info,
|
| + file_info_for_ipc,
|
| true /* uses_irt */,
|
| true /* uses_ppapi */,
|
| enable_dyncode_syscalls,
|
| @@ -174,16 +188,18 @@
|
| // We don't take any action once nexe loading has completed, so pass an empty
|
| // callback here for |callback|.
|
| pp::CompletionCallback callback = callback_factory_.NewCallback(
|
| - &Plugin::StartNexe, service_runtime);
|
| + &Plugin::LoadNexeAndStart, service_runtime, file_info_for_srpc);
|
| StartSelLdrOnMainThread(
|
| static_cast<int32_t>(PP_OK), service_runtime, params, callback);
|
| }
|
|
|
| -void Plugin::StartNexe(int32_t pp_error, ServiceRuntime* service_runtime) {
|
| +void Plugin::LoadNexeAndStart(int32_t pp_error,
|
| + ServiceRuntime* service_runtime,
|
| + PP_NaClFileInfo file_info) {
|
| CHECK(pp::Module::Get()->core()->IsMainThread());
|
| if (pp_error != PP_OK)
|
| return;
|
| - service_runtime->StartNexe();
|
| + service_runtime->LoadNexeAndStart(file_info);
|
| }
|
|
|
| bool Plugin::LoadNaClModuleContinuationIntern() {
|
| @@ -226,8 +242,14 @@
|
| // 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_info| is passed
|
| + // to LoadNaClModuleFromBackgroundThread() below.
|
| + // TODO(teravest, hidehiko): Pass file_info to params, so that LaunchSelLdr
|
| + // will look at the info.
|
| SelLdrStartParams params(helper_url,
|
| - file_info,
|
| + kInvalidNaClFileInfo,
|
| false /* uses_irt */,
|
| false /* uses_ppapi */,
|
| false /* enable_dyncode_syscalls */,
|
| @@ -236,9 +258,11 @@
|
|
|
| // Helper NaCl modules always use the PNaCl manifest, as there is no
|
| // corresponding NMF.
|
| - if (!LoadHelperNaClModuleInternal(nacl_subprocess.get(), params))
|
| + if (!LoadHelperNaClModule(file_info,
|
| + nacl_subprocess.get(),
|
| + params)) {
|
| return NULL;
|
| -
|
| + }
|
| // We need not wait for the init_done callback. We can block
|
| // here in StartSrpcServices, since helper NaCl modules
|
| // are spawned from a private thread.
|
|
|