///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-
-class AutoAcquire {
-public:
- AutoAcquire(SkSpinlock& lock) : fLock(lock) { fLock.acquire(); }
- ~AutoAcquire() { fLock.release(); }
-private:
- SkSpinlock& fLock;
-};
+typedef SkAutoTExclusive<SkSpinlock> Exclusive;
size_t SkGlyphCache_Globals::setCacheSizeLimit(size_t newLimit) {
static const size_t minLimit = 256 * 1024;
newLimit = minLimit;
}
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
size_t prevLimit = fCacheSizeLimit;
fCacheSizeLimit = newLimit;
newCount = 0;
}
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
int prevCount = fCacheCountLimit;
fCacheCountLimit = newCount;
}
void SkGlyphCache_Globals::purgeAll() {
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
this->internalPurge(fTotalMemoryUsed);
}
SkGlyphCache* cache;
{
- AutoAcquire ac(globals.fLock);
+ Exclusive ac(globals.fLock);
globals.validate();
void SkGlyphCache::VisitAll(Visitor visitor, void* context) {
SkGlyphCache_Globals& globals = get_globals();
- AutoAcquire ac(globals.fLock);
+ Exclusive ac(globals.fLock);
SkGlyphCache* cache;
globals.validate();
///////////////////////////////////////////////////////////////////////////////
void SkGlyphCache_Globals::attachCacheToHead(SkGlyphCache* cache) {
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
this->validate();
cache->validate();