b=916680 don't keep active AudioNodes alive from an AudioContext that has shut down r=ehsan

--HG--
extra : transplant_source : %20%3Fl%E0%D7R%7B_%E6%B0%C7%BB%3A%E7%21%9D%F1%A2%F4%1C
This commit is contained in:
Karl Tomlinson 2013-09-18 13:10:30 +12:00
parent fac25b8e05
commit d1696dd567
2 changed files with 7 additions and 1 deletions

View File

@ -60,6 +60,7 @@ AudioContext::AudioContext(nsPIDOMWindow* aWindow,
, mNumberOfChannels(aNumberOfChannels)
, mIsOffline(aIsOffline)
, mIsStarted(!aIsOffline)
, mIsShutDown(false)
{
// Actually play audio
mDestination->Stream()->AddAudioOutput(&gWebAudioOutputKey);
@ -443,8 +444,10 @@ AudioContext::RemoveFromDecodeQueue(WebAudioDecodeJob* aDecodeJob)
void
AudioContext::RegisterActiveNode(AudioNode* aNode)
{
if (!mIsShutDown) {
mActiveNodes.PutEntry(aNode);
}
}
void
AudioContext::UnregisterActiveNode(AudioNode* aNode)
@ -536,6 +539,8 @@ GetHashtableElements(nsTHashtable<nsPtrHashKey<T> >& aHashtable, nsTArray<T*>& a
void
AudioContext::Shutdown()
{
mIsShutDown = true;
Suspend();
// Release references to active nodes.

View File

@ -270,6 +270,7 @@ private:
uint32_t mNumberOfChannels;
bool mIsOffline;
bool mIsStarted;
bool mIsShutDown;
};
}