зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1642849 shut down MediaTrackGraph from AudioContext when window will be destroyed r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D74814
This commit is contained in:
Родитель
7e87e93b6b
Коммит
209a34c2b7
|
@ -1137,7 +1137,7 @@ void nsGlobalWindowInner::FreeInnerObjects() {
|
|||
NotifyWindowIDDestroyed("inner-window-destroyed");
|
||||
|
||||
for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
|
||||
mAudioContexts[i]->Shutdown();
|
||||
mAudioContexts[i]->OnWindowDestroy();
|
||||
}
|
||||
mAudioContexts.Clear();
|
||||
|
||||
|
|
|
@ -743,11 +743,11 @@ nsISerialEventTarget* AudioContext::GetMainThread() const {
|
|||
|
||||
void AudioContext::DisconnectFromOwner() {
|
||||
mIsDisconnecting = true;
|
||||
Shutdown();
|
||||
OnWindowDestroy();
|
||||
DOMEventTargetHelper::DisconnectFromOwner();
|
||||
}
|
||||
|
||||
void AudioContext::Shutdown() {
|
||||
void AudioContext::OnWindowDestroy() {
|
||||
// Avoid resend the Telemetry data.
|
||||
if (!mIsShutDown) {
|
||||
MaybeUpdateAutoplayTelemetryWhenShutdown();
|
||||
|
@ -776,9 +776,18 @@ void AudioContext::Shutdown() {
|
|||
// PBrowser::Destroy() message before xpcom shutdown begins.
|
||||
ShutdownWorklet();
|
||||
|
||||
// For offline contexts, we can destroy the MediaTrackGraph at this point.
|
||||
if (mIsOffline && mDestination) {
|
||||
mDestination->OfflineShutdown();
|
||||
if (mDestination) {
|
||||
// We can destroy the MediaTrackGraph at this point.
|
||||
// Although there may be other clients using the graph, this graph is used
|
||||
// only for clients in the same window and this window is going away.
|
||||
// This will also interrupt any worklet script still running on the graph
|
||||
// thread.
|
||||
Graph()->ForceShutDown();
|
||||
// AudioDestinationNodes on rendering offline contexts have a
|
||||
// self-reference which needs removal.
|
||||
if (mIsOffline) {
|
||||
mDestination->OfflineShutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ class AudioContext final : public DOMEventTargetHelper,
|
|||
|
||||
virtual void DisconnectFromOwner() override;
|
||||
|
||||
void Shutdown(); // idempotent
|
||||
void OnWindowDestroy(); // idempotent
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
|
|
@ -488,10 +488,7 @@ void AudioDestinationNode::OfflineShutdown() {
|
|||
MOZ_ASSERT(Context() && Context()->IsOffline(),
|
||||
"Should only be called on a valid OfflineAudioContext");
|
||||
|
||||
if (mTrack) {
|
||||
mTrack->Graph()->MediaTrackGraph::ForceShutDown();
|
||||
mOfflineRenderingRef.Drop(this);
|
||||
}
|
||||
mOfflineRenderingRef.Drop(this);
|
||||
}
|
||||
|
||||
JSObject* AudioDestinationNode::WrapObject(JSContext* aCx,
|
||||
|
|
Загрузка…
Ссылка в новой задаче