The two leaks are:
missing unrefs in megalooper GM missing reset capability in oval renderer This CL also expands the instance counting system to some recently adding classes (e.g., SkFontStyleSet) R=bsalomon@google.com, jvanverth@google.com Author: robertphillips@google.com Review URL: https://chromiumcodereview.appspot.com/18461007 git-svn-id: http://skia.googlecode.com/svn/trunk@10030 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
40ea172f1e
commit
ef284a84f5
@ -27,6 +27,7 @@ const static char kJsonKey_Hashtype_Bitmap_64bitMD5[] = "bitmap-64bitMD5";
|
||||
|
||||
|
||||
namespace skiagm {
|
||||
SK_DEFINE_INST_COUNT(ExpectationsSource)
|
||||
|
||||
void gm_fprintf(FILE *stream, const char format[], ...) {
|
||||
va_list args;
|
||||
|
@ -172,7 +172,12 @@ namespace skiagm {
|
||||
*/
|
||||
class ExpectationsSource : public SkRefCnt {
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(ExpectationsSource)
|
||||
|
||||
virtual Expectations get(const char *testName) = 0;
|
||||
|
||||
private:
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ private:
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
SkPaint loopPaint;
|
||||
|
||||
loopPaint.setLooper(create1Looper(-kOffsetToOutsideClip, 0, gColors[i]));
|
||||
loopPaint.setLooper(create1Looper(-kOffsetToOutsideClip, 0, gColors[i]))->unref();
|
||||
loopPaint.setAntiAlias(true);
|
||||
|
||||
SkRect outerClip = {
|
||||
@ -194,7 +194,7 @@ private:
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setLooper(create4Looper(-kOffsetToOutsideClip-kHalfSquareSize, 0));
|
||||
paint.setLooper(create4Looper(-kOffsetToOutsideClip-kHalfSquareSize, 0))->unref();
|
||||
|
||||
canvas->save();
|
||||
canvas->clipRect(outerClip, SkRegion::kIntersect_Op);
|
||||
|
@ -26,6 +26,8 @@ class SkWStream;
|
||||
*/
|
||||
class SkDocument : public SkRefCnt {
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(SkDocument)
|
||||
|
||||
/**
|
||||
* Create a PDF-backed document, writing the results into a file.
|
||||
* If there is an error trying to create the doc, returns NULL.
|
||||
@ -89,6 +91,8 @@ private:
|
||||
SkWStream* fStream;
|
||||
void (*fDoneProc)(SkWStream*);
|
||||
State fState;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -27,7 +27,11 @@ public:
|
||||
SK_DECLARE_INST_COUNT(GrOvalRenderer)
|
||||
|
||||
GrOvalRenderer() : fRRectIndexBuffer(NULL) {}
|
||||
~GrOvalRenderer() {}
|
||||
~GrOvalRenderer() {
|
||||
this->reset();
|
||||
}
|
||||
|
||||
void reset();
|
||||
|
||||
bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
|
||||
const GrRect& oval, const SkStrokeRec& stroke);
|
||||
|
@ -72,12 +72,16 @@ public:
|
||||
class CacheSelector : public SkRefCnt {
|
||||
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(CacheSelector)
|
||||
/**
|
||||
* Return an SkImageCache to use based on the provided SkImage::Info. If the caller decides
|
||||
* to hang on to the result, it will call ref, so the implementation should not add a ref
|
||||
* as a result of this call.
|
||||
*/
|
||||
virtual SkImageCache* selectCache(const SkImage::Info&) = 0;
|
||||
|
||||
private:
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,8 @@
|
||||
class SkImageCache : public SkRefCnt {
|
||||
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(SkImageCache)
|
||||
|
||||
typedef intptr_t ID;
|
||||
|
||||
/**
|
||||
@ -123,5 +125,8 @@ public:
|
||||
*/
|
||||
virtual void purgeAllUnpinnedCaches() = 0;
|
||||
#endif
|
||||
|
||||
private:
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
#endif // SkImageCache_DEFINED
|
||||
|
@ -20,6 +20,8 @@ class CachedPixels;
|
||||
class SkLruImageCache : public SkImageCache {
|
||||
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(SkLruImageCache)
|
||||
|
||||
SkLruImageCache(size_t budget);
|
||||
|
||||
virtual ~SkLruImageCache();
|
||||
|
@ -20,6 +20,8 @@
|
||||
class SkPurgeableImageCache : public SkImageCache {
|
||||
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(SkPurgeableImageCache)
|
||||
|
||||
static SkImageCache* Create();
|
||||
|
||||
virtual void* allocAndPinCache(size_t bytes, ID*) SK_OVERRIDE;
|
||||
|
@ -22,6 +22,8 @@
|
||||
*/
|
||||
class SK_API SkFontConfigInterface : public SkRefCnt {
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(SkFontConfigInterface)
|
||||
|
||||
/**
|
||||
* Returns the global SkFontConfigInterface instance, and if it is not
|
||||
* NULL, calls ref() on it. The caller must balance this with a call to
|
||||
|
@ -18,16 +18,23 @@ class SkTypeface;
|
||||
|
||||
class SK_API SkFontStyleSet : public SkRefCnt {
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(SkFontStyleSet)
|
||||
|
||||
virtual int count() = 0;
|
||||
virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0;
|
||||
virtual SkTypeface* createTypeface(int index) = 0;
|
||||
virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0;
|
||||
|
||||
static SkFontStyleSet* CreateEmpty();
|
||||
|
||||
private:
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
||||
class SK_API SkFontMgr : public SkRefCnt {
|
||||
public:
|
||||
SK_DECLARE_INST_COUNT(SkFontMgr)
|
||||
|
||||
int countFamilies();
|
||||
void getFamilyName(int index, SkString* familyName);
|
||||
SkFontStyleSet* createStyleSet(int index);
|
||||
|
@ -68,6 +68,9 @@ SkFontStyle::SkFontStyle(int weight, int width, Slant slant) {
|
||||
|
||||
#include "SkFontMgr.h"
|
||||
|
||||
|
||||
SK_DEFINE_INST_COUNT(SkFontStyleSet)
|
||||
|
||||
class SkEmptyFontStyleSet : public SkFontStyleSet {
|
||||
public:
|
||||
virtual int count() SK_OVERRIDE { return 0; }
|
||||
@ -89,6 +92,8 @@ SkFontStyleSet* SkFontStyleSet::CreateEmpty() {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SK_DEFINE_INST_COUNT(SkFontMgr)
|
||||
|
||||
class SkEmptyFontMgr : public SkFontMgr {
|
||||
protected:
|
||||
virtual int onCountFamilies() SK_OVERRIDE {
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "SkDocument.h"
|
||||
#include "SkStream.h"
|
||||
|
||||
SK_DEFINE_INST_COUNT(SkDocument)
|
||||
|
||||
SkDocument::SkDocument(SkWStream* stream, void (*doneProc)(SkWStream*)) {
|
||||
fStream = stream; // we do not own this object.
|
||||
fDoneProc = doneProc;
|
||||
|
@ -198,6 +198,7 @@ void GrContext::contextDestroyed() {
|
||||
fDrawBufferIBAllocPool = NULL;
|
||||
|
||||
fAARectRenderer->reset();
|
||||
fOvalRenderer->reset();
|
||||
|
||||
fTextureCache->purgeAllUnlocked();
|
||||
fFontCache->freeAll();
|
||||
@ -214,6 +215,7 @@ void GrContext::freeGpuResources() {
|
||||
fGpu->purgeResources();
|
||||
|
||||
fAARectRenderer->reset();
|
||||
fOvalRenderer->reset();
|
||||
|
||||
fTextureCache->purgeAllUnlocked();
|
||||
fFontCache->freeAll();
|
||||
|
@ -286,6 +286,10 @@ GrEffectRef* EllipseEdgeEffect::TestCreate(SkMWCRandom* random,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void GrOvalRenderer::reset() {
|
||||
GrSafeSetNull(fRRectIndexBuffer);
|
||||
}
|
||||
|
||||
bool GrOvalRenderer::drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
|
||||
const GrRect& oval, const SkStrokeRec& stroke)
|
||||
{
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "SkImagePriv.h"
|
||||
#include "SkLazyPixelRef.h"
|
||||
|
||||
SK_DEFINE_INST_COUNT(SkBitmapFactory::CacheSelector)
|
||||
|
||||
SkBitmapFactory::SkBitmapFactory(SkBitmapFactory::DecodeProc proc)
|
||||
: fDecodeProc(proc)
|
||||
, fImageCache(NULL)
|
||||
|
@ -7,6 +7,9 @@
|
||||
|
||||
#include "SkLruImageCache.h"
|
||||
|
||||
SK_DEFINE_INST_COUNT(SkImageCache)
|
||||
SK_DEFINE_INST_COUNT(SkLruImageCache)
|
||||
|
||||
static intptr_t NextGenerationID() {
|
||||
static intptr_t gNextID;
|
||||
do {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "SkTSearch.h"
|
||||
#endif
|
||||
|
||||
SK_DEFINE_INST_COUNT(SkPurgeableImageCache)
|
||||
SK_DECLARE_STATIC_MUTEX(gPurgeableImageMutex);
|
||||
|
||||
SkImageCache* SkPurgeableImageCache::Create() {
|
||||
|
Loading…
Reference in New Issue
Block a user