mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=914030 don't keep alive used AudioContexts from the window r=ehsan,bz
--HG-- extra : transplant_source : %9D%94%FF%AA%92%C7%5B8%FA%C7%DD%3A%E3W%9E%BD%7F%25%5C%19
This commit is contained in:
parent
91b88fa3bd
commit
5751aaa536
@ -63,11 +63,16 @@ AudioContext::AudioContext(nsPIDOMWindow* aWindow,
|
||||
// Actually play audio
|
||||
mDestination->Stream()->AddAudioOutput(&gWebAudioOutputKey);
|
||||
nsDOMEventTargetHelper::BindToOwner(aWindow);
|
||||
aWindow->AddAudioContext(this);
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
AudioContext::~AudioContext()
|
||||
{
|
||||
nsPIDOMWindow* window = GetOwner();
|
||||
if (window) {
|
||||
window->RemoveAudioContext(this);
|
||||
}
|
||||
}
|
||||
|
||||
JSObject*
|
||||
@ -91,7 +96,6 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
nsRefPtr<AudioContext> object = new AudioContext(window, false);
|
||||
window->AddAudioContext(object);
|
||||
return object.forget();
|
||||
}
|
||||
|
||||
@ -123,7 +127,6 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
|
||||
aNumberOfChannels,
|
||||
aLength,
|
||||
aSampleRate);
|
||||
window->AddAudioContext(object);
|
||||
return object.forget();
|
||||
}
|
||||
|
||||
|
@ -1387,6 +1387,11 @@ nsGlobalWindow::CleanUp()
|
||||
|
||||
CleanupCachedXBLHandlers(this);
|
||||
|
||||
for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
|
||||
mAudioContexts[i]->Shutdown();
|
||||
}
|
||||
mAudioContexts.Clear();
|
||||
|
||||
if (mIdleTimer) {
|
||||
mIdleTimer->Cancel();
|
||||
mIdleTimer = nullptr;
|
||||
@ -1651,7 +1656,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFocusedNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAudioContexts)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMenubar)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mToolbar)
|
||||
@ -1706,7 +1710,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParentTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFocusedNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAudioContexts)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMenubar)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mToolbar)
|
||||
@ -3258,6 +3261,12 @@ nsPIDOMWindow::AddAudioContext(AudioContext* aAudioContext)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsPIDOMWindow::RemoveAudioContext(AudioContext* aAudioContext)
|
||||
{
|
||||
mAudioContexts.RemoveElement(aAudioContext);
|
||||
}
|
||||
|
||||
void
|
||||
nsPIDOMWindow::MuteAudioContexts()
|
||||
{
|
||||
|
@ -612,6 +612,7 @@ public:
|
||||
const nsAString& aOptions, nsIDOMWindow **_retval) = 0;
|
||||
|
||||
void AddAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
||||
void RemoveAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
||||
void MuteAudioContexts();
|
||||
void UnmuteAudioContexts();
|
||||
|
||||
@ -708,7 +709,7 @@ protected:
|
||||
nsCOMPtr<nsIContent> mFocusedNode;
|
||||
|
||||
// The AudioContexts created for the current document, if any.
|
||||
nsTArray<nsRefPtr<mozilla::dom::AudioContext> > mAudioContexts;
|
||||
nsTArray<mozilla::dom::AudioContext*> mAudioContexts; // Weak
|
||||
|
||||
// A unique (as long as our 64-bit counter doesn't roll over) id for
|
||||
// this window.
|
||||
|
Loading…
Reference in New Issue
Block a user