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

Unified Diff: src/core/SkGlyphCache.cpp

Issue 1424563002: Use SkAutoTExclusive. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyphCache.cpp
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index 91e53c4df1039fde9c65a0bb6277bae2d0c7251e..1512dbf0e5dd0a627369e74d32ce804945dd6bfc 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -293,14 +293,7 @@ void SkGlyphCache::invokeAndRemoveAuxProcs() {
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-
-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;
@@ -308,7 +301,7 @@ size_t SkGlyphCache_Globals::setCacheSizeLimit(size_t newLimit) {
newLimit = minLimit;
}
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
size_t prevLimit = fCacheSizeLimit;
fCacheSizeLimit = newLimit;
@@ -321,7 +314,7 @@ int SkGlyphCache_Globals::setCacheCountLimit(int newCount) {
newCount = 0;
}
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
int prevCount = fCacheCountLimit;
fCacheCountLimit = newCount;
@@ -330,7 +323,7 @@ int SkGlyphCache_Globals::setCacheCountLimit(int newCount) {
}
void SkGlyphCache_Globals::purgeAll() {
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
this->internalPurge(fTotalMemoryUsed);
}
@@ -353,7 +346,7 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
SkGlyphCache* cache;
{
- AutoAcquire ac(globals.fLock);
+ Exclusive ac(globals.fLock);
globals.validate();
@@ -466,7 +459,7 @@ void SkGlyphCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
void SkGlyphCache::VisitAll(Visitor visitor, void* context) {
SkGlyphCache_Globals& globals = get_globals();
- AutoAcquire ac(globals.fLock);
+ Exclusive ac(globals.fLock);
SkGlyphCache* cache;
globals.validate();
@@ -479,7 +472,7 @@ void SkGlyphCache::VisitAll(Visitor visitor, void* context) {
///////////////////////////////////////////////////////////////////////////////
void SkGlyphCache_Globals::attachCacheToHead(SkGlyphCache* cache) {
- AutoAcquire ac(fLock);
+ Exclusive ac(fLock);
this->validate();
cache->validate();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698