| 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 272bbabebcb18fa79ea7e9bc49e3b084cef88410..ed4fbe8fa363deead3ed157ae5578b7b3bb089a3 100644
|
| --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
|
| +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
|
| @@ -418,6 +418,8 @@ void PluginReverseInterface::ReportCrash() {
|
| if (crash_cb_.pp_completion_callback().func != NULL) {
|
| NaClLog(4, "PluginReverseInterface::ReportCrash: invoking CB\n");
|
| pp::Module::Get()->core()->CallOnMainThread(0, crash_cb_, PP_OK);
|
| + // Clear the callback to avoid it gets invoked twice.
|
| + crash_cb_ = pp::CompletionCallback();
|
| } else {
|
| NaClLog(1,
|
| "PluginReverseInterface::ReportCrash:"
|
| @@ -683,8 +685,7 @@ void ServiceRuntime::SignalNexeStarted() {
|
| }
|
|
|
| void ServiceRuntime::LoadNexeAndStart(PP_NaClFileInfo file_info,
|
| - const pp::CompletionCallback& started_cb,
|
| - const pp::CompletionCallback& crash_cb) {
|
| + const pp::CompletionCallback& callback) {
|
| NaClLog(4, "ServiceRuntime::LoadNexeAndStart (handle_valid=%d "
|
| "token_lo=%" NACL_PRIu64 " token_hi=%" NACL_PRIu64 ")\n",
|
| file_info.handle != PP_kInvalidFileHandle,
|
| @@ -695,7 +696,9 @@ void ServiceRuntime::LoadNexeAndStart(PP_NaClFileInfo file_info,
|
| InitReverseService() &&
|
| LoadModule(file_info) &&
|
| StartModule();
|
| - if (!ok) {
|
| + if (ok) {
|
| + NaClLog(4, "ServiceRuntime::LoadNexeAndStart (return 1)\n");
|
| + } else {
|
| // On a load failure the service runtime does not crash itself to
|
| // avoid a race where the no-more-senders error on the reverse
|
| // channel esrvice thread might cause the crash-detection logic to
|
| @@ -707,17 +710,16 @@ void ServiceRuntime::LoadNexeAndStart(PP_NaClFileInfo file_info,
|
| if (NULL == reverse_service_) {
|
| // No crash detector thread.
|
| NaClLog(LOG_ERROR, "scheduling to get crash log\n");
|
| - pp::Module::Get()->core()->CallOnMainThread(0, crash_cb, PP_OK);
|
| + // Invoking rev_interface's method is workaround to avoid crash_cb
|
| + // gets called twice or more. We should clean this up later.
|
| + rev_interface_->ReportCrash();
|
| NaClLog(LOG_ERROR, "should fire soon\n");
|
| } else {
|
| NaClLog(LOG_ERROR, "Reverse service thread will pick up crash log\n");
|
| }
|
| - pp::Module::Get()->core()->CallOnMainThread(0, started_cb, PP_ERROR_FAILED);
|
| - return;
|
| }
|
| -
|
| - NaClLog(4, "ServiceRuntime::LoadNexeAndStart (return 1)\n");
|
| - pp::Module::Get()->core()->CallOnMainThread(0, started_cb, PP_OK);
|
| + pp::Module::Get()->core()->CallOnMainThread(
|
| + 0, callback, ok ? PP_OK : PP_ERROR_FAILED);
|
| }
|
|
|
| SrpcClient* ServiceRuntime::SetupAppChannel() {
|
|
|