Bug 984786 part 5: Give NS_INLINE_DECL_*REFCOUNTING classes private/protected destructor & MOZ_FINAL annotation where appropriate, in /content/media. r=kinetik

This commit is contained in:
Daniel Holbert 2014-04-02 09:21:11 -07:00
Родитель 6ede97af2d
Коммит 0a7b04c924
7 изменённых файлов: 47 добавлений и 18 удалений

Просмотреть файл

@ -85,7 +85,7 @@ public:
// Represents a change yet to be made to a block in the file. The change
// is either a write (and the data to be written is stored in this struct)
// or a move (and the index of the source block is stored instead).
struct BlockChange {
struct BlockChange MOZ_FINAL {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BlockChange)
@ -113,6 +113,12 @@ public:
return mSourceBlockIndex == -1 &&
mData.get() != nullptr;
}
private:
// Private destructor, to discourage deletion outside of Release():
~BlockChange()
{
}
};
class Int32Queue : private nsDeque {

Просмотреть файл

@ -89,9 +89,11 @@ class MediaStreamGraph;
* attached to a stream that has already finished, we'll call NotifyFinished.
*/
class MediaStreamListener {
public:
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~MediaStreamListener() {}
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaStreamListener)
enum Consumption {
@ -291,6 +293,9 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaStream)
MediaStream(DOMMediaStream* aWrapper);
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~MediaStream()
{
MOZ_COUNT_DTOR(MediaStream);
@ -299,6 +304,7 @@ public:
"All main thread listeners should have been removed");
}
public:
/**
* Returns the graph that owns this stream.
*/
@ -810,7 +816,8 @@ protected:
* the Destroy message is processed on the graph manager thread we disconnect
* the port and drop the graph's reference, destroying the object.
*/
class MediaInputPort {
class MediaInputPort MOZ_FINAL {
private:
// Do not call this constructor directly. Instead call aDest->AllocateInputPort.
MediaInputPort(MediaStream* aSource, ProcessedMediaStream* aDest,
uint32_t aFlags, uint16_t aInputNumber,
@ -825,6 +832,12 @@ class MediaInputPort {
MOZ_COUNT_CTOR(MediaInputPort);
}
// Private destructor, to discourage deletion outside of Release():
~MediaInputPort()
{
MOZ_COUNT_DTOR(MediaInputPort);
}
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaInputPort)
@ -841,10 +854,6 @@ public:
// stream.
FLAG_BLOCK_OUTPUT = 0x02
};
~MediaInputPort()
{
MOZ_COUNT_DTOR(MediaInputPort);
}
// Called on graph manager thread
// Do not call these from outside MediaStreamGraph.cpp!
@ -886,7 +895,7 @@ public:
*/
void SetGraphImpl(MediaStreamGraphImpl* aGraph);
protected:
private:
friend class MediaStreamGraphImpl;
friend class MediaStream;
friend class ProcessedMediaStream;

Просмотреть файл

@ -19,6 +19,9 @@ namespace mozilla {
class ThreadSharedObject {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ThreadSharedObject)
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~ThreadSharedObject() {}
};

Просмотреть файл

@ -38,7 +38,7 @@ private:
};
// Represent one encoded frame
class EncodedFrame
class EncodedFrame MOZ_FINAL
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EncodedFrame)
public:
@ -90,6 +90,11 @@ public:
FrameType GetFrameType() const { return mFrameType; }
void SetFrameType(FrameType aFrameType) { mFrameType = aFrameType; }
private:
// Private destructor, to discourage deletion outside of Release():
~EncodedFrame()
{
}
// Encoded data
nsTArray<uint8_t> mFrameData;
uint64_t mTimeStamp;

Просмотреть файл

@ -24,9 +24,12 @@ public:
METADATA_AMR,
METADATA_UNKNOWN // Metadata Kind not set
};
virtual ~TrackMetadataBase() {}
// Return the specific metadata kind
virtual MetadataKind GetKind() const = 0;
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~TrackMetadataBase() {}
};
// The base class for audio metadata.

Просмотреть файл

@ -182,7 +182,7 @@ private:
uint32_t mSkipBytes;
};
class WebMBufferedState
class WebMBufferedState MOZ_FINAL
{
NS_INLINE_DECL_REFCOUNTING(WebMBufferedState)
@ -191,15 +191,16 @@ public:
MOZ_COUNT_CTOR(WebMBufferedState);
}
~WebMBufferedState() {
MOZ_COUNT_DTOR(WebMBufferedState);
}
void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset);
bool CalculateBufferedForRange(int64_t aStartOffset, int64_t aEndOffset,
uint64_t* aStartTime, uint64_t* aEndTime);
private:
// Private destructor, to discourage deletion outside of Release():
~WebMBufferedState() {
MOZ_COUNT_DTOR(WebMBufferedState);
}
// Synchronizes access to the mTimeMapping array.
ReentrantMonitor mReentrantMonitor;

Просмотреть файл

@ -67,8 +67,12 @@ namespace dom {
// VoiceData
class VoiceData
class VoiceData MOZ_FINAL
{
private:
// Private destructor, to discourage deletion outside of Release():
~VoiceData() {}
public:
VoiceData(nsISpeechService* aService, const nsAString& aUri,
const nsAString& aName, const nsAString& aLang, bool aIsLocal)
@ -78,8 +82,6 @@ public:
, mLang(aLang)
, mIsLocal(aIsLocal) {}
~VoiceData() {}
NS_INLINE_DECL_REFCOUNTING(VoiceData)
nsCOMPtr<nsISpeechService> mService;