OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkFontMgr.h" | 8 #include "SkFontMgr.h" |
9 #include "SkFontStyle.h" | 9 #include "SkFontStyle.h" |
10 #include "SkFontConfigInterface.h" | 10 #include "SkFontConfigInterface.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 if (FcGetVersion() < 21091) { // We assume FcGetVersion() has always be
en thread safe. | 31 if (FcGetVersion() < 21091) { // We assume FcGetVersion() has always be
en thread safe. |
32 gFCMutex.acquire(); | 32 gFCMutex.acquire(); |
33 fUnlock = true; | 33 fUnlock = true; |
34 } else { | 34 } else { |
35 fUnlock = false; | 35 fUnlock = false; |
36 } | 36 } |
37 gFCSafeToUse = true; | 37 gFCSafeToUse = true; |
38 } | 38 } |
39 | 39 |
40 ~FCLocker() { | 40 ~FCLocker() { |
41 gFCSafeToUse = false; | |
42 if (fUnlock) { | 41 if (fUnlock) { |
| 42 gFCSafeToUse = false; |
43 gFCMutex.release(); | 43 gFCMutex.release(); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 bool fUnlock; | 48 bool fUnlock; |
49 }; | 49 }; |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 FCLocker lock; | 325 FCLocker lock; |
326 return FontConfigTypeface::LegacyCreateTypeface(NULL, familyName, | 326 return FontConfigTypeface::LegacyCreateTypeface(NULL, familyName, |
327 (SkTypeface::Style)styleBits); | 327 (SkTypeface::Style)styleBits); |
328 } | 328 } |
329 }; | 329 }; |
330 | 330 |
331 SkFontMgr* SkFontMgr::Factory() { | 331 SkFontMgr* SkFontMgr::Factory() { |
332 SkFontConfigInterface* fci = RefFCI(); | 332 SkFontConfigInterface* fci = RefFCI(); |
333 return fci ? SkNEW_ARGS(SkFontMgr_fontconfig, (fci)) : NULL; | 333 return fci ? SkNEW_ARGS(SkFontMgr_fontconfig, (fci)) : NULL; |
334 } | 334 } |
OLD | NEW |