bug 1242268 don't try to wake up an empty MSG that is shutting down to report memory r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 04 Jul 2016 20:55:29 +1200
changeset 331197 20c9343e899cd674fc309180dbcbef69245123e1
parent 331196 0c21f0c5a2964f384d37e29f98a7489901741218
child 331198 3640f261f9e0f3485fbc897317260aa9e2ded851
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1242268
milestone50.0a1
bug 1242268 don't try to wake up an empty MSG that is shutting down to report memory r=padenot MozReview-Commit-ID: IWNUjWijukk
dom/media/MediaStreamGraph.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -3501,37 +3501,37 @@ struct ArrayClearer
   ~ArrayClearer() { mArray.Clear(); }
   nsTArray<AudioNodeSizes>& mArray;
 };
 
 NS_IMETHODIMP
 MediaStreamGraphImpl::CollectReports(nsIHandleReportCallback* aHandleReport,
                                      nsISupports* aData, bool aAnonymize)
 {
+  if (mLifecycleState >= LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN) {
+    // Shutting down, nothing to report.
+    return NS_OK;
+  }
+
   // Clears out the report array after we're done with it.
   ArrayClearer reportCleanup(mAudioStreamSizes);
 
   {
     MonitorAutoLock memoryReportLock(mMemoryReportMonitor);
     mNeedsMemoryReport = true;
 
     {
       // Wake up the MSG thread if it's real time (Offline graphs can't be
       // sleeping).
       MonitorAutoLock monitorLock(mMonitor);
       if (!CurrentDriver()->AsOfflineClockDriver()) {
         CurrentDriver()->WakeUp();
       }
     }
 
-    if (mLifecycleState >= LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN) {
-      // Shutting down, nothing to report.
-      return NS_OK;
-    }
-
     // Wait for up to one second for the report to complete.
     nsresult rv;
     const PRIntervalTime kMaxWait = PR_SecondsToInterval(1);
     while ((rv = memoryReportLock.Wait(kMaxWait)) != NS_OK) {
       if (PR_GetError() != PR_PENDING_INTERRUPT_ERROR) {
         return rv;
       }
     }