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 76fb5789b4794f97717eb5d86b752d9bc9e2fa74..46000ba65b2bd745d04e68285e66da33b81bd2c7 100644 |
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc |
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc |
@@ -588,6 +588,8 @@ bool ServiceRuntime::InitCommunication(nacl::DescWrapper* nacl_desc, |
return false; |
} |
out_conn_cap = NULL; // ownership passed |
+ PLUGIN_PRINTF(("ServiceRuntime::InitCommunication" |
+ " starting reverse service\n")); |
reverse_service_ = new nacl::ReverseService(conn_cap, rev_interface_->Ref()); |
if (!reverse_service_->Start()) { |
error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE, |
@@ -624,7 +626,8 @@ bool ServiceRuntime::InitCommunication(nacl::DescWrapper* nacl_desc, |
} |
bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, |
- ErrorInfo* error_info, const nacl::string& url) { |
+ ErrorInfo* error_info, const nacl::string& url, |
+ pp::CompletionCallback crash_cb) { |
PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n", |
reinterpret_cast<void*>(nacl_desc))); |
@@ -655,7 +658,22 @@ bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, |
subprocess_.reset(tmp_subprocess.release()); |
if (!InitCommunication(nacl_desc, error_info)) { |
- subprocess_.reset(NULL); |
+ // The subprocess_ member variable is needed to collect crash log |
+ // output after the error is reported. We induce a service |
+ // runtime crash here, since on a load failure the service runtime |
+ // does not crash itself to avoid the race where the |
+ // no-more-senders error on the reverse channel service thread |
+ // might cause the crash-detection logic to kick in before the |
+ // start_module RPC reply has been received. |
bbudge
2012/07/25 20:42:27
This comment is hard for me to understand. How abo
bsy
2012/07/25 22:07:23
Done.
|
+ Log(LOG_FATAL, "reap logs"); |
+ if (NULL == reverse_service_) { |
+ // No crash detector thread. |
+ PLUGIN_PRINTF(("scheduling to get crash log\n")); |
+ pp::Module::Get()->core()->CallOnMainThread(0, crash_cb, PP_OK); |
+ PLUGIN_PRINTF(("should fire soon\n")); |
+ } else { |
+ PLUGIN_PRINTF(("Reverse service thread will pick up crash log\n")); |
+ } |
return false; |
} |