Bug 1539039 shutdown worklet from AudioContext::Shutdown() r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 29 Mar 2019 16:11:59 +0000
changeset 526328 f3098fb60d80e9de86714d5f14f12fb2e55351e8
parent 526327 973f69d0a81036de9a73b4980755b9bfaa1873f1
child 526329 62a25408f9eaacd585cc921e3d6c25b0898b559b
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1539039
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 1539039 shutdown worklet from AudioContext::Shutdown() r=padenot On process shutdown, the MSG is shut down (and so are other threads) before the final main thread cycle collection, and so we can't depend on unlink to notify the worklet before MSG shutdown. Depends on D25351 Differential Revision: https://phabricator.services.mozilla.com/D25352
dom/media/webaudio/AudioContext.cpp
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -708,16 +708,22 @@ void AudioContext::Shutdown() {
     mPendingResumePromises.Clear();
   }
 
   // Release references to active nodes.
   // Active AudioNodes don't unregister in destructors, at which point the
   // Node is already unregistered.
   mActiveNodes.Clear();
 
+  // On process shutdown, the MSG thread shuts down before the destination
+  // stream is destroyed, but AudioWorklet needs to release objects on the MSG
+  // thread.  AudioContext::Shutdown() is invoked on processing the
+  // PBrowser::Destroy() message before xpcom shutdown begins.
+  ShutdownWorklet();
+
   // For offline contexts, we can destroy the MediaStreamGraph at this point.
   if (mIsOffline && mDestination) {
     mDestination->OfflineShutdown();
   }
 }
 
 StateChangeTask::StateChangeTask(AudioContext* aAudioContext, void* aPromise,
                                  AudioContextState aNewState)