зеркало из https://github.com/mozilla/gecko-dev.git
Bug 978472 - Add support for leak checking in GenericRefCounted classes; r=bjacob
This commit is contained in:
Родитель
8cd0c0f21d
Коммит
276e2d1e15
|
@ -37,6 +37,11 @@ class GenericRefCountedBase
|
|||
// mechanism, it is welcome to do so by overriding AddRef() and Release().
|
||||
void ref() { AddRef(); }
|
||||
void deref() { Release(); }
|
||||
|
||||
#ifdef MOZ_REFCOUNTED_LEAK_CHECKING
|
||||
virtual const char* typeName() const = 0;
|
||||
virtual size_t typeSize() const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
@ -55,11 +60,18 @@ class GenericRefCounted : public GenericRefCountedBase
|
|||
virtual void AddRef() {
|
||||
MOZ_ASSERT(int32_t(refCnt) >= 0);
|
||||
++refCnt;
|
||||
#ifdef MOZ_REFCOUNTED_LEAK_CHECKING
|
||||
detail::RefCountLogger::logAddRef(this, refCnt, typeName(), typeSize());
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void Release() {
|
||||
MOZ_ASSERT(int32_t(refCnt) > 0);
|
||||
if (0 == --refCnt) {
|
||||
--refCnt;
|
||||
#ifdef MOZ_REFCOUNTED_LEAK_CHECKING
|
||||
detail::RefCountLogger::logRelease(this, refCnt, typeName());
|
||||
#endif
|
||||
if (0 == refCnt) {
|
||||
#ifdef DEBUG
|
||||
refCnt = detail::DEAD;
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@ class GLContextCGL : public GLContext
|
|||
NSOpenGLContext *mContext;
|
||||
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextCGL)
|
||||
GLContextCGL(const SurfaceCaps& caps,
|
||||
GLContext *shareContext,
|
||||
NSOpenGLContext *context,
|
||||
|
|
|
@ -29,6 +29,7 @@ class GLContextEGL : public GLContext
|
|||
EGLSurface surface);
|
||||
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextEGL)
|
||||
GLContextEGL(const SurfaceCaps& caps,
|
||||
GLContext* shareContext,
|
||||
bool isOffscreen,
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace gl {
|
|||
class GLContextGLX : public GLContext
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextGLX)
|
||||
static already_AddRefed<GLContextGLX>
|
||||
CreateGLContext(const SurfaceCaps& caps,
|
||||
GLContextGLX* shareContext,
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace gl {
|
|||
class GLContextWGL : public GLContext
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL)
|
||||
// From Window: (possibly for offscreen!)
|
||||
GLContextWGL(const SurfaceCaps& caps,
|
||||
GLContext* sharedContext,
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace gl {
|
|||
class SkiaGLGlue : public GenericAtomicRefCounted
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SkiaGLGlue)
|
||||
SkiaGLGlue(GLContext* context);
|
||||
GLContext* GetGLContext() const { return mGLContext.get(); }
|
||||
GrContext* GetGrContext() const { return mGrContext.get(); }
|
||||
|
|
|
@ -28,6 +28,7 @@ class SurfaceFactory;
|
|||
class SurfaceStream : public GenericAtomicRefCounted
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SurfaceStream)
|
||||
typedef enum {
|
||||
MainThread,
|
||||
OffMainThread
|
||||
|
@ -145,6 +146,7 @@ protected:
|
|||
SharedSurface* mConsumer; // Only present after resize-swap.
|
||||
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SurfaceStream_SingleBuffer)
|
||||
SurfaceStream_SingleBuffer(SurfaceStream* prevStream);
|
||||
virtual ~SurfaceStream_SingleBuffer();
|
||||
|
||||
|
@ -169,6 +171,7 @@ protected:
|
|||
SharedSurface* mConsumer;
|
||||
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SurfaceStream_TripleBuffer_Copy)
|
||||
SurfaceStream_TripleBuffer_Copy(SurfaceStream* prevStream);
|
||||
virtual ~SurfaceStream_TripleBuffer_Copy();
|
||||
|
||||
|
@ -192,6 +195,7 @@ protected:
|
|||
SurfaceStream_TripleBuffer(SurfaceStreamType type, SurfaceStream* prevStream);
|
||||
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SurfaceStream_TripleBuffer)
|
||||
SurfaceStream_TripleBuffer(SurfaceStream* prevStream);
|
||||
virtual ~SurfaceStream_TripleBuffer();
|
||||
virtual bool CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory);
|
||||
|
|
Загрузка…
Ссылка в новой задаче