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

Side by Side Diff: src/ports/SkFontMgr_fontconfig.cpp

Issue 512433002: Ensure SkFontMgr_fontconfig debug thread locking is initialized. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkFontDescriptor.h" 9 #include "SkFontDescriptor.h"
10 #include "SkFontHost_FreeType_common.h" 10 #include "SkFontHost_FreeType_common.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 * Like all synthetic information, such information must be passed with the fon t data. 50 * Like all synthetic information, such information must be passed with the fon t data.
51 */ 51 */
52 52
53 namespace { 53 namespace {
54 54
55 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob al mutex. 55 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob al mutex.
56 // See http://skbug.com/1497 for background. 56 // See http://skbug.com/1497 for background.
57 SK_DECLARE_STATIC_MUTEX(gFCMutex); 57 SK_DECLARE_STATIC_MUTEX(gFCMutex);
58 58
59 #ifdef SK_DEBUG 59 #ifdef SK_DEBUG
60 void *CreateThreadFcLocked() { return SkNEW(bool); } 60 void *CreateThreadFcLocked() { return SkNEW_ARGS(bool, (false)); }
61 void DeleteThreadFcLocked(void* v) { SkDELETE(static_cast<bool*>(v)); } 61 void DeleteThreadFcLocked(void* v) { SkDELETE(static_cast<bool*>(v)); }
62 # define THREAD_FC_LOCKED \ 62 # define THREAD_FC_LOCKED \
63 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked )) 63 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked ))
64 #endif 64 #endif
65 65
66 struct FCLocker { 66 struct FCLocker {
67 // Assume FcGetVersion() has always been thread safe. 67 // Assume FcGetVersion() has always been thread safe.
68 68
69 FCLocker() { 69 FCLocker() {
70 if (FcGetVersion() < 21091) { 70 if (FcGetVersion() < 21091) {
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 return typeface.detach(); 800 return typeface.detach();
801 } 801 }
802 802
803 return this->matchFamilyStyle(NULL, style); 803 return this->matchFamilyStyle(NULL, style);
804 } 804 }
805 }; 805 };
806 806
807 SkFontMgr* SkFontMgr::Factory() { 807 SkFontMgr* SkFontMgr::Factory() {
808 return SkNEW(SkFontMgr_fontconfig); 808 return SkNEW(SkFontMgr_fontconfig);
809 } 809 }
OLDNEW
« 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