Bug 984786 part 3: Mark refcounted classes RDFBindingSet and DataOwner as MOZ_FINAL and make their destructors private. r=bent

This commit is contained in:
Daniel Holbert 2014-04-02 01:10:42 -07:00
Родитель 73ae25ea89
Коммит c79bb6271d
2 изменённых файлов: 8 добавлений и 5 удалений

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

@ -400,7 +400,7 @@ protected:
friend class DataOwnerAdapter;
friend class nsDOMMemoryFileDataOwnerMemoryReporter;
class DataOwner : public mozilla::LinkedListElement<DataOwner> {
class DataOwner MOZ_FINAL : public mozilla::LinkedListElement<DataOwner> {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DataOwner)
DataOwner(void* aMemoryBuffer, uint64_t aLength)
@ -416,6 +416,8 @@ protected:
sDataOwners->insertBack(this);
}
private:
// Private destructor, to discourage deletion outside of Release():
~DataOwner() {
mozilla::StaticMutexAutoLock lock(sDataOwnerMutex);
@ -428,6 +430,7 @@ protected:
moz_free(mData);
}
public:
static void EnsureMemoryReporterRegistered();
// sDataOwners and sMemoryReporterRegistered may only be accessed while

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

@ -61,9 +61,11 @@ private:
* a collection of <binding> descriptors. This object is refcounted by
* nsBindingValues objects and the query processor.
*/
class RDFBindingSet
class RDFBindingSet MOZ_FINAL
{
protected:
private:
// Private destructor, to discourage deletion outside of Release():
~RDFBindingSet();
// the number of bindings
int32_t mCount;
@ -80,8 +82,6 @@ public:
MOZ_COUNT_CTOR(RDFBindingSet);
}
~RDFBindingSet();
NS_INLINE_DECL_REFCOUNTING(RDFBindingSet)
int32_t Count() const { return mCount; }