Bug 1577537 - Exit MediaStreamGraphImpl::CollectReports early when there are no streams. r=padenot a=lizzard
authorAndreas Pehrson <apehrson@mozilla.com>
Mon, 02 Sep 2019 14:58:03 +0000
changeset 554858 afa5bb926fd849b7a9a5546f8678c32bc89d2aa8
parent 554857 33fcfe8d6d41f73bc90e4263ae022338db0fb105
child 554859 8773fdb19225d595eb2f27ced37d50777a743a48
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot, lizzard
bugs1577537
milestone70.0
Bug 1577537 - Exit MediaStreamGraphImpl::CollectReports early when there are no streams. r=padenot a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D44369
dom/media/MediaStreamGraph.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -3348,23 +3348,20 @@ void MediaStreamGraph::DestroyNonRealtim
 
 NS_IMPL_ISUPPORTS(MediaStreamGraphImpl, nsIMemoryReporter, nsITimerCallback,
                   nsINamed)
 
 NS_IMETHODIMP
 MediaStreamGraphImpl::CollectReports(nsIHandleReportCallback* aHandleReport,
                                      nsISupports* aData, bool aAnonymize) {
   MOZ_ASSERT(NS_IsMainThread());
-  {
-    MonitorAutoLock mon(mMonitor);
-    if (LifecycleStateRef() >= LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN) {
-      // Shutting down, nothing to report.
-      FinishCollectReports(aHandleReport, aData, nsTArray<AudioNodeSizes>());
-      return NS_OK;
-    }
+  if (mMainThreadStreamCount == 0) {
+    // No streams to report.
+    FinishCollectReports(aHandleReport, aData, nsTArray<AudioNodeSizes>());
+    return NS_OK;
   }
 
   class Message final : public ControlMessage {
    public:
     Message(MediaStreamGraphImpl* aGraph,
             nsIHandleReportCallback* aHandleReport, nsISupports* aHandlerData)
         : ControlMessage(nullptr),
           mGraph(aGraph),