Index: src/ports/SkFontHost_win_dw.cpp |
=================================================================== |
--- src/ports/SkFontHost_win_dw.cpp (revision 11593) |
+++ src/ports/SkFontHost_win_dw.cpp (working copy) |
@@ -113,6 +113,18 @@ |
unsigned styleBits) SK_OVERRIDE; |
private: |
robertphillips
2013/10/04 16:34:50
make fTFCacheMutex?
bungeman-skia
2013/10/04 17:00:14
Done.
|
+ SkMutex tfMutex; |
+ void Add(SkTypeface* face, SkTypeface::Style requestedStyle, bool strong) { |
+ SkAutoMutexAcquire ama(tfMutex); |
+ fTFCache.add(face, requestedStyle, strong); |
+ } |
+ |
+ SkTypeface* FindByProcAndRef(SkTypefaceCache::FindProc proc, void* ctx) { |
+ SkAutoMutexAcquire ama(tfMutex); |
+ SkTypeface* typeface = fTFCache.findByProcAndRef(proc, ctx); |
+ return typeface; |
+ } |
+ |
friend class SkFontStyleSet_DirectWrite; |
SkTScopedComPtr<IDWriteFontCollection> fFontCollection; |
SkSMallocWCHAR fLocaleName; |
@@ -1710,12 +1722,12 @@ |
IDWriteFontFamily* fontFamily, |
StreamFontFileLoader* fontFileLoader, |
IDWriteFontCollectionLoader* fontCollectionLoader) { |
- SkTypeface* face = fTFCache.findByProcAndRef(FindByDWriteFont, font); |
+ SkTypeface* face = FindByProcAndRef(FindByDWriteFont, font); |
if (NULL == face) { |
face = DWriteFontTypeface::Create(fontFace, font, fontFamily, |
fontFileLoader, fontCollectionLoader); |
if (face) { |
- fTFCache.add(face, get_style(font), fontCollectionLoader != NULL); |
+ Add(face, get_style(font), fontCollectionLoader != NULL); |
} |
} |
return face; |