Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: src/core/SkGlyphCache_Globals.h

Issue 1345903002: Revert of Parallel cache - preliminary (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkGlyphCache.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyphCache_Globals.h
diff --git a/src/core/SkGlyphCache_Globals.h b/src/core/SkGlyphCache_Globals.h
index 3736ace414093369623a3a9dcf1f280853f54179..e1825a2f0f90d935a8c5d90637c373d293b07d2b 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 @@
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 @@
// 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 attachCacheToHead(SkGlyphCache*);
+
+ // can only be called when the mutex is already held
+ void internalDetachCache(SkGlyphCache*);
void internalAttachCacheToHead(SkGlyphCache*);
- // can only be called when the mutex is already held
- void internalMoveToHead(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
« no previous file with comments | « src/core/SkGlyphCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698