Bug 1037691 - Fix instances where refcounted classes expose a public destructor. r=ehsan,bent,mayhemer,jrmuizel

This commit is contained in:
Benoit Girard 2014-07-15 11:37:45 -04:00
parent af1d060475
commit e7aea75462
69 changed files with 259 additions and 33 deletions

View File

@ -9,6 +9,16 @@
#include "nsAttrValue.h"
struct MiscContainer;
namespace mozilla {
template<>
struct HasDangerousPublicDestructor<MiscContainer>
{
static const bool value = true;
};
}
struct MiscContainer
{
typedef nsAttrValue::ValueType ValueType;
@ -93,7 +103,6 @@ struct MiscContainer
void Evict();
};
/**
* Implementation of inline methods
*/

View File

@ -1463,11 +1463,13 @@ public:
MOZ_COUNT_CTOR(SelectorCacheKeyDeleter);
}
protected:
~SelectorCacheKeyDeleter()
{
MOZ_COUNT_DTOR(SelectorCacheKeyDeleter);
}
public:
NS_IMETHOD Run()
{
return NS_OK;

View File

@ -24,8 +24,10 @@ namespace mozilla {
class AudioNodeExternalInputStream : public AudioNodeStream {
public:
AudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate);
protected:
~AudioNodeExternalInputStream();
public:
virtual void ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) MOZ_OVERRIDE;
private:

View File

@ -65,8 +65,11 @@ public:
mHasCurrentData = true;
MOZ_COUNT_CTOR(AudioNodeStream);
}
protected:
~AudioNodeStream();
public:
// Control API
/**
* Sets a parameter that's a time relative to some stream's played time.

View File

@ -33,11 +33,13 @@ public:
MOZ_COUNT_CTOR(BufferMediaResource);
}
protected:
virtual ~BufferMediaResource()
{
MOZ_COUNT_DTOR(BufferMediaResource);
}
private:
virtual nsresult Close() { return NS_OK; }
virtual void Suspend(bool aCloseImmediately) {}
virtual void Resume() {}

View File

@ -56,8 +56,10 @@ public:
FileBlockCache();
protected:
~FileBlockCache();
public:
// Assumes ownership of aFD.
nsresult Open(PRFileDesc* aFD);

View File

@ -104,10 +104,12 @@ private:
{
MOZ_COUNT_CTOR(DeliverAudioTask);
}
protected:
~DeliverAudioTask()
{
MOZ_COUNT_DTOR(DeliverAudioTask);
}
public:
NS_METHOD Run() {
mTarget->OnAudioDecoded(mSample.forget());
return NS_OK;
@ -125,10 +127,12 @@ private:
{
MOZ_COUNT_CTOR(DeliverVideoTask);
}
protected:
~DeliverVideoTask()
{
MOZ_COUNT_DTOR(DeliverVideoTask);
}
public:
NS_METHOD Run() {
mTarget->OnVideoDecoded(mSample.forget());
return NS_OK;

View File

@ -1639,11 +1639,13 @@ public:
MOZ_COUNT_CTOR(DispatchBytesConsumedEvent);
}
protected:
~DispatchBytesConsumedEvent()
{
MOZ_COUNT_DTOR(DispatchBytesConsumedEvent);
}
public:
NS_IMETHOD Run() {
mDecoder->NotifyBytesConsumed(mNumBytes, mOffset);
// Drop ref to decoder on main thread, just in case this reference

View File

@ -192,8 +192,10 @@ private:
public:
SourceBufferResource(nsIPrincipal* aPrincipal,
const nsACString& aType);
protected:
~SourceBufferResource();
public:
virtual nsresult Close() MOZ_OVERRIDE;
virtual void Suspend(bool aCloseImmediately) MOZ_OVERRIDE {}
virtual void Resume() MOZ_OVERRIDE {}

View File

@ -49,8 +49,11 @@ class OggReader : public MediaDecoderReader
{
public:
OggReader(AbstractMediaDecoder* aDecoder);
protected:
~OggReader();
public:
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
virtual nsresult ResetDecode();
virtual bool DecodeAudioData();

View File

@ -15,8 +15,11 @@ class RawReader : public MediaDecoderReader
{
public:
RawReader(AbstractMediaDecoder* aDecoder);
protected:
~RawReader();
public:
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
virtual nsresult ResetDecode();
virtual bool DecodeAudioData();

View File

@ -21,8 +21,11 @@ class WaveReader : public MediaDecoderReader
{
public:
WaveReader(AbstractMediaDecoder* aDecoder);
protected:
~WaveReader();
public:
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
virtual bool DecodeAudioData();
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,

View File

@ -105,8 +105,11 @@ class WebMReader : public MediaDecoderReader
{
public:
WebMReader(AbstractMediaDecoder* aDecoder);
protected:
~WebMReader();
public:
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
virtual nsresult ResetDecode();
virtual bool DecodeAudioData();

View File

@ -86,11 +86,13 @@ protected:
public:
List() { MOZ_COUNT_CTOR(MemoryElementSet::List); }
protected:
~List() {
MOZ_COUNT_DTOR(MemoryElementSet::List);
delete mElement;
NS_IF_RELEASE(mNext); }
public:
int32_t AddRef() { return ++mRefCnt; }
int32_t Release() {
@ -231,10 +233,13 @@ protected:
List(const nsAssignment &aAssignment) : mAssignment(aAssignment) {
MOZ_COUNT_CTOR(nsAssignmentSet::List); }
protected:
~List() {
MOZ_COUNT_DTOR(nsAssignmentSet::List);
NS_IF_RELEASE(mNext); }
public:
int32_t AddRef() { return ++mRefCnt; }
int32_t Release() {

View File

@ -56,8 +56,10 @@ public:
ArchiveReaderEvent(ArchiveReader* aArchiveReader);
protected:
virtual ~ArchiveReaderEvent();
public:
// This must be implemented
virtual nsresult Exec() = 0;

View File

@ -29,6 +29,7 @@ public:
MOZ_COUNT_CTOR(ArchiveRequestEvent);
}
protected:
~ArchiveRequestEvent()
{
MOZ_COUNT_DTOR(ArchiveRequestEvent);

View File

@ -24,8 +24,10 @@ public:
ArchiveZipItem(const char* aFilename,
const ZipCentral& aCentralStruct,
const nsACString& aEncoding);
protected:
virtual ~ArchiveZipItem();
public:
nsresult GetFilename(nsString& aFilename) MOZ_OVERRIDE;
// From zipItem to DOMFile:

View File

@ -1116,6 +1116,7 @@ public:
MOZ_COUNT_CTOR(SingleProcessRunnable);
}
protected:
~SingleProcessRunnable()
{
MOZ_COUNT_DTOR(SingleProcessRunnable);
@ -1370,6 +1371,7 @@ public:
MOZ_COUNT_CTOR(ChildProcessRunnable);
}
protected:
~ChildProcessRunnable()
{
MOZ_ASSERT(mState == eFinished);

View File

@ -7839,12 +7839,14 @@ class PostMessageEvent : public nsRunnable
{
MOZ_COUNT_CTOR(PostMessageEvent);
}
protected:
~PostMessageEvent()
{
MOZ_COUNT_DTOR(PostMessageEvent);
}
public:
JSAutoStructuredCloneBuffer& Buffer()
{
return mBuffer;

View File

@ -36,11 +36,14 @@ public:
{
MOZ_COUNT_CTOR(DOMCameraControlListener::DOMCallback);
}
protected:
virtual ~DOMCallback()
{
MOZ_COUNT_DTOR(DOMCameraControlListener::DOMCallback);
}
public:
virtual void RunCallback(nsDOMCameraControl* aDOMCameraControl) = 0;
NS_IMETHOD

View File

@ -43,11 +43,13 @@ public:
MOZ_COUNT_CTOR(PromiseTask);
}
protected:
~PromiseTask()
{
MOZ_COUNT_DTOR(PromiseTask);
}
public:
NS_IMETHOD Run()
{
mPromise->mTaskPending = false;
@ -70,11 +72,13 @@ public:
MOZ_COUNT_CTOR(WorkerPromiseTask);
}
protected:
~WorkerPromiseTask()
{
MOZ_COUNT_DTOR(WorkerPromiseTask);
}
public:
bool
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
{

View File

@ -70,8 +70,11 @@ public:
NS_IMETHOD_(void) Release(void);
DOMStorageCache(const nsACString* aScope);
protected:
virtual ~DOMStorageCache();
public:
void Init(DOMStorageManager* aManager, bool aPersistent, nsIPrincipal* aPrincipal,
const nsACString& aQuotaScope);

View File

@ -37,8 +37,11 @@ class CopyableCanvasLayer : public CanvasLayer
{
public:
CopyableCanvasLayer(LayerManager* aLayerManager, void *aImplData);
protected:
virtual ~CopyableCanvasLayer();
public:
virtual void Initialize(const Data& aData);
virtual bool IsDataValid(const Data& aData);

View File

@ -32,11 +32,14 @@ public:
{
MOZ_COUNT_CTOR(BasicColorLayer);
}
protected:
virtual ~BasicColorLayer()
{
MOZ_COUNT_DTOR(BasicColorLayer);
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(BasicManager()->InConstruction(),

View File

@ -42,9 +42,10 @@ class BasicCompositor : public Compositor
public:
BasicCompositor(nsIWidget *aWidget);
protected:
virtual ~BasicCompositor();
public:
virtual bool Initialize() MOZ_OVERRIDE { return true; };
virtual void Destroy() MOZ_OVERRIDE;

View File

@ -26,8 +26,10 @@ public:
MOZ_COUNT_CTOR(BasicContainerLayer);
mSupportsComponentAlphaChildren = true;
}
protected:
virtual ~BasicContainerLayer();
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(BasicManager()->InConstruction(),

View File

@ -32,11 +32,13 @@ public:
{
MOZ_COUNT_CTOR(BasicImageLayer);
}
protected:
virtual ~BasicImageLayer()
{
MOZ_COUNT_DTOR(BasicImageLayer);
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(BasicManager()->InConstruction(),

View File

@ -73,8 +73,11 @@ public:
* ClearWidget before the widget dies.
*/
BasicLayerManager(nsIWidget* aWidget);
protected:
virtual ~BasicLayerManager();
public:
/**
* Set the default target context that will be used when BeginTransaction
* is called. This can only be called outside a transaction.

View File

@ -55,11 +55,14 @@ public:
{
MOZ_COUNT_CTOR(BasicReadbackLayer);
}
protected:
virtual ~BasicReadbackLayer()
{
MOZ_COUNT_DTOR(BasicReadbackLayer);
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(BasicManager()->InConstruction(),

View File

@ -37,11 +37,14 @@ public:
{
MOZ_COUNT_CTOR(BasicThebesLayer);
}
protected:
virtual ~BasicThebesLayer()
{
MOZ_COUNT_DTOR(BasicThebesLayer);
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(BasicManager()->InConstruction(),

View File

@ -44,8 +44,11 @@ public:
{
MOZ_COUNT_CTOR(ClientCanvasLayer);
}
protected:
virtual ~ClientCanvasLayer();
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(ClientManager()->InConstruction(),

View File

@ -27,11 +27,14 @@ public:
{
MOZ_COUNT_CTOR(ClientColorLayer);
}
protected:
virtual ~ClientColorLayer()
{
MOZ_COUNT_DTOR(ClientColorLayer);
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(ClientManager()->InConstruction(),

View File

@ -32,6 +32,8 @@ public:
MOZ_COUNT_CTOR(ClientContainerLayer);
mSupportsComponentAlphaChildren = true;
}
protected:
virtual ~ClientContainerLayer()
{
while (mFirstChild) {
@ -41,6 +43,7 @@ public:
MOZ_COUNT_DTOR(ClientContainerLayer);
}
public:
virtual void RenderLayer()
{
if (GetMaskLayer()) {
@ -148,11 +151,14 @@ public:
{
MOZ_COUNT_CTOR(ClientRefLayer);
}
protected:
virtual ~ClientRefLayer()
{
MOZ_COUNT_DTOR(ClientRefLayer);
}
public:
virtual Layer* AsLayer() { return this; }
virtual ShadowableLayer* AsShadowableLayer() { return this; }

View File

@ -33,12 +33,14 @@ public:
{
MOZ_COUNT_CTOR(ClientImageLayer);
}
protected:
virtual ~ClientImageLayer()
{
DestroyBackBuffer();
MOZ_COUNT_DTOR(ClientImageLayer);
}
virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE
{
ImageLayer::SetContainer(aContainer);

View File

@ -44,8 +44,11 @@ class ClientLayerManager : public LayerManager
public:
ClientLayerManager(nsIWidget* aWidget);
protected:
virtual ~ClientLayerManager();
public:
virtual ShadowLayerForwarder* AsShadowForwarder()
{
return mForwarder;

View File

@ -42,6 +42,8 @@ public:
{
MOZ_COUNT_CTOR(ClientThebesLayer);
}
protected:
virtual ~ClientThebesLayer()
{
if (mContentClient) {
@ -51,6 +53,7 @@ public:
MOZ_COUNT_DTOR(ClientThebesLayer);
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(ClientManager()->InConstruction(),

View File

@ -43,8 +43,11 @@ class ClientTiledThebesLayer : public ThebesLayer,
public:
ClientTiledThebesLayer(ClientLayerManager* const aManager,
ClientLayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE);
protected:
~ClientTiledThebesLayer();
public:
// Override name to distinguish it from ClientThebesLayer in layer dumps
virtual const char* Name() const { return "TiledThebesLayer"; }

View File

@ -39,12 +39,14 @@ public:
MOZ_COUNT_CTOR(RemoveTextureFromCompositableTracker);
}
protected:
~RemoveTextureFromCompositableTracker()
{
MOZ_COUNT_DTOR(RemoveTextureFromCompositableTracker);
ReleaseTextureClient();
}
public:
virtual void Complete() MOZ_OVERRIDE
{
ReleaseTextureClient();

View File

@ -140,6 +140,7 @@ public:
SimpleTiledContentClient(SimpleClientTiledThebesLayer* aThebesLayer,
ClientLayerManager* aManager);
private:
~SimpleTiledContentClient();
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
@ -161,8 +162,10 @@ class SimpleClientTiledThebesLayer : public ThebesLayer,
public:
SimpleClientTiledThebesLayer(ClientLayerManager* const aManager,
ClientLayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE);
protected:
~SimpleClientTiledThebesLayer();
public:
// Thebes Layer
virtual Layer* AsLayer() { return this; }
virtual void InvalidateRegion(const nsIntRegion& aRegion) {

View File

@ -500,8 +500,10 @@ public:
ShmemTextureClient(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend, TextureFlags aFlags);
protected:
~ShmemTextureClient();
public:
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
virtual bool Allocate(uint32_t aSize) MOZ_OVERRIDE;
@ -532,8 +534,10 @@ public:
MemoryTextureClient(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend, TextureFlags aFlags);
protected:
~MemoryTextureClient();
public:
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
virtual bool Allocate(uint32_t aSize) MOZ_OVERRIDE;
@ -559,8 +563,10 @@ class StreamTextureClient : public TextureClient
public:
StreamTextureClient(TextureFlags aFlags);
protected:
~StreamTextureClient();
public:
virtual bool IsAllocated() const MOZ_OVERRIDE;
virtual bool Lock(OpenMode mode) MOZ_OVERRIDE;

View File

@ -72,8 +72,10 @@ class gfxMemorySharedReadLock : public gfxSharedReadLock {
public:
gfxMemorySharedReadLock();
protected:
~gfxMemorySharedReadLock();
public:
virtual int32_t ReadLock() MOZ_OVERRIDE;
virtual int32_t ReadUnlock() MOZ_OVERRIDE;
@ -97,8 +99,10 @@ private:
public:
gfxShmSharedReadLock(ISurfaceAllocator* aAllocator);
protected:
~gfxShmSharedReadLock();
public:
virtual int32_t ReadLock() MOZ_OVERRIDE;
virtual int32_t ReadUnlock() MOZ_OVERRIDE;
@ -465,6 +469,7 @@ public:
TiledContentClient(ClientTiledThebesLayer* aThebesLayer,
ClientLayerManager* aManager);
protected:
~TiledContentClient()
{
MOZ_COUNT_DTOR(TiledContentClient);
@ -473,6 +478,7 @@ public:
mLowPrecisionTiledBuffer.Release();
}
public:
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return TextureInfo(CompositableType::BUFFER_TILED);

View File

@ -30,8 +30,10 @@ class CanvasLayerComposite : public CanvasLayer,
public:
CanvasLayerComposite(LayerManagerComposite* aManager);
protected:
virtual ~CanvasLayerComposite();
public:
// CanvasLayer impl
virtual void Initialize(const Data& aData) MOZ_OVERRIDE
{

View File

@ -30,12 +30,15 @@ public:
MOZ_COUNT_CTOR(ColorLayerComposite);
mImplData = static_cast<LayerComposite*>(this);
}
protected:
~ColorLayerComposite()
{
MOZ_COUNT_DTOR(ColorLayerComposite);
Destroy();
}
public:
// LayerComposite Implementation
virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }

View File

@ -28,8 +28,10 @@ class ContainerLayerComposite : public ContainerLayer,
public:
ContainerLayerComposite(LayerManagerComposite *aManager);
protected:
~ContainerLayerComposite();
public:
// LayerComposite Implementation
virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }
@ -63,8 +65,11 @@ class RefLayerComposite : public RefLayer,
const nsIntRect& aClipRect);
public:
RefLayerComposite(LayerManagerComposite *aManager);
protected:
~RefLayerComposite();
public:
/** LayerOGL implementation */
Layer* GetLayer() MOZ_OVERRIDE { return this; }

View File

@ -33,8 +33,10 @@ class ImageLayerComposite : public ImageLayer,
public:
ImageLayerComposite(LayerManagerComposite* aManager);
protected:
virtual ~ImageLayerComposite();
public:
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
virtual void Disconnect() MOZ_OVERRIDE;

View File

@ -148,11 +148,13 @@ public:
{
MOZ_COUNT_CTOR(NewTextureSource);
}
protected:
virtual ~NewTextureSource()
{
MOZ_COUNT_DTOR(NewTextureSource);
}
public:
/**
* Should be overridden in order to deallocate the data that is associated
* with the rendering backend, such as GL textures.
@ -285,8 +287,10 @@ class TextureHost
public:
TextureHost(TextureFlags aFlags);
protected:
virtual ~TextureHost();
public:
/**
* Factory method.
*/
@ -548,8 +552,10 @@ public:
ISurfaceAllocator* aDeallocator,
TextureFlags aFlags);
protected:
~ShmemTextureHost();
public:
virtual void DeallocateSharedData() MOZ_OVERRIDE;
virtual void ForgetSharedData() MOZ_OVERRIDE;
@ -580,8 +586,10 @@ public:
gfx::SurfaceFormat aFormat,
TextureFlags aFlags);
protected:
~MemoryTextureHost();
public:
virtual void DeallocateSharedData() MOZ_OVERRIDE;
virtual void ForgetSharedData() MOZ_OVERRIDE;

View File

@ -38,8 +38,11 @@ class ThebesLayerComposite : public ThebesLayer,
{
public:
ThebesLayerComposite(LayerManagerComposite *aManager);
protected:
virtual ~ThebesLayerComposite();
public:
virtual void Disconnect() MOZ_OVERRIDE;
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;

View File

@ -186,8 +186,10 @@ class TiledContentHost : public ContentHost,
public:
TiledContentHost(const TextureInfo& aTextureInfo);
protected:
~TiledContentHost();
public:
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE
{
return LayerRenderState();

View File

@ -196,11 +196,13 @@ public:
MOZ_COUNT_CTOR(FenceDeliveryTracker);
}
protected:
~FenceDeliveryTracker()
{
MOZ_COUNT_DTOR(FenceDeliveryTracker);
}
public:
virtual void Complete() MOZ_OVERRIDE
{
mFenceHandle = FenceHandle();

View File

@ -50,8 +50,11 @@ public:
ShadowLayersManager* aLayersManager,
uint64_t aId,
ProcessId aOtherProcess);
protected:
~LayerTransactionParent();
public:
void Destroy();
LayerManagerComposite* layer_manager() const { return mLayerManager; }

View File

@ -29,8 +29,11 @@ class SharedPlanarYCbCrImage : public PlanarYCbCrImage
{
public:
SharedPlanarYCbCrImage(ImageClient* aCompositable);
protected:
~SharedPlanarYCbCrImage();
public:
virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; }
virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE;
virtual uint8_t* GetBuffer() MOZ_OVERRIDE;

View File

@ -41,8 +41,11 @@ class SharedRGBImage : public Image
{
public:
SharedRGBImage(ImageClient* aCompositable);
protected:
~SharedRGBImage();
public:
virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; }
virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE;

View File

@ -166,8 +166,10 @@ public:
CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth = -1, int aSurfaceHeight = -1,
bool aUseExternalSurfaceSize = false);
protected:
virtual ~CompositorOGL();
public:
virtual TemporaryRef<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;

View File

@ -38,12 +38,13 @@ class gfxBaseSharedMemorySurface : public Base {
typedef mozilla::ipc::Shmem Shmem;
friend class gfxReusableSharedImageSurfaceWrapper;
public:
protected:
virtual ~gfxBaseSharedMemorySurface()
{
MOZ_COUNT_DTOR(gfxBaseSharedMemorySurface);
}
public:
/**
* Return a new gfxSharedImageSurface around a shmem segment newly
* allocated by this function. |aAllocator| is the object used to

View File

@ -16,8 +16,10 @@ class gfxImageSurface;
class gfxReusableImageSurfaceWrapper : public gfxReusableSurfaceWrapper {
public:
gfxReusableImageSurfaceWrapper(gfxImageSurface* aSurface);
protected:
~gfxReusableImageSurfaceWrapper();
public:
const unsigned char* GetReadOnlyData() const MOZ_OVERRIDE;
gfxImageFormat Format() MOZ_OVERRIDE;
gfxReusableSurfaceWrapper* GetWritable(gfxImageSurface** aSurface) MOZ_OVERRIDE;

View File

@ -27,8 +27,10 @@ class gfxReusableSharedImageSurfaceWrapper : public gfxReusableSurfaceWrapper {
public:
gfxReusableSharedImageSurfaceWrapper(mozilla::layers::ISurfaceAllocator* aAllocator,
gfxSharedImageSurface* aSurface);
protected:
~gfxReusableSharedImageSurfaceWrapper();
public:
const unsigned char* GetReadOnlyData() const MOZ_OVERRIDE;
gfxImageFormat Format() MOZ_OVERRIDE;
gfxReusableSurfaceWrapper* GetWritable(gfxImageSurface** aSurface) MOZ_OVERRIDE;

View File

@ -18,14 +18,16 @@ class TestChild MOZ_FINAL : public mozilla::ipc::PBackgroundTestChild
TestChild(const nsCString& aTestArg)
: mTestArg(aTestArg)
{
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundTestChild);
MOZ_COUNT_CTOR(TestChild);
}
protected:
~TestChild()
{
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundTestChild);
MOZ_COUNT_DTOR(TestChild);
}
public:
virtual bool
Recv__delete__(const nsCString& aTestArg) MOZ_OVERRIDE;
};

View File

@ -33,14 +33,16 @@ class TestParent MOZ_FINAL : public mozilla::ipc::PBackgroundTestParent
TestParent()
{
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundTestParent);
MOZ_COUNT_CTOR(TestParent);
}
protected:
~TestParent()
{
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundTestParent);
MOZ_COUNT_DTOR(TestParent);
}
public:
virtual void
ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
};

View File

@ -57,4 +57,31 @@ MaskLayerImageCache::PutImage(const MaskLayerImageKey* aKey, ImageContainer* aCo
entry->mContainer = aContainer;
}
// This case is particularly 'clever' because it uses AddRef/Release to track the use
// not to release the object.
template<>
struct HasDangerousPublicDestructor<MaskLayerImageCache::MaskLayerImageKey>
{
static const bool value = true;
};
MaskLayerImageCache::MaskLayerImageKey::MaskLayerImageKey()
: mLayerCount(0)
, mRoundedClipRects()
{
MOZ_COUNT_CTOR(MaskLayerImageKey);
}
MaskLayerImageCache::MaskLayerImageKey::MaskLayerImageKey(const MaskLayerImageKey& aKey)
: mLayerCount(aKey.mLayerCount)
, mRoundedClipRects(aKey.mRoundedClipRects)
{
MOZ_COUNT_CTOR(MaskLayerImageKey);
}
MaskLayerImageCache::MaskLayerImageKey::~MaskLayerImageKey()
{
MOZ_COUNT_DTOR(MaskLayerImageKey);
}
}

View File

@ -131,23 +131,10 @@ public:
*/
struct MaskLayerImageKey
{
MaskLayerImageKey()
: mLayerCount(0)
, mRoundedClipRects()
{
MOZ_COUNT_CTOR(MaskLayerImageKey);
}
MaskLayerImageKey(const MaskLayerImageKey& aKey)
: mLayerCount(aKey.mLayerCount)
, mRoundedClipRects(aKey.mRoundedClipRects)
{
MOZ_COUNT_CTOR(MaskLayerImageKey);
}
MaskLayerImageKey();
MaskLayerImageKey(const MaskLayerImageKey& aKey);
~MaskLayerImageKey()
{
MOZ_COUNT_DTOR(MaskLayerImageKey);
}
~MaskLayerImageKey();
void AddRef() const { ++mLayerCount; }
void Release() const
@ -199,7 +186,8 @@ protected:
typedef const MaskLayerImageKey& KeyType;
typedef const MaskLayerImageKey* KeyTypePointer;
MaskLayerImageEntry(KeyTypePointer aKey) : mKey(aKey)
MaskLayerImageEntry(KeyTypePointer aKey)
: mKey(aKey)
{
MOZ_COUNT_CTOR(MaskLayerImageEntry);
}
@ -247,6 +235,7 @@ protected:
static PLDHashOperator SweepFunc(MaskLayerImageEntry* aEntry, void* aUserArg);
};
}

View File

@ -369,11 +369,14 @@ public:
{
MOZ_COUNT_CTOR(nsResizeDropdownAtFinalPosition);
}
protected:
~nsResizeDropdownAtFinalPosition()
{
MOZ_COUNT_DTOR(nsResizeDropdownAtFinalPosition);
}
public:
virtual bool ReflowFinished() MOZ_OVERRIDE
{
Run();

View File

@ -20,6 +20,7 @@
#include "nsString.h"
#include "nsCOMArray.h"
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/Mutex.h"
#include "mozilla/TimeStamp.h"
@ -364,15 +365,16 @@ private:
};
class CacheOutputCloseListener : public nsRunnable
class CacheOutputCloseListener MOZ_FINAL : public nsRunnable
{
public:
void OnOutputClosed();
virtual ~CacheOutputCloseListener();
private:
friend class CacheEntry;
virtual ~CacheOutputCloseListener();
NS_DECL_NSIRUNNABLE
CacheOutputCloseListener(CacheEntry* aEntry);

View File

@ -41,6 +41,7 @@ public:
MOZ_COUNT_CTOR(NotifyCacheFileListenerEvent);
}
protected:
~NotifyCacheFileListenerEvent()
{
LOG(("NotifyCacheFileListenerEvent::~NotifyCacheFileListenerEvent() "
@ -48,6 +49,7 @@ public:
MOZ_COUNT_DTOR(NotifyCacheFileListenerEvent);
}
public:
NS_IMETHOD Run()
{
LOG(("NotifyCacheFileListenerEvent::Run() [this=%p]", this));
@ -78,6 +80,7 @@ public:
MOZ_COUNT_CTOR(NotifyChunkListenerEvent);
}
protected:
~NotifyChunkListenerEvent()
{
LOG(("NotifyChunkListenerEvent::~NotifyChunkListenerEvent() [this=%p]",
@ -85,6 +88,7 @@ public:
MOZ_COUNT_DTOR(NotifyChunkListenerEvent);
}
public:
NS_IMETHOD Run()
{
LOG(("NotifyChunkListenerEvent::Run() [this=%p]", this));

View File

@ -25,6 +25,7 @@ public:
MOZ_COUNT_CTOR(NotifyUpdateListenerEvent);
}
protected:
~NotifyUpdateListenerEvent()
{
LOG(("NotifyUpdateListenerEvent::~NotifyUpdateListenerEvent() [this=%p]",
@ -32,6 +33,7 @@ public:
MOZ_COUNT_DTOR(NotifyUpdateListenerEvent);
}
public:
NS_IMETHOD Run()
{
LOG(("NotifyUpdateListenerEvent::Run() [this=%p]", this));

View File

@ -538,11 +538,13 @@ public:
MOZ_COUNT_CTOR(ShutdownEvent);
}
protected:
~ShutdownEvent()
{
MOZ_COUNT_DTOR(ShutdownEvent);
}
public:
NS_IMETHOD Run()
{
MutexAutoLock lock(*mLock);
@ -582,11 +584,13 @@ public:
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::open-background");
}
protected:
~OpenFileEvent()
{
MOZ_COUNT_DTOR(OpenFileEvent);
}
public:
NS_IMETHOD Run()
{
if (mResultOnAnyThread || mTarget) {
@ -674,11 +678,13 @@ public:
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::read-background");
}
protected:
~ReadEvent()
{
MOZ_COUNT_DTOR(ReadEvent);
}
public:
NS_IMETHOD Run()
{
if (mResultOnAnyThread || mTarget) {
@ -739,6 +745,7 @@ public:
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::write-background");
}
protected:
~WriteEvent()
{
MOZ_COUNT_DTOR(WriteEvent);
@ -748,6 +755,7 @@ public:
}
}
public:
NS_IMETHOD Run()
{
if (mTarget) {
@ -803,11 +811,13 @@ public:
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::doom-background");
}
protected:
~DoomFileEvent()
{
MOZ_COUNT_DTOR(DoomFileEvent);
}
public:
NS_IMETHOD Run()
{
if (mTarget) {
@ -858,11 +868,13 @@ public:
MOZ_ASSERT(mTarget);
}
protected:
~DoomFileByKeyEvent()
{
MOZ_COUNT_DTOR(DoomFileByKeyEvent);
}
public:
NS_IMETHOD Run()
{
if (mTarget) {
@ -900,11 +912,13 @@ public:
MOZ_COUNT_CTOR(ReleaseNSPRHandleEvent);
}
protected:
~ReleaseNSPRHandleEvent()
{
MOZ_COUNT_DTOR(ReleaseNSPRHandleEvent);
}
public:
NS_IMETHOD Run()
{
if (mHandle->mFD && !mHandle->IsClosed()) {
@ -932,11 +946,13 @@ public:
mTarget = static_cast<nsIEventTarget*>(NS_GetCurrentThread());
}
protected:
~TruncateSeekSetEOFEvent()
{
MOZ_COUNT_DTOR(TruncateSeekSetEOFEvent);
}
public:
NS_IMETHOD Run()
{
if (mTarget) {
@ -980,11 +996,13 @@ public:
mTarget = static_cast<nsIEventTarget*>(NS_GetCurrentThread());
}
protected:
~RenameFileEvent()
{
MOZ_COUNT_DTOR(RenameFileEvent);
}
public:
NS_IMETHOD Run()
{
if (mTarget) {
@ -1026,11 +1044,13 @@ public:
MOZ_COUNT_CTOR(InitIndexEntryEvent);
}
protected:
~InitIndexEntryEvent()
{
MOZ_COUNT_DTOR(InitIndexEntryEvent);
}
public:
NS_IMETHOD Run()
{
if (mHandle->IsClosed() || mHandle->IsDoomed()) {
@ -1075,11 +1095,13 @@ public:
}
}
protected:
~UpdateIndexEntryEvent()
{
MOZ_COUNT_DTOR(UpdateIndexEntryEvent);
}
public:
NS_IMETHOD Run()
{
if (mHandle->IsClosed() || mHandle->IsDoomed()) {

View File

@ -1951,10 +1951,12 @@ public:
{
MOZ_COUNT_CTOR(nsFtpAsyncAlert);
}
protected:
virtual ~nsFtpAsyncAlert()
{
MOZ_COUNT_DTOR(nsFtpAsyncAlert);
}
public:
NS_IMETHOD Run()
{
if (mPrompter) {

View File

@ -24,11 +24,13 @@ class nsHtml5OwningUTF16Buffer : public nsHtml5UTF16Buffer
*/
nsHtml5OwningUTF16Buffer(void* aKey);
protected:
/**
* Takes care of releasing the owned buffer.
*/
~nsHtml5OwningUTF16Buffer();
public:
/**
* The next buffer in a queue.
*/

View File

@ -89,8 +89,10 @@ public:
bool aTruthValue);
Assertion(nsIRDFResource* aSource); // PLDHashTable assertion variant
private:
~Assertion();
public:
void AddRef() {
if (mRefCnt == UINT16_MAX) {
NS_WARNING("refcount overflow, leaking Assertion");
@ -1317,7 +1319,7 @@ InMemoryDataSource::LockedUnassert(nsIRDFResource* aSource,
else {
// If this second-level hash empties out, clean it up.
if (!root->u.hash.mPropertyHash->entryCount) {
delete root;
root->Release();
SetForwardArcs(aSource, nullptr);
}
}
@ -1921,7 +1923,7 @@ InMemoryDataSource::SweepForwardArcsEntries(PLDHashTable* aTable,
// If the sub-hash is now empty, clean it up.
if (!as->u.hash.mPropertyHash->entryCount) {
delete as;
as->Release();
result = PL_DHASH_REMOVE;
}

View File

@ -905,7 +905,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
mCompositorParent = NewCompositorParent(aWidth, aHeight);
MessageChannel *parentChannel = mCompositorParent->GetIPCChannel();
ClientLayerManager* lm = new ClientLayerManager(this);
nsRefPtr<ClientLayerManager> lm = new ClientLayerManager(this);
MessageLoop *childMessageLoop = CompositorParent::CompositorLoop();
mCompositorChild = new CompositorChild(lm);
mCompositorChild->Open(parentChannel, childMessageLoop, ipc::ChildSide);
@ -928,7 +928,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
if (success) {
ShadowLayerForwarder* lf = lm->AsShadowForwarder();
if (!lf) {
delete lm;
lm = nullptr;
mCompositorChild = nullptr;
return;
}
@ -937,7 +937,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
WindowUsesOMTC();
mLayerManager = lm;
mLayerManager = lm.forget();
return;
}