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

Unified Diff: src/ports/SkFontHost_FreeType.cpp

Issue 1431683006: Take mutex when calling into FreeType. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_FreeType.cpp
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 32eafad87c903098a02f179ee7f200428fd2d018..e8b72b5e090f3e3560ba6b6231bff34d55f87667 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -949,6 +949,7 @@ SkScalerContext_FreeType::~SkScalerContext_FreeType() {
this face with other context (at different sizes).
*/
FT_Error SkScalerContext_FreeType::setupSize() {
herb_g 2015/11/03 19:09:28 Maybe change the name to indicate that this routin
+ gFTMutex.assertHeld();
FT_Error err = FT_Activate_Size(fFTSize);
if (err != 0) {
SkDEBUGF(("SkScalerContext_FreeType::FT_Activate_Size(%s %s, 0x%x, 0x%x) returned 0x%x\n",
@@ -968,10 +969,12 @@ unsigned SkScalerContext_FreeType::generateGlyphCount() {
}
uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) {
+ SkAutoMutexAcquire ac(gFTMutex);
return SkToU16(FT_Get_Char_Index( fFace, uni ));
}
SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) {
+ SkAutoMutexAcquire ac(gFTMutex);
// iterate through each cmap entry, looking for matching glyph indices
FT_UInt glyphIndex;
SkUnichar charCode = FT_Get_First_Char( fFace, &glyphIndex );
« 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