Bug 1359309. P2 - dump the name of the TaskQueue when Dispatch() fails. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 25 Apr 2017 15:08:23 +0800
changeset 569299 e2e4f7c96a3362bd6bf94524c210f4a5bb5b0ceb
parent 569298 31efb95993e8b125982daada6e1516c42890bcbb
child 626172 5317b942555d0a5d01a0e14e319bdff478f62ead
push id56135
push userjwwang@mozilla.com
push dateThu, 27 Apr 2017 09:52:57 +0000
bugs1359309
milestone55.0a1
Bug 1359309. P2 - dump the name of the TaskQueue when Dispatch() fails. MozReview-Commit-ID: AqGviaekwRa
xpcom/threads/TaskQueue.h
--- a/xpcom/threads/TaskQueue.h
+++ b/xpcom/threads/TaskQueue.h
@@ -64,17 +64,21 @@ public:
   void Dispatch(already_AddRefed<nsIRunnable> aRunnable,
                 DispatchFailureHandling aFailureHandling = AssertDispatchSuccess,
                 DispatchReason aReason = NormalDispatch) override
   {
     nsCOMPtr<nsIRunnable> r = aRunnable;
     {
       MonitorAutoLock mon(mQueueMonitor);
       nsresult rv = DispatchLocked(/* passed by ref */r, aFailureHandling, aReason);
-      MOZ_DIAGNOSTIC_ASSERT(aFailureHandling == DontAssertDispatchSuccess || NS_SUCCEEDED(rv));
+#if defined(DEBUG) || !defined(RELEASE_OR_BETA) || defined(EARLY_BETA_OR_EARLIER)
+      if (NS_FAILED(rv) && aFailureHandling == AssertDispatchSuccess) {
+        MOZ_CRASH_UNSAFE_PRINTF("%s: Dispatch failed. rv=%x", mName, uint32_t(rv));
+      }
+#endif
       Unused << rv;
     }
     // If the ownership of |r| is not transferred in DispatchLocked() due to
     // dispatch failure, it will be deleted here outside the lock. We do so
     // since the destructor of the runnable might access TaskQueue and result
     // in deadlocks.
   }