diff options
author | 2015-09-15 15:15:40 -0700 | |
---|---|---|
committer | 2015-09-15 15:15:41 -0700 | |
commit | cd7f03597475ea423aa819bdae03996b26874dd5 (patch) | |
tree | dd53ad22692e423802af93ab00dac1e48c117372 /src/core/SkGlyphCache_Globals.h | |
parent | 013e9e3bb0495ab0b5aff011429a6ac983464d34 (diff) |
Revert of Parallel cache - preliminary (patchset #24 id:460001 of https://codereview.chromium.org/1264103003/ )
Reason for revert:
Breaks DrMemory in the chrome roll.
Original issue's description:
> Parallel cache.
>
> TBR=reed@google.com
>
> BUG=skia:1330,528560
>
> Committed: https://skia.googlesource.com/skia/+/6f2a486040cb25465990196c229feb47e668e87f
>
> Committed: https://skia.googlesource.com/skia/+/bf2988833e5a36c6b430da6fdd2cfebd0015adec
>
> Committed: https://skia.googlesource.com/skia/+/014ffdb01ea5317614a1569efc30c50f06434222
TBR=reed@google.com,mtklein@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:1330,528560
Review URL: https://codereview.chromium.org/1345903002
Diffstat (limited to 'src/core/SkGlyphCache_Globals.h')
-rw-r--r-- | src/core/SkGlyphCache_Globals.h | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/core/SkGlyphCache_Globals.h b/src/core/SkGlyphCache_Globals.h index 3736ace414..e1825a2f0f 100644 --- a/src/core/SkGlyphCache_Globals.h +++ b/src/core/SkGlyphCache_Globals.h @@ -26,9 +26,8 @@ class SkGlyphCache_Globals { public: SkGlyphCache_Globals() { - fHead = nullptr; - fTotalMemoryUsed.store(0); + fTotalMemoryUsed = 0; fCacheSizeLimit = SK_DEFAULT_FONT_CACHE_LIMIT; fCacheCount = 0; fCacheCountLimit = SK_DEFAULT_FONT_CACHE_COUNT_LIMIT; @@ -48,8 +47,7 @@ public: SkGlyphCache* internalGetHead() const { return fHead; } SkGlyphCache* internalGetTail() const; - size_t getTotalMemoryUsed() const { return fTotalMemoryUsed.load(); } - void increaseTotalMemoryUsed(size_t increase) { fTotalMemoryUsed.fetch_add(increase);} + size_t getTotalMemoryUsed() const { return fTotalMemoryUsed; } int getCacheCountUsed() const { return fCacheCount; } #ifdef SK_DEBUG @@ -68,30 +66,29 @@ public: // or count limit. bool isOverBudget() const { return fCacheCount > fCacheCountLimit || - fTotalMemoryUsed.load() > fCacheSizeLimit; + fTotalMemoryUsed > fCacheSizeLimit; } void purgeAll(); // does not change budget // call when a glyphcache is available for caching (i.e. not in use) - void internalAttachCacheToHead(SkGlyphCache*); + void attachCacheToHead(SkGlyphCache*); // can only be called when the mutex is already held - void internalMoveToHead(SkGlyphCache *); + void internalDetachCache(SkGlyphCache*); + void internalAttachCacheToHead(SkGlyphCache*); + +private: + SkGlyphCache* fHead; + size_t fTotalMemoryUsed; + size_t fCacheSizeLimit; + int32_t fCacheCountLimit; + int32_t fCacheCount; // Checkout budgets, modulated by the specified min-bytes-needed-to-purge, // and attempt to purge caches to match. // Returns number of bytes freed. - void internalDetachCache(SkGlyphCache* cache); size_t internalPurge(size_t minBytesNeeded = 0); - -private: - SkGlyphCache* fHead; - SkAtomic<size_t> fTotalMemoryUsed; - size_t fCacheSizeLimit; - int32_t fCacheCountLimit; - int32_t fCacheCount; - }; #endif |