зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625372 shut down MediaTrackGraph from AudioContext when window will be destroyed r=padenot
Depends on D74813 Differential Revision: https://phabricator.services.mozilla.com/D74814
This commit is contained in:
Родитель
989d1fc6db
Коммит
ef208899b1
|
@ -1135,7 +1135,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();
|
||||
|
||||
|
|
|
@ -741,7 +741,7 @@ nsISerialEventTarget* AudioContext::GetMainThread() const {
|
|||
|
||||
void AudioContext::DisconnectFromOwner() {
|
||||
mIsDisconnecting = true;
|
||||
Shutdown();
|
||||
OnWindowDestroy();
|
||||
DOMEventTargetHelper::DisconnectFromOwner();
|
||||
}
|
||||
|
||||
|
@ -759,7 +759,7 @@ void AudioContext::BindToOwner(nsIGlobalObject* aNew) {
|
|||
}
|
||||
}
|
||||
|
||||
void AudioContext::Shutdown() {
|
||||
void AudioContext::OnWindowDestroy() {
|
||||
// Avoid resend the Telemetry data.
|
||||
if (!mIsShutDown) {
|
||||
MaybeUpdateAutoplayTelemetryWhenShutdown();
|
||||
|
@ -788,9 +788,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ class AudioContext final : public DOMEventTargetHelper,
|
|||
virtual void DisconnectFromOwner() override;
|
||||
virtual void BindToOwner(nsIGlobalObject* aNew) override;
|
||||
|
||||
void Shutdown(); // idempotent
|
||||
void OnWindowDestroy(); // idempotent
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
|
|
@ -498,10 +498,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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче