Bug 1035394 - Fix dangerous public destructors in content/media/webaudio - r=padenot

This commit is contained in:
Benoit Jacob 2014-07-08 17:23:17 -04:00
parent 8997778c9d
commit aafaf01cc6
29 changed files with 97 additions and 7 deletions

View File

@ -61,6 +61,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
~AnalyserNode() {}
private:
friend class AnalyserNodeEngine;
void AppendChunk(const AudioChunk& aChunk);

View File

@ -20,7 +20,6 @@ class AudioBufferSourceNode : public AudioNode,
{
public:
explicit AudioBufferSourceNode(AudioContext* aContext);
virtual ~AudioBufferSourceNode();
virtual void DestroyMediaStream() MOZ_OVERRIDE
{
@ -101,6 +100,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~AudioBufferSourceNode();
private:
friend class AudioBufferSourceNodeEngine;
// START is sent during Start().

View File

@ -318,6 +318,10 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
}
}
AudioDestinationNode::~AudioDestinationNode()
{
}
size_t
AudioDestinationNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

View File

@ -83,6 +83,9 @@ public:
void InputMuted(bool aInputMuted);
protected:
virtual ~AudioDestinationNode();
private:
bool CheckAudioChannelPermissions(AudioChannel aValue);
void CreateAudioChannelAgent();

View File

@ -31,6 +31,10 @@ AudioProcessingEvent::AudioProcessingEvent(ScriptProcessorNode* aOwner,
SetIsDOMBinding();
}
AudioProcessingEvent::~AudioProcessingEvent()
{
}
JSObject*
AudioProcessingEvent::WrapObject(JSContext* aCx)
{

View File

@ -63,6 +63,9 @@ public:
return !!mOutputBuffer;
}
protected:
virtual ~AudioProcessingEvent();
private:
already_AddRefed<AudioBuffer>
LazilyCreateBuffer(uint32_t aNumberOfChannels, ErrorResult& rv);

View File

@ -258,6 +258,9 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
}
BiquadFilterNode::~BiquadFilterNode()
{
}
size_t
BiquadFilterNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const

View File

@ -64,6 +64,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~BiquadFilterNode();
private:
static void SendFrequencyToStream(AudioNode* aNode);
static void SendDetuneToStream(AudioNode* aNode);

View File

@ -77,6 +77,10 @@ ChannelMergerNode::ChannelMergerNode(AudioContext* aContext,
MediaStreamGraph::INTERNAL_STREAM);
}
ChannelMergerNode::~ChannelMergerNode()
{
}
JSObject*
ChannelMergerNode::WrapObject(JSContext* aCx)
{

View File

@ -36,6 +36,9 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
protected:
virtual ~ChannelMergerNode();
private:
const uint16_t mInputCount;
};

View File

@ -64,6 +64,10 @@ ChannelSplitterNode::ChannelSplitterNode(AudioContext* aContext,
MediaStreamGraph::INTERNAL_STREAM);
}
ChannelSplitterNode::~ChannelSplitterNode()
{
}
JSObject*
ChannelSplitterNode::WrapObject(JSContext* aCx)
{

View File

@ -36,6 +36,9 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
protected:
virtual ~ChannelSplitterNode();
private:
const uint16_t mOutputCount;
};

View File

@ -194,6 +194,10 @@ ConvolverNode::ConvolverNode(AudioContext* aContext)
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
}
ConvolverNode::~ConvolverNode()
{
}
size_t
ConvolverNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

View File

@ -62,6 +62,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~ConvolverNode();
private:
nsRefPtr<AudioBuffer> mBuffer;
bool mNormalize;

View File

@ -201,6 +201,10 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
}
DelayNode::~DelayNode()
{
}
size_t
DelayNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

View File

@ -43,6 +43,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~DelayNode();
private:
static void SendDelayToStream(AudioNode* aNode);
friend class DelayNodeEngine;

View File

@ -222,6 +222,10 @@ DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
}
DynamicsCompressorNode::~DynamicsCompressorNode()
{
}
size_t
DynamicsCompressorNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

View File

@ -64,6 +64,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~DynamicsCompressorNode();
private:
static void SendThresholdToStream(AudioNode* aNode);
static void SendKneeToStream(AudioNode* aNode);

View File

@ -133,6 +133,10 @@ GainNode::GainNode(AudioContext* aContext)
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
}
GainNode::~GainNode()
{
}
size_t
GainNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

View File

@ -38,6 +38,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~GainNode();
private:
static void SendGainToStream(AudioNode* aNode);

View File

@ -86,6 +86,10 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* a
}
}
MediaStreamAudioDestinationNode::~MediaStreamAudioDestinationNode()
{
}
size_t
MediaStreamAudioDestinationNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

View File

@ -42,6 +42,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~MediaStreamAudioDestinationNode();
private:
nsRefPtr<DOMMediaStream> mDOMStream;
nsRefPtr<MediaInputPort> mPort;

View File

@ -44,7 +44,6 @@ class MediaStreamAudioSourceNode : public AudioNode,
{
public:
MediaStreamAudioSourceNode(AudioContext* aContext, DOMMediaStream* aMediaStream);
virtual ~MediaStreamAudioSourceNode();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaStreamAudioSourceNode, AudioNode)
@ -65,6 +64,9 @@ public:
virtual void PrincipalChanged(DOMMediaStream* aMediaStream) MOZ_OVERRIDE;
protected:
virtual ~MediaStreamAudioSourceNode();
private:
nsRefPtr<MediaInputPort> mInputPort;
nsRefPtr<DOMMediaStream> mInputStream;

View File

@ -28,6 +28,10 @@ OfflineAudioCompletionEvent::OfflineAudioCompletionEvent(AudioContext* aOwner,
SetIsDOMBinding();
}
OfflineAudioCompletionEvent::~OfflineAudioCompletionEvent()
{
}
JSObject*
OfflineAudioCompletionEvent::WrapObject(JSContext* aCx)
{

View File

@ -39,6 +39,9 @@ public:
return mRenderedBuffer;
}
protected:
virtual ~OfflineAudioCompletionEvent();
private:
nsRefPtr<AudioBuffer> mRenderedBuffer;
};

View File

@ -23,7 +23,6 @@ class OscillatorNode : public AudioNode,
{
public:
explicit OscillatorNode(AudioContext* aContext);
virtual ~OscillatorNode();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(OscillatorNode, AudioNode)
@ -89,6 +88,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~OscillatorNode();
private:
static void SendFrequencyToStream(AudioNode* aNode);
static void SendDetuneToStream(AudioNode* aNode);

View File

@ -27,8 +27,6 @@ class PannerNode : public AudioNode,
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(PannerNode)
explicit PannerNode(AudioContext* aContext);
virtual ~PannerNode();
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
@ -205,6 +203,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~PannerNode();
private:
friend class AudioListener;
friend class PannerNodeEngine;

View File

@ -23,7 +23,6 @@ public:
uint32_t aBufferSize,
uint32_t aNumberOfInputChannels,
uint32_t aNumberOfOutputChannels);
virtual ~ScriptProcessorNode();
NS_DECL_ISUPPORTS_INHERITED
@ -97,6 +96,9 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
protected:
virtual ~ScriptProcessorNode();
private:
nsAutoPtr<SharedBuffers> mSharedBuffers;
const uint32_t mBufferSize;

View File

@ -20,7 +20,6 @@ class WaveShaperNode : public AudioNode
{
public:
explicit WaveShaperNode(AudioContext *aContext);
virtual ~WaveShaperNode();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(WaveShaperNode, AudioNode)
@ -59,6 +58,9 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
protected:
virtual ~WaveShaperNode();
private:
void ClearCurve();