Skip to content

Commit

Permalink
Pepper: Init reverse service before LoadModule.
Browse files Browse the repository at this point in the history
This changes the order of loading operations in the trusted plugin from:
  * Init Command Channel
  * Load user nexe
  * Start reverse service
  * Load IRT
  * Start untrusted thread

to:
  * Init Command Channel
  * Start reverse service
  * Load user nexe
  * Load IRT
  * Start untrusted thread

This is because we'd like to unify loading the user nexe, IRT, and starting the
untrusted thread into one method as part of the NaCl embedder API.

I ran into errors when doing this previously, but it appears to work in local
testing; I'm not sure what has changed.

BUG=333950

Review URL: https://codereview.chromium.org/180973008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256467 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
teravest@chromium.org committed Mar 12, 2014
1 parent 2f6816d commit 3d4da5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
21 changes: 14 additions & 7 deletions ppapi/native_client/src/trusted/plugin/service_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -449,20 +449,25 @@ ServiceRuntime::ServiceRuntime(Plugin* plugin,
NaClXCondVarCtor(&cond_);
}

bool ServiceRuntime::LoadModule(nacl::DescWrapper* nacl_desc,
ErrorInfo* error_info) {
NaClLog(4, "ServiceRuntime::LoadModule"
" (this=%p, subprocess=%p)\n",
bool ServiceRuntime::SetupCommandChannel(ErrorInfo* error_info) {
NaClLog(4, "ServiceRuntime::SetupCommand (this=%p, subprocess=%p)\n",
static_cast<void*>(this),
static_cast<void*>(subprocess_.get()));
CHECK(nacl_desc);
// Create the command channel to the sel_ldr and load the nexe from nacl_desc.
if (!subprocess_->SetupCommand(&command_channel_)) {
error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL,
"ServiceRuntime: command channel creation failed");
return false;
}
return true;
}

bool ServiceRuntime::LoadModule(nacl::DescWrapper* nacl_desc,
ErrorInfo* error_info) {
NaClLog(4, "ServiceRuntime::LoadModule"
" (this=%p, subprocess=%p)\n",
static_cast<void*>(this),
static_cast<void*>(subprocess_.get()));
CHECK(nacl_desc);
if (!subprocess_->LoadModule(&command_channel_, nacl_desc)) {
error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL,
"ServiceRuntime: load module failed");
Expand Down Expand Up @@ -630,8 +635,10 @@ bool ServiceRuntime::LoadNexeAndStart(nacl::DescWrapper* nacl_desc,
NaClLog(4, "ServiceRuntime::LoadNexeAndStart (nacl_desc=%p)\n",
reinterpret_cast<void*>(nacl_desc));
ErrorInfo error_info;
bool ok = LoadModule(nacl_desc, &error_info) &&

bool ok = SetupCommandChannel(&error_info) &&
InitReverseService(&error_info) &&
LoadModule(nacl_desc, &error_info) &&
StartModule(&error_info);
if (!ok) {
if (main_service_runtime_) {
Expand Down
1 change: 1 addition & 0 deletions ppapi/native_client/src/trusted/plugin/service_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class ServiceRuntime {

private:
NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime);
bool SetupCommandChannel(ErrorInfo* error_info);
bool LoadModule(nacl::DescWrapper* shm, ErrorInfo* error_info);
bool InitReverseService(ErrorInfo* error_info);
bool StartModule(ErrorInfo* error_info);
Expand Down

0 comments on commit 3d4da5e

Please sign in to comment.