bug 1224022 don't try to wake up an empty MSG that is shutting down to report memory r?padenot draft
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 04 Jul 2016 20:55:29 +1200
changeset 383466 cce2431572b3d148458b46a3cffdd6efcbb4cd79
parent 383460 decc9755fcc57a56d10f22ed9fbb1d6af528b668
child 383467 020bc4aafa02a3241c8ddebd320655bfa39a9feb
push id22037
push userktomlinson@mozilla.com
push dateMon, 04 Jul 2016 08:58:23 +0000
reviewerspadenot
bugs1224022
milestone50.0a1
bug 1224022 don't try to wake up an empty MSG that is shutting down to report memory r?padenot MozReview-Commit-ID: 306Vq4YXTjU
dom/media/MediaStreamGraph.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -3442,37 +3442,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;
       }
     }