Bug 1539045 remove unnecessary !mRealtime checks with mForcedShutDown r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 27 Mar 2019 14:11:33 +0000
changeset 466471 6c126334dae394145b53bdfc8ca684b89b949bd1
parent 466470 173bc2937a7beb6e5aa516a40000e0ee2ea1ff0d
child 466472 a51041f61c2ce198f022551dc09b0052d785b052
push id35768
push useropoprus@mozilla.com
push dateThu, 28 Mar 2019 09:55:54 +0000
treeherdermozilla-central@c045dd97faf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1539045
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1539045 remove unnecessary !mRealtime checks with mForcedShutDown r=padenot These are unnecessary because non-empty !mRealtime graphs also set mForcedShutDown before progressing to LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP. This reverts some of https://hg.mozilla.org/mozilla-central/rev/d0d427badc22afa7d5406e4e376bf27df0c0aaba#l1.72 which is possible because a non-realtime graph no longer progresses to LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP when it reaches mEndTime since https://hg.mozilla.org/mozilla-central/rev/61d08765489c#l1.41 Differential Revision: https://phabricator.services.mozilla.com/D24855
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraphImpl.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1553,22 +1553,21 @@ class MediaStreamGraphShutDownRunnable :
     // We can't block past the final LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION
     // stage, since completion of that stage requires all streams to be freed,
     // which requires shutdown to proceed.
 
     if (mGraph->IsEmpty()) {
       // mGraph is no longer needed, so delete it.
       mGraph->Destroy();
     } else {
-      // The graph is not empty.  We must be in a forced shutdown, or a
-      // non-realtime graph that has finished processing. Some later
-      // AppendMessage will detect that the graph has been emptied, and
-      // delete it.
-      NS_ASSERTION(mGraph->mForceShutDown || !mGraph->mRealtime,
-                   "Not in forced shutdown?");
+      // The graph is not empty.  We must be in a forced shutdown, either for
+      // process shutdown or a non-realtime graph that has finished
+      // processing. Some later AppendMessage will detect that the graph has
+      // been emptied, and delete it.
+      NS_ASSERTION(mGraph->mForceShutDown, "Not in forced shutdown?");
       mGraph->LifecycleStateRef() =
           MediaStreamGraphImpl::LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION;
     }
     return NS_OK;
   }
 
  private:
   RefPtr<MediaStreamGraphImpl> mGraph;
@@ -1725,17 +1724,17 @@ void MediaStreamGraphImpl::RunInStableSt
         // releasing this may shutdown a SystemClockDriver thread.
         // Proxy the release to outside of StableState.
         NS_ReleaseOnMainThreadSystemGroup("MediaStreamGraphImpl::CurrentDriver",
                                           driver.forget(),
                                           true);  // always proxy
       }
     }
 
-    if ((mForceShutDown || !mRealtime) &&
+    if (mForceShutDown &&
         LifecycleStateRef() == LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP) {
       // Defer calls to RunDuringShutdown() to happen while mMonitor is not
       // held.
       for (uint32_t i = 0; i < mBackMessageQueue.Length(); ++i) {
         MessageBlock& mb = mBackMessageQueue[i];
         controlMessagesToRunDuringShutdown.AppendElements(
             std::move(mb.mMessages));
       }
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -807,17 +807,18 @@ class MediaStreamGraphImpl : public Medi
     if (!mDetectedNotRunning) {
       mMonitor.AssertCurrentThreadOwns();
     }
 #endif
     return mLifecycleState;
   }
 
   /**
-   * True when we need to do a forced shutdown during application shutdown.
+   * True when we need to do a forced shutdown, during application shutdown or
+   * when shutting down a non-realtime graph.
    * Only set on main thread.
    * Can be read safely on the main thread, on all other threads mMonitor must
    * be held.
    */
   bool mForceShutDown;
 
   /**
    * Drop this reference during shutdown to unblock shutdown.