| 1 | bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, |
| 2 | NaClSubprocess* subprocess, |
| 3 | const Manifest* manifest, |
| 4 | bool should_report_uma, |
| 5 | ErrorInfo* error_info, |
| 6 | pp::CompletionCallback init_done_cb, |
| 7 | pp::CompletionCallback crash_cb) { |
| 8 | ServiceRuntime* new_service_runtime = |
| 9 | new ServiceRuntime(this, manifest, should_report_uma, init_done_cb, |
| 10 | crash_cb); |
| 11 | subprocess->set_service_runtime(new_service_runtime); |
| 12 | PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime=%p)\n", |
| 13 | static_cast<void*>(new_service_runtime))); |
| 14 | if (NULL == new_service_runtime) { |
| 15 | error_info->SetReport(ERROR_SEL_LDR_INIT, |
| 16 | "sel_ldr init failure " + subprocess->description()); |
| 17 | return false; |
| 18 | } |
| 19 | |
| 20 | bool service_runtime_started = |
| 21 | new_service_runtime->Start(wrapper, |
| 22 | error_info, |
| 23 | manifest_base_url()); |
| 24 | PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n", |
| 25 | service_runtime_started)); |
| 26 | if (!service_runtime_started) { |
| 27 | return false; |
| 28 | } |
| 29 | // Try to start the Chrome IPC-based proxy. |
| 30 | const PPB_NaCl_Private* ppb_nacl = GetNaclInterface(); |
| 31 | if (ppb_nacl->StartPpapiProxy(pp_instance())) { |
| 32 | using_ipc_proxy_ = true; |
| 33 | // We need to explicitly schedule this here. It is normally called in |
| 34 | // response to starting the SRPC proxy. |
| 35 | CHECK(init_done_cb.pp_completion_callback().func != NULL); |
| 36 | PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon, started ipc proxy.\n")); |
| 37 | pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb, PP_OK); |
| 38 | } |
| 39 | return true; |
| 40 | } |