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

Unified Diff: src/ports/SkFontHost_FreeType.cpp

Issue 1940613002: Fix race in SkTypeface_FreeType::onCountGlyphs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ports/SkFontHost_FreeType_common.h » ('j') | 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 82648c3f513452e2f717c4d7002106f601647ede..b53364eacb47eab195b7b6cc7269143736a62e3b 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1526,14 +1526,9 @@ int SkTypeface_FreeType::onCharsToGlyphs(const void* chars, Encoding encoding,
}
int SkTypeface_FreeType::onCountGlyphs() const {
- // we cache this value, using -1 as a sentinel for "not computed"
- if (fGlyphCount < 0) {
- AutoFTAccess fta(this);
- FT_Face face = fta.face();
- // if the face failed, we still assign a non-negative value
- fGlyphCount = face ? face->num_glyphs : 0;
- }
- return fGlyphCount;
+ AutoFTAccess fta(this);
+ FT_Face face = fta.face();
+ return face ? face->num_glyphs : 0;
}
SkTypeface::LocalizedStrings* SkTypeface_FreeType::onCreateFamilyNameIterator() const {
« no previous file with comments | « no previous file | src/ports/SkFontHost_FreeType_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698