Chromium Code Reviews| Index: src/ports/SkFontConfigInterface_android.cpp |
| diff --git a/src/ports/SkFontConfigInterface_android.cpp b/src/ports/SkFontConfigInterface_android.cpp |
| index bdc3d5092a53614e2f2a7664c641320a45747e92..4c3ab075767d2912bcf0dc0463db20ce8c2f8e43 100644 |
| --- a/src/ports/SkFontConfigInterface_android.cpp |
| +++ b/src/ports/SkFontConfigInterface_android.cpp |
| @@ -110,7 +110,6 @@ public: |
| private: |
| void addFallbackFamily(FamilyRecID fontRecID); |
| SkTypeface* getTypefaceForFontRec(FontRecID fontRecID); |
| - FallbackFontList* getCurrentLocaleFallbackFontList(); |
| FallbackFontList* findFallbackFontList(const SkLanguage& lang, bool isOriginal = true); |
| SkTArray<FontRec, true> fFonts; |
| @@ -219,9 +218,8 @@ SkFontConfigInterfaceAndroid::SkFontConfigInterfaceAndroid(SkTDArray<FontFamily* |
| get_path_for_sys_fonts(&filename, family->fFontFiles[j].fFileName); |
| if (has_font(fFonts, filename)) { |
| - SkDebugf("---- system font and fallback font files specify a duplicate " |
| - "font %s, skipping the second occurrence", filename.c_str()); |
| - continue; |
| + DEBUG_FONT(("---- system font and fallback font files specify a duplicate " |
| + "font %s, skipping the second occurrence", filename.c_str())); |
| } |
| FontRec& fontRec = fFonts.push_back(); |
| @@ -510,16 +508,14 @@ SkTypeface* SkFontConfigInterfaceAndroid::getTypefaceForFontRec(FontRecID fontRe |
| bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni, |
| const char* lang, |
| SkString* name) { |
| - FallbackFontList* fallbackFontList = NULL; |
| - const SkString langTag(lang); |
| - if (langTag.isEmpty()) { |
| - fallbackFontList = this->getCurrentLocaleFallbackFontList(); |
| - } else { |
| - fallbackFontList = this->findFallbackFontList(langTag); |
| + const SkString locale(lang); |
| + if (NULL == fLocaleFallbackFontList || locale != fCachedLocale) { |
| + fCachedLocale = locale; |
| + fLocaleFallbackFontList = this->findFallbackFontList(locale); |
|
bungeman-skia
2014/08/04 14:52:45
Now that this is cleaner, it sets of my spider sen
tomhudson
2014/08/04 15:26:37
So the error case is that two different threads ar
|
| } |
| - for (int i = 0; i < fallbackFontList->count(); i++) { |
| - FamilyRecID familyRecID = fallbackFontList->getAt(i); |
| + for (int i = 0; i < fLocaleFallbackFontList->count(); i++) { |
| + FamilyRecID familyRecID = fLocaleFallbackFontList->getAt(i); |
| // if it is not one of the accepted variants then move to the next family |
| int32_t acceptedVariants = SkPaintOptionsAndroid::kDefault_Variant | |
| @@ -545,15 +541,6 @@ bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni, |
| return false; |
| } |
| -FallbackFontList* SkFontConfigInterfaceAndroid::getCurrentLocaleFallbackFontList() { |
| - SkString locale = SkFontConfigParser::GetLocale(); |
| - if (NULL == fLocaleFallbackFontList || locale != fCachedLocale) { |
| - fCachedLocale = locale; |
| - fLocaleFallbackFontList = this->findFallbackFontList(locale); |
| - } |
| - return fLocaleFallbackFontList; |
| -} |
| - |
| FallbackFontList* SkFontConfigInterfaceAndroid::findFallbackFontList(const SkLanguage& lang, |
| bool isOriginal) { |
| const SkString& langTag = lang.getTag(); |