| Index: ppapi/native_client/src/trusted/plugin/service_runtime.cc
|
| diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
|
| index 9bc7b713abf58c8b8b8389b32cd38472561a39ec..b3d03bb5da78fe791cf4db7dcb01fd4c4637c184 100644
|
| --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
|
| +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
|
| @@ -497,18 +497,34 @@ bool ServiceRuntime::LoadModule(nacl::DescWrapper* nacl_desc,
|
| 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(ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL,
|
| "ServiceRuntime: command channel creation failed");
|
| return false;
|
| }
|
| + struct NaClDesc *desc = nacl_desc->desc();
|
| + if (NACL_VTBL(NaClDesc, desc)->typeTag != NACL_DESC_HOST_IO)
|
| + return false;
|
| + PP_FileHandle h = ((struct NaClDescIoDesc *) desc)->hd->d;
|
| + uint32_t nacl_error_code;
|
| + PP_Bool ok = plugin_->nacl_interface()->LoadModule(
|
| + plugin_->pp_instance(), h, &nacl_error_code);
|
| + if (ok == PP_FALSE)
|
| + return false;
|
|
|
| - if (!subprocess_->LoadModule(&command_channel_, nacl_desc)) {
|
| - error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL,
|
| - "ServiceRuntime: load module failed");
|
| + if (main_service_runtime_)
|
| + plugin_->ReportSelLdrLoadStatus(nacl_error_code);
|
| +
|
| + if (LOAD_OK != nacl_error_code) {
|
| + error_info->SetReport(
|
| + ERROR_SEL_LDR_START_STATUS,
|
| + NaClErrorString(static_cast<NaClErrorCode>(nacl_error_code)));
|
| return false;
|
| }
|
| +
|
| + fprintf(stderr, "LoadModule finished\n");
|
| return true;
|
| }
|
|
|
| @@ -552,32 +568,12 @@ bool ServiceRuntime::StartModule(ErrorInfo* error_info) {
|
| // start the module. otherwise we cannot connect for multimedia
|
| // subsystem since that is handled by user-level code (not secure!)
|
| // in libsrpc.
|
| - int load_status = -1;
|
| - NaClSrpcResultCodes rpc_result =
|
| - NaClSrpcInvokeBySignature(&command_channel_,
|
| - "start_module::i",
|
| - &load_status);
|
| -
|
| - if (NACL_SRPC_RESULT_OK != rpc_result) {
|
| - error_info->SetReport(ERROR_SEL_LDR_START_MODULE,
|
| - "ServiceRuntime: could not start nacl module");
|
| - return false;
|
| - }
|
| - NaClLog(4, "ServiceRuntime::StartModule (load_status=%d)\n",
|
| - load_status);
|
| - if (main_service_runtime_) {
|
| - plugin_->ReportSelLdrLoadStatus(load_status);
|
| - }
|
| - if (LOAD_OK != load_status) {
|
| - error_info->SetReport(
|
| - ERROR_SEL_LDR_START_STATUS,
|
| - NaClErrorString(static_cast<NaClErrorCode>(load_status)));
|
| - return false;
|
| - }
|
| - return true;
|
| + PP_Bool ok = plugin_->nacl_interface()->StartModule(plugin_->pp_instance());
|
| + return PP_ToBool(ok);
|
| }
|
|
|
| -bool ServiceRuntime::StartSelLdr(const SelLdrStartParams& params) {
|
| +void ServiceRuntime::StartSelLdr(const SelLdrStartParams& params,
|
| + PP_CompletionCallback callback) {
|
| NaClLog(4, "ServiceRuntime::Start\n");
|
|
|
| nacl::scoped_ptr<SelLdrLauncherChrome>
|
| @@ -591,34 +587,20 @@ bool ServiceRuntime::StartSelLdr(const SelLdrStartParams& params) {
|
| "ServiceRuntime: failed to create sel_ldr launcher");
|
| plugin_->ReportLoadError(error_info);
|
| }
|
| - return false;
|
| - }
|
| - nacl::string error_message;
|
| - bool started = tmp_subprocess->Start(plugin_->pp_instance(),
|
| - params.url.c_str(),
|
| - params.uses_irt,
|
| - params.uses_ppapi,
|
| - params.enable_dev_interfaces,
|
| - params.enable_dyncode_syscalls,
|
| - params.enable_exception_handling,
|
| - params.enable_crash_throttling,
|
| - &error_message);
|
| - if (!started) {
|
| - NaClLog(LOG_ERROR, "ServiceRuntime::Start (start failed)\n");
|
| - if (main_service_runtime_) {
|
| - ErrorInfo error_info;
|
| - error_info.SetReportWithConsoleOnlyError(
|
| - ERROR_SEL_LDR_LAUNCH,
|
| - "ServiceRuntime: failed to start",
|
| - error_message);
|
| - plugin_->ReportLoadError(error_info);
|
| - }
|
| - return false;
|
| + PP_RunCompletionCallback(&callback, PP_ERROR_FAILED);
|
| + return;
|
| }
|
| -
|
| + tmp_subprocess->Start(plugin_->pp_instance(),
|
| + params.url.c_str(),
|
| + params.uses_irt,
|
| + params.uses_ppapi,
|
| + params.enable_dev_interfaces,
|
| + params.enable_dyncode_syscalls,
|
| + params.enable_exception_handling,
|
| + params.enable_crash_throttling,
|
| + &start_sel_ldr_error_message_, // FIXME: Use.
|
| + callback);
|
| subprocess_.reset(tmp_subprocess.release());
|
| - NaClLog(4, "ServiceRuntime::StartSelLdr (return 1)\n");
|
| - return true;
|
| }
|
|
|
| void ServiceRuntime::WaitForSelLdrStart() {
|
| @@ -640,7 +622,7 @@ bool ServiceRuntime::LoadNexeAndStart(nacl::DescWrapper* nacl_desc,
|
| reinterpret_cast<void*>(nacl_desc));
|
| ErrorInfo error_info;
|
| bool ok = LoadModule(nacl_desc, &error_info) &&
|
| - InitReverseService(&error_info) &&
|
| + InitReverseService(&error_info);
|
| StartModule(&error_info);
|
| if (!ok) {
|
| if (main_service_runtime_) {
|
|
|