diff options
author | mtklein <mtklein@chromium.org> | 2015-01-13 08:22:43 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-13 08:22:44 -0800 |
commit | 6f07665768dc84453316e7b2bbd6049576764cb1 (patch) | |
tree | 0ff3637043c0f4f7588a98762c91b3dbe1b0c413 /src | |
parent | c3796c7a74e103d9b367ad9449fcdacfa20d83e1 (diff) |
Simplify SkInstCnt
This code requires fewer macros to use it (just one), has less code in macro
definitions, and has simpler synchronization code (just atomic ints, no SkOnce,
no SkMutex, etc.)
A minor downside, we lose indentation and reverse-ordering in the final report:
Leaked SkRefCntBase: 7
Leaked SkFontMgr: 1
Leaked SkWeakRefCnt: 1
Leaked SkTypeface: 1
Leaked SkFlattenable: 3
Leaked SkXfermode: 3
Leaked SkPathRef: 1
Leaked SkPixelRef: 1
Leaked SkMallocPixelRef: 1
becomes
Leaked SkXfermode: 3
Leaked SkMallocPixelRef: 1
Leaked SkPixelRef: 1
Leaked SkPathRef: 1
Leaked SkFlattenable: 3
Leaked SkTypeface: 1
Leaked SkWeakRefCnt: 1
Leaked SkFontMgr: 1
Leaked SkRefCntBase: 7
This is motivated by wanting to land https://codereview.chromium.org/806473006/,
which makes sure all static use of SkOnce are in global scope. The current
implementation of SkInstCnt uses them in function scope, which isn't safe.
BUG=skia:
No public API changes.
TBR=reed@google.com
Review URL: https://codereview.chromium.org/841263004
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkInstCnt.cpp | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCreateNullInterface.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpuProgramCache.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/core/SkInstCnt.cpp b/src/core/SkInstCnt.cpp index 2f9a57dc2b..0211b123ee 100644 --- a/src/core/SkInstCnt.cpp +++ b/src/core/SkInstCnt.cpp @@ -7,6 +7,6 @@ #include "SkInstCnt.h" -#if SK_ENABLE_INST_COUNT -bool gPrintInstCount = false; +#if SK_ENABLE_INST_COUNT && !defined(SKIA_DLL) // See SkInstCnt.h + bool gPrintInstCount = false; #endif diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index 6275ced6fc..14919bb786 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -14,7 +14,7 @@ class BufferObj { public: - SK_DECLARE_INST_COUNT_ROOT(BufferObj); + SK_DECLARE_INST_COUNT(BufferObj); BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) { } @@ -47,7 +47,7 @@ private: // This class maintains a sparsely populated array of buffer pointers. class BufferManager { public: - SK_DECLARE_INST_COUNT_ROOT(BufferManager); + SK_DECLARE_INST_COUNT(BufferManager); BufferManager() : fFreeListHead(kFreeListEnd) {} @@ -116,7 +116,7 @@ private: */ struct ThreadContext { public: - SK_DECLARE_INST_COUNT_ROOT(ThreadContext); + SK_DECLARE_INST_COUNT(ThreadContext); BufferManager fBufferManager; GrGLuint fCurrArrayBuffer; diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp index 688b22ed04..a9202215eb 100644 --- a/src/gpu/gl/GrGLGpuProgramCache.cpp +++ b/src/gpu/gl/GrGLGpuProgramCache.cpp @@ -23,7 +23,7 @@ SK_CONF_DECLARE(bool, c_DisplayCache, "gpu.displayCache", false, typedef GrGLProgramDataManager::UniformHandle UniformHandle; struct GrGLGpu::ProgramCache::Entry { - SK_DECLARE_INST_COUNT_ROOT(Entry); + SK_DECLARE_INST_COUNT(Entry); Entry() : fProgram(NULL), fLRUStamp(0) {} SkAutoTUnref<GrGLProgram> fProgram; |