mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 868409 - ScriptProcessorNode's playing ref should remain active as long as there are outstanding connections; r=roc
This commit is contained in:
parent
c3368424ee
commit
79f926cc63
@ -59,6 +59,44 @@ private:
|
||||
bool mHeld;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class SelfCountedReference {
|
||||
public:
|
||||
SelfCountedReference() : mRefCnt(0) {}
|
||||
~SelfCountedReference()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "Forgot to drop the self reference?");
|
||||
}
|
||||
|
||||
void Take(T* t)
|
||||
{
|
||||
if (mRefCnt++ == 0) {
|
||||
t->AddRef();
|
||||
}
|
||||
}
|
||||
void Drop(T* t)
|
||||
{
|
||||
if (mRefCnt > 0) {
|
||||
--mRefCnt;
|
||||
if (mRefCnt == 0) {
|
||||
t->Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
void ForceDrop(T* t)
|
||||
{
|
||||
if (mRefCnt > 0) {
|
||||
mRefCnt = 0;
|
||||
t->Release();
|
||||
}
|
||||
}
|
||||
|
||||
operator bool() const { return mRefCnt > 0; }
|
||||
|
||||
private:
|
||||
nsrefcnt mRefCnt;
|
||||
};
|
||||
|
||||
/**
|
||||
* The DOM object representing a Web Audio AudioNode.
|
||||
*
|
||||
|
@ -82,14 +82,14 @@ public:
|
||||
|
||||
void Stop()
|
||||
{
|
||||
mPlayingRef.Drop(this);
|
||||
mPlayingRef.ForceDrop(this);
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoPtr<SharedBuffers> mSharedBuffers;
|
||||
const uint32_t mBufferSize;
|
||||
const uint32_t mNumberOfOutputChannels;
|
||||
SelfReference<ScriptProcessorNode> mPlayingRef; // a reference to self while planing
|
||||
SelfCountedReference<ScriptProcessorNode> mPlayingRef; // a reference to self while planing
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user