зеркало из https://github.com/mozilla/gecko-dev.git
bug 1210267 use DOMEventTargetHelper::LastRelease instead of custom Release r=baku
AudioNode already has NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE, which performs mRefCnt.incr/decr for LastRelease(), so the kungFuDeathGrip virtual AddRef/Release in DisconnectFromGraph() is additional noise when debugging/tracing ownership. Unlink() already assumes that the caller holds a reference (and it does). --HG-- extra : rebase_source : 2ecfb16a89524588979365cfe3078df91724dad3
This commit is contained in:
Родитель
466bac9d98
Коммит
fcc5b0442a
|
@ -37,19 +37,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(AudioNode,
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(AudioNode, DOMEventTargetHelper)
|
||||
|
||||
NS_IMETHODIMP_(MozExternalRefCountType)
|
||||
AudioNode::Release()
|
||||
{
|
||||
if (mRefCnt.get() == 1) {
|
||||
// We are about to be deleted, disconnect the object from the graph before
|
||||
// the derived type is destroyed.
|
||||
DisconnectFromGraph();
|
||||
}
|
||||
nsrefcnt r = DOMEventTargetHelper::Release();
|
||||
NS_LOG_RELEASE(this, r, "AudioNode");
|
||||
return r;
|
||||
}
|
||||
NS_IMPL_RELEASE_INHERITED(AudioNode, DOMEventTargetHelper)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AudioNode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
|
@ -150,9 +138,8 @@ FindIndexOfNodeWithPorts(const nsTArray<InputNode>& aInputNodes, const AudioNode
|
|||
void
|
||||
AudioNode::DisconnectFromGraph()
|
||||
{
|
||||
// Addref this temporarily so the refcount bumping below doesn't destroy us
|
||||
// prematurely
|
||||
nsRefPtr<AudioNode> kungFuDeathGrip = this;
|
||||
MOZ_ASSERT(mRefCnt.get() > mInputNodes.Length(),
|
||||
"Caller should be holding a reference");
|
||||
|
||||
// The idea here is that we remove connections one by one, and at each step
|
||||
// the graph is in a valid state.
|
||||
|
|
|
@ -211,7 +211,13 @@ public:
|
|||
virtual const char* NodeType() const = 0;
|
||||
|
||||
private:
|
||||
// This could possibly delete 'this'.
|
||||
virtual void LastRelease() override
|
||||
{
|
||||
// We are about to be deleted, disconnect the object from the graph before
|
||||
// the derived type is destroyed.
|
||||
DisconnectFromGraph();
|
||||
}
|
||||
// Callers must hold a reference to 'this'.
|
||||
void DisconnectFromGraph();
|
||||
|
||||
protected:
|
||||
|
|
Загрузка…
Ссылка в новой задаче