Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: ppapi/native_client/src/trusted/plugin/plugin.cc

Issue 332463003: Pepper: Remove LOAD_MODULE SRPC call in SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for mseaborn Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f102fc7eb655cbc2e3464330f5a1771889807485..ee7231b6a00f426f5b980653c82601ebddcad0b0 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -72,8 +72,7 @@ void Plugin::HistogramTimeSmall(const std::string& name,
kTimeSmallBuckets);
}
-bool Plugin::LoadHelperNaClModule(PP_FileHandle file_handle,
- NaClSubprocess* subprocess,
+bool Plugin::InternalLoadHelperNaClModule(NaClSubprocess* subprocess,
hidehiko 2014/07/01 05:39:01 nit: "Internal" seems to be usually used as suffix
teravest 2014/07/01 17:48:34 Done.
const SelLdrStartParams& params) {
hidehiko 2014/07/01 05:39:01 nit: let's align the argument indent.
teravest 2014/07/01 17:48:34 Done.
CHECK(!pp::Module::Get()->core()->IsMainThread());
ServiceRuntime* service_runtime =
@@ -108,12 +107,7 @@ bool Plugin::LoadHelperNaClModule(PP_FileHandle file_handle,
if (!service_runtime_started)
return false;
- PP_NaClFileInfo info;
- info.handle = file_handle;
- info.token_lo = 0;
- info.token_hi = 0;
-
- // Now actually load the nexe, which can happen on a background thread.
+ // Now actually start the nexe.
//
// We can't use pp::BlockUntilComplete() inside an in-process plugin, so we
// have to roll our own blocking logic, similar to WaitForSelLdrStart()
@@ -121,9 +115,8 @@ bool Plugin::LoadHelperNaClModule(PP_FileHandle file_handle,
pp::Module::Get()->core()->CallOnMainThread(
0,
callback_factory_.NewCallback(
hidehiko 2014/07/01 05:39:01 nit: can be fit in a line?
teravest 2014/07/01 17:48:34 Done.
- &Plugin::LoadNexeAndStart,
- service_runtime,
- info));
+ &Plugin::StartNexe,
+ service_runtime));
return service_runtime->WaitForNexeStart();
}
@@ -164,19 +157,8 @@ void Plugin::LoadNaClModule(PP_NaClFileInfo file_info,
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_for_ipc,
+ file_info,
true /* uses_irt */,
true /* uses_ppapi */,
enable_dyncode_syscalls,
@@ -199,18 +181,16 @@ void Plugin::LoadNaClModule(PP_NaClFileInfo file_info,
// 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::LoadNexeAndStart, service_runtime, file_info_for_srpc);
+ &Plugin::StartNexe, service_runtime);
StartSelLdrOnMainThread(
static_cast<int32_t>(PP_OK), service_runtime, params, callback);
}
-void Plugin::LoadNexeAndStart(int32_t pp_error,
- ServiceRuntime* service_runtime,
- PP_NaClFileInfo file_info) {
+void Plugin::StartNexe(int32_t pp_error, ServiceRuntime* service_runtime) {
CHECK(pp::Module::Get()->core()->IsMainThread());
if (pp_error != PP_OK)
return;
- service_runtime->LoadNexeAndStart(file_info);
+ service_runtime->StartNexe();
}
bool Plugin::LoadNaClModuleContinuationIntern() {
@@ -249,18 +229,18 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url,
return NULL;
}
+ PP_NaClFileInfo file_info;
+ file_info.handle = file_handle;
+ // We never apply validation caching to the PNaCl translator and linker.
+ file_info.token_lo = 0;
+ file_info.token_hi = 0;
+
// Do not report UMA stats for translator-related nexes.
// 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,
+ file_info,
false /* uses_irt */,
false /* uses_ppapi */,
false /* enable_dyncode_syscalls */,
@@ -269,7 +249,7 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url,
// Helper NaCl modules always use the PNaCl manifest, as there is no
// corresponding NMF.
- if (!LoadHelperNaClModule(file_handle, nacl_subprocess.get(), params)) {
+ if (!InternalLoadHelperNaClModule(nacl_subprocess.get(), params)) {
return NULL;
}
// We need not wait for the init_done callback. We can block

Powered by Google App Engine
This is Rietveld 408576698