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

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

Issue 413063003: Revert 285028 "Pepper: Remove LOAD_MODULE SRPC call in SFI mode." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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
« no previous file with comments | « trunk/src/ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ppapi/native_client/src/trusted/plugin/service_runtime.cc
===================================================================
--- trunk/src/ppapi/native_client/src/trusted/plugin/service_runtime.cc (revision 285116)
+++ trunk/src/ppapi/native_client/src/trusted/plugin/service_runtime.cc (working copy)
@@ -466,10 +466,16 @@
NaClXCondVarSignal(&cond_);
}
-void ServiceRuntime::StartNexe() {
- bool ok = StartNexeInternal();
+void ServiceRuntime::LoadNexeAndStart(PP_NaClFileInfo file_info) {
+ NaClLog(4, "ServiceRuntime::LoadNexeAndStart (handle_valid=%d "
+ "token_lo=%" NACL_PRIu64 " token_hi=%" NACL_PRIu64 ")\n",
+ file_info.handle != PP_kInvalidFileHandle,
+ file_info.token_lo,
+ file_info.token_hi);
+
+ bool ok = LoadNexeAndStartInternal(file_info);
if (ok) {
- NaClLog(4, "ServiceRuntime::StartNexe (success)\n");
+ NaClLog(4, "ServiceRuntime::LoadNexeAndStart (success)\n");
} else {
ReapLogs();
}
@@ -478,14 +484,49 @@
SignalNexeStarted(ok);
}
-bool ServiceRuntime::StartNexeInternal() {
- if (!SetupCommandChannel())
+bool ServiceRuntime::LoadNexeAndStartInternal(
+ const PP_NaClFileInfo& file_info) {
+ if(!SetupCommandChannel()) {
return false;
- if (!InitReverseService())
+ }
+ if (!InitReverseService()) {
return false;
- return StartModule();
+ }
+ if (!LoadModule(file_info)) {
+ ErrorInfo error_info;
+ error_info.SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL,
+ "ServiceRuntime: load module failed");
+ ReportLoadError(error_info);
+ return false;
+ }
+ if (!StartModule()) {
+ return false;
+ }
+ return true;
}
+bool ServiceRuntime::LoadModule(const PP_NaClFileInfo& file_info) {
+ if (uses_nonsfi_mode_) {
+ // In non-SFI mode, loading is done a part of LaunchSelLdr.
+ return true;
+ }
+
+ NaClFileInfo nacl_file_info;
+ nacl_file_info.desc = ConvertFileDescriptor(file_info.handle, true);
+ nacl_file_info.file_token.lo = file_info.token_lo;
+ nacl_file_info.file_token.hi = file_info.token_hi;
+ NaClDesc* desc = NaClDescIoFromFileInfo(nacl_file_info, O_RDONLY);
+ if (desc == NULL) {
+ return false;
+ }
+ // We don't use a scoped_ptr here since we would immediately release the
+ // DescWrapper to LoadModule().
+ nacl::DescWrapper* wrapper =
+ plugin_->wrapper_factory()->MakeGenericCleanup(desc);
+ // TODO(teravest, hidehiko): Replace this by Chrome IPC.
+ return subprocess_->LoadModule(&command_channel_, wrapper);
+}
+
void ServiceRuntime::ReapLogs() {
// On a load failure the service runtime does not crash itself to
// avoid a race where the no-more-senders error on the reverse
« no previous file with comments | « trunk/src/ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698