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

Side by Side Diff: src/ports/SkFontConfigInterface_direct.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/pathops/SkPathOpsOp.cpp ('k') | src/ports/SkFontHost_FreeType.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 2009-2015 Google Inc. 2 * Copyright 2009-2015 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 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ 8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */
9 9
10 #include "SkBuffer.h" 10 #include "SkBuffer.h"
(...skipping 14 matching lines...) Expand all
25 #include <unistd.h> 25 #include <unistd.h>
26 26
27 #ifdef SK_DEBUG 27 #ifdef SK_DEBUG
28 # include "SkTLS.h" 28 # include "SkTLS.h"
29 #endif 29 #endif
30 30
31 namespace { 31 namespace {
32 32
33 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob al mutex. 33 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob al mutex.
34 // See https://bug.skia.org/1497 for background. 34 // See https://bug.skia.org/1497 for background.
35 static SkMutex gFCMutex; 35 SK_DECLARE_STATIC_MUTEX(gFCMutex);
36 36
37 #ifdef SK_DEBUG 37 #ifdef SK_DEBUG
38 void* CreateThreadFcLocked() { return new bool(false); } 38 void* CreateThreadFcLocked() { return new bool(false); }
39 void DeleteThreadFcLocked(void* v) { delete static_cast<bool*>(v); } 39 void DeleteThreadFcLocked(void* v) { delete static_cast<bool*>(v); }
40 # define THREAD_FC_LOCKED \ 40 # define THREAD_FC_LOCKED \
41 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked )) 41 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked ))
42 #endif 42 #endif
43 43
44 struct FCLocker { 44 struct FCLocker {
45 // Assume FcGetVersion() has always been thread safe. 45 // Assume FcGetVersion() has always been thread safe.
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 const char* famName = get_name(match, FC_FAMILY); 726 const char* famName = get_name(match, FC_FAMILY);
727 if (famName && !find_name(names, famName)) { 727 if (famName && !find_name(names, famName)) {
728 *names.append() = famName; 728 *names.append() = famName;
729 *sizes.append() = strlen(famName) + 1; 729 *sizes.append() = strlen(famName) + 1;
730 } 730 }
731 } 731 }
732 732
733 return SkDataTable::NewCopyArrays((const void*const*)names.begin(), 733 return SkDataTable::NewCopyArrays((const void*const*)names.begin(),
734 sizes.begin(), names.count()); 734 sizes.begin(), names.count());
735 } 735 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsOp.cpp ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698