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

Side by Side Diff: src/core/SkTypefaceCache.cpp

Issue 1945353003: Revert of SK_DECLARE_STATIC_MUTEX -> static SkMutex (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 9
10 #include "SkTypefaceCache.h" 10 #include "SkTypefaceCache.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 SkTypefaceCache& SkTypefaceCache::Get() { 57 SkTypefaceCache& SkTypefaceCache::Get() {
58 static SkTypefaceCache gCache; 58 static SkTypefaceCache gCache;
59 return gCache; 59 return gCache;
60 } 60 }
61 61
62 SkFontID SkTypefaceCache::NewFontID() { 62 SkFontID SkTypefaceCache::NewFontID() {
63 static int32_t gFontID; 63 static int32_t gFontID;
64 return sk_atomic_inc(&gFontID) + 1; 64 return sk_atomic_inc(&gFontID) + 1;
65 } 65 }
66 66
67 static SkMutex gMutex; 67 SK_DECLARE_STATIC_MUTEX(gMutex);
68 68
69 void SkTypefaceCache::Add(SkTypeface* face) { 69 void SkTypefaceCache::Add(SkTypeface* face) {
70 SkAutoMutexAcquire ama(gMutex); 70 SkAutoMutexAcquire ama(gMutex);
71 Get().add(face); 71 Get().add(face);
72 } 72 }
73 73
74 SkTypeface* SkTypefaceCache::FindByProcAndRef(FindProc proc, void* ctx) { 74 SkTypeface* SkTypefaceCache::FindByProcAndRef(FindProc proc, void* ctx) {
75 SkAutoMutexAcquire ama(gMutex); 75 SkAutoMutexAcquire ama(gMutex);
76 return Get().findByProcAndRef(proc, ctx); 76 return Get().findByProcAndRef(proc, ctx);
77 } 77 }
(...skipping 15 matching lines...) Expand all
93 face, id, s.weight(), s.width(), s.slant(), face->getRefCnt(), n.c_ str()); 93 face, id, s.weight(), s.width(), s.slant(), face->getRefCnt(), n.c_ str());
94 return false; 94 return false;
95 } 95 }
96 #endif 96 #endif
97 97
98 void SkTypefaceCache::Dump() { 98 void SkTypefaceCache::Dump() {
99 #ifdef SK_DEBUG 99 #ifdef SK_DEBUG
100 (void)Get().findByProcAndRef(DumpProc, nullptr); 100 (void)Get().findByProcAndRef(DumpProc, nullptr);
101 #endif 101 #endif
102 } 102 }
OLDNEW
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698