Bug 935778 - Part 0.2: Spray some MOZ_DECLARE_REFCOUNTED_TYPENAME across the tree

This commit is contained in:
Ehsan Akhgari 2014-02-20 21:33:49 -05:00
parent 04c9e8266a
commit 5704b555e2
28 changed files with 48 additions and 0 deletions

View File

@ -120,6 +120,7 @@ class RestoreSelectionState;
class nsTextEditorState : public mozilla::SupportsWeakPtr<nsTextEditorState> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsTextEditorState)
explicit nsTextEditorState(nsITextControlElement* aOwningElement);
~nsTextEditorState();

View File

@ -25,6 +25,7 @@ class PannerNode : public AudioNode,
public SupportsWeakPtr<PannerNode>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(PannerNode)
explicit PannerNode(AudioContext* aContext);
virtual ~PannerNode();

View File

@ -58,6 +58,7 @@ class SpeechRecognition MOZ_FINAL : public nsDOMEventTargetHelper,
public SupportsWeakPtr<SpeechRecognition>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SpeechRecognition)
SpeechRecognition(nsPIDOMWindow* aOwnerWindow);
virtual ~SpeechRecognition() {};

View File

@ -143,6 +143,7 @@ class nsDocShell : public nsDocLoader,
friend class nsDSURIContentListener;
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsDocShell)
// Object Management
nsDocShell();

View File

@ -164,6 +164,7 @@ struct DrawSurfaceOptions {
class GradientStops : public RefCounted<GradientStops>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(GradientStops)
virtual ~GradientStops() {}
virtual BackendType GetBackendType() const = 0;
@ -316,6 +317,7 @@ public:
class SourceSurface : public RefCounted<SourceSurface>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SourceSurface)
virtual ~SourceSurface() {}
virtual SurfaceType GetType() const = 0;
@ -396,6 +398,7 @@ public:
class PathSink : public RefCounted<PathSink>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(PathSink)
virtual ~PathSink() {}
/* Move the current point in the path, any figure currently being drawn will
@ -434,6 +437,7 @@ class FlattenedPath;
class Path : public RefCounted<Path>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Path)
virtual ~Path();
virtual BackendType GetBackendType() const = 0;
@ -533,6 +537,7 @@ struct GlyphBuffer
class ScaledFont : public RefCounted<ScaledFont>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(ScaledFont)
virtual ~ScaledFont() {}
typedef void (*FontFileDataOutput)(const uint8_t *aData, uint32_t aLength, uint32_t aIndex, Float aGlyphSize, void *aBaton);
@ -591,6 +596,7 @@ struct FontOptions
class GlyphRenderingOptions : public RefCounted<GlyphRenderingOptions>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(GlyphRenderingOptions)
virtual ~GlyphRenderingOptions() {}
virtual FontType GetType() const = 0;
@ -607,6 +613,7 @@ protected:
class DrawTarget : public RefCounted<DrawTarget>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DrawTarget)
DrawTarget() : mTransformDirty(false), mPermitSubpixelAA(false) {}
virtual ~DrawTarget() {}
@ -989,6 +996,7 @@ protected:
class DrawEventRecorder : public RefCounted<DrawEventRecorder>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DrawEventRecorder)
virtual ~DrawEventRecorder() { }
};

View File

@ -466,6 +466,7 @@ enum UnpremultiplyInputs
class FilterNode : public RefCounted<FilterNode>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(FilterMode)
virtual ~FilterNode() {}
virtual FilterBackend GetBackendType() = 0;

View File

@ -62,6 +62,7 @@ CGContextType GetContextType(CGContextRef ref);
class MacIOSurface : public mozilla::RefCounted<MacIOSurface> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MacIOSurface)
typedef mozilla::gfx::SourceSurface SourceSurface;
static mozilla::TemporaryRef<MacIOSurface> CreateIOSurface(int aWidth, int aHeight,

View File

@ -27,6 +27,7 @@ enum AllowOfflineRendererEnum { ALLOW_OFFLINE_RENDERER, DISALLOW_OFFLINE_RENDERE
class nsCARenderer : public mozilla::RefCounted<nsCARenderer> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsCARenderer)
nsCARenderer() : mCARenderer(nullptr), mWrapperCALayer(nullptr), mFBOTexture(0),
mOpenGLContext(nullptr), mCGImage(nullptr), mCGData(nullptr),
mIOSurface(nullptr), mFBO(0), mIOTexture(0),

View File

@ -179,6 +179,7 @@ enum SurfaceInitMode
class Compositor : public RefCounted<Compositor>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Compositor)
Compositor(PCompositorParent* aParent = nullptr)
: mCompositorID(0)
, mDiagnosticTypes(DIAGNOSTIC_NONE)

View File

@ -39,6 +39,7 @@ namespace layers {
struct Effect : public RefCounted<Effect>
{
MOZ_DECLARE_REFCOUNTED_TYPENAME(Effect)
Effect(EffectTypes aType) : mType(aType) {}
EffectTypes mType;

View File

@ -72,6 +72,7 @@ class TextureClientData;
class CompositableClient : public AtomicRefCounted<CompositableClient>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder);
virtual ~CompositableClient();

View File

@ -55,6 +55,7 @@ class TextureChild : public PTextureChild
, public AtomicRefCounted<TextureChild>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureChild)
TextureChild()
: mForwarder(nullptr)
, mTextureData(nullptr)

View File

@ -510,6 +510,7 @@ struct TextureClientAutoUnlock
class DeprecatedTextureClient : public RefCounted<DeprecatedTextureClient>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeprecatedTextureClient)
typedef gl::SharedTextureHandle SharedTextureHandle;
typedef gl::GLContext GLContext;
typedef gl::TextureImage TextureImage;

View File

@ -66,6 +66,7 @@ class AsyncCompositionManager MOZ_FINAL : public RefCounted<AsyncCompositionMana
{
friend class AutoResolveRefLayers;
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(AsyncCompositionManager)
AsyncCompositionManager(LayerManagerComposite* aManager)
: mLayerManager(aManager)
, mIsFirstPaint(false)

View File

@ -60,6 +60,7 @@ struct EffectChain;
class CompositableBackendSpecificData : public RefCounted<CompositableBackendSpecificData>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableBackendSpecificData)
CompositableBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositableBackendSpecificData);
@ -89,6 +90,7 @@ public:
class CompositableHost : public RefCounted<CompositableHost>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableHost)
CompositableHost(const TextureInfo& aTextureInfo);
virtual ~CompositableHost();

View File

@ -81,6 +81,7 @@ public:
class TextureSource : public RefCounted<TextureSource>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureSource)
TextureSource();
virtual ~TextureSource();

View File

@ -76,6 +76,7 @@ bool ReleaseOwnedSurfaceDescriptor(const SurfaceDescriptor& aDescriptor);
class ISurfaceAllocator : public AtomicRefCounted<ISurfaceAllocator>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(ISurfaceAllocator)
ISurfaceAllocator() {}
/**

View File

@ -26,6 +26,7 @@ class LayerTransactionChild : public PLayerTransactionChild
, public AtomicRefCounted<LayerTransactionChild>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(LayerTransactionChild)
/**
* Clean this up, finishing with Send__delete__().
*

View File

@ -233,6 +233,7 @@ namespace FilterWrappers {
class FilterCachedColorModels : public RefCounted<FilterCachedColorModels>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(FilterCachedColorModels)
// aFilter can be null. In that case, ForColorModel will return a non-null
// completely transparent filter for all color models.
FilterCachedColorModels(DrawTarget* aDT,

View File

@ -144,6 +144,7 @@ class RasterImage : public ImageResource
#endif
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(RasterImage)
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIPROPERTIES
NS_DECL_IMGICONTAINER

View File

@ -48,6 +48,7 @@ class imgRequestProxy : public imgIRequest,
public mozilla::SupportsWeakPtr<imgRequestProxy>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(imgRequestProxy)
typedef mozilla::image::ImageURL ImageURL;
NS_DECL_ISUPPORTS
NS_DECL_IMGIREQUEST

View File

@ -109,6 +109,7 @@ enum {
class imgStatusTracker : public mozilla::SupportsWeakPtr<imgStatusTracker>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(imgStatusTracker)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(imgStatusTracker)
// aImage is the image that this status tracker will pass to the

View File

@ -60,6 +60,7 @@ class MessageListener
public mozilla::SupportsWeakPtr<MessageListener>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MessageListener)
typedef IPC::Message Message;
virtual ~MessageListener() { }

View File

@ -42,6 +42,10 @@ template<typename T> OutParamRef<T> byRef(RefPtr<T>&);
* state is represented in DEBUG builds by refcount==0xffffdead. This
* state distinguishes use-before-ref (refcount==0) from
* use-after-destroy (refcount==0xffffdead).
*
* Note that when deriving from RefCounted or AtomicRefCounted, you
* should add MOZ_DECLARE_REFCOUNTED_TYPENAME(ClassName) to the public
* section of your class, where ClassName is the name of your class.
*/
namespace detail {
#ifdef DEBUG
@ -96,6 +100,9 @@ class RefCounted
mutable typename Conditional<Atomicity == AtomicRefCount, Atomic<int>, int>::Type refCnt;
};
#define MOZ_DECLARE_REFCOUNTED_TYPENAME(T) \
const char* typeName() const { return #T; }
}
template<typename T>
@ -301,6 +308,7 @@ using namespace mozilla;
struct Foo : public RefCounted<Foo>
{
MOZ_DECLARE_REFCOUNTED_TYPENAME(Foo)
Foo() : dead(false) { }
~Foo() {
MOZ_ASSERT(!dead);

View File

@ -14,6 +14,10 @@
* the WeakPtrs to it and allows the WeakReference to live beyond the lifetime
* of 'Foo'.
*
* Note that when deriving from SupportsWeakPtr you should add
* MOZ_DECLARE_REFCOUNTED_TYPENAME(ClassName) to the public section of your
* class, where ClassName is the name of your class.
*
* The overhead of WeakPtr is that accesses to 'Foo' becomes an additional
* dereference, and an additional heap allocated pointer sized object shared
* between all of the WeakPtrs.
@ -24,6 +28,7 @@
* class C : public SupportsWeakPtr<C>
* {
* public:
* MOZ_DECLARE_REFCOUNTED_TYPENAME(C)
* int num;
* void act();
* };

View File

@ -105,6 +105,7 @@ public:
class DataConnectionListener : public SupportsWeakPtr<DataConnectionListener>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DataChannelConnection::DataConnectionListener)
virtual ~DataConnectionListener() {}
// Called when a the connection is open

View File

@ -189,6 +189,7 @@ class nsOfflineCacheUpdateOwner
: public mozilla::SupportsWeakPtr<nsOfflineCacheUpdateOwner>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsOfflineCacheUpdateOwner)
virtual ~nsOfflineCacheUpdateOwner() {}
virtual nsresult UpdateFinished(nsOfflineCacheUpdate *aUpdate) = 0;
};
@ -199,6 +200,7 @@ class nsOfflineCacheUpdate MOZ_FINAL : public nsIOfflineCacheUpdate
, public nsOfflineCacheUpdateOwner
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsOfflineCacheUpdate)
NS_DECL_ISUPPORTS
NS_DECL_NSIOFFLINECACHEUPDATE
NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER

View File

@ -31,6 +31,7 @@ class MessageLoopIdleTask
, public SupportsWeakPtr<MessageLoopIdleTask>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MessageLoopIdleTask)
MessageLoopIdleTask(nsIRunnable* aTask, uint32_t aEnsureRunsAfterMS);
virtual ~MessageLoopIdleTask() {}
virtual void Run();