| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 { | 187 { |
| 188 bool checkingAlternateName = true; | 188 bool checkingAlternateName = true; |
| 189 return getFontPlatformData(fontDescription, FontFaceCreationParams(adjustFam
ilyNameToAvoidUnsupportedFonts(family)), checkingAlternateName); | 189 return getFontPlatformData(fontDescription, FontFaceCreationParams(adjustFam
ilyNameToAvoidUnsupportedFonts(family)), checkingAlternateName); |
| 190 } | 190 } |
| 191 | 191 |
| 192 SimpleFontData* FontCache::getNonRetainedLastResortFallbackFont(const FontDescri
ption& fontDescription) | 192 SimpleFontData* FontCache::getNonRetainedLastResortFallbackFont(const FontDescri
ption& fontDescription) |
| 193 { | 193 { |
| 194 return getLastResortFallbackFont(fontDescription, DoNotRetain).leakRef(); | 194 return getLastResortFallbackFont(fontDescription, DoNotRetain).leakRef(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 template <FontFallbackPriority fallbackPriority> | |
| 198 const Vector<AtomicString>* FontCache::initAndGetFontListForFallbackPriority(con
st FontDescription& fontDescription) | |
| 199 { | |
| 200 DEFINE_STATIC_LOCAL(Vector<AtomicString>, fontsList, ()); | |
| 201 DEFINE_STATIC_LOCAL(bool, fontsListInitialized, (false)); | |
| 202 if (fontsListInitialized) | |
| 203 return &fontsList; | |
| 204 | |
| 205 for (auto fontCandidate : | |
| 206 platformFontListForFallbackPriority(fallbackPriority)) { | |
| 207 if (isPlatformFontAvailable(fontDescription, fontCandidate)) | |
| 208 fontsList.append(fontCandidate); | |
| 209 } | |
| 210 fontsListInitialized = true; | |
| 211 return &fontsList; | |
| 212 } | |
| 213 | |
| 214 const Vector<AtomicString>* FontCache::fontListForFallbackPriority(const FontDes
cription& fontDescription, FontFallbackPriority fallbackPriority) | |
| 215 { | |
| 216 // Explicit template instantiations for valid values. | |
| 217 switch (fallbackPriority) { | |
| 218 case FontFallbackPriority::Symbols: | |
| 219 return initAndGetFontListForFallbackPriority<FontFallbackPriority::Symbo
ls>(fontDescription); | |
| 220 case FontFallbackPriority::Math: | |
| 221 return initAndGetFontListForFallbackPriority<FontFallbackPriority::Math>
(fontDescription); | |
| 222 case FontFallbackPriority::EmojiText: | |
| 223 return initAndGetFontListForFallbackPriority<FontFallbackPriority::Emoji
Text>(fontDescription); | |
| 224 case FontFallbackPriority::EmojiEmoji: | |
| 225 return initAndGetFontListForFallbackPriority<FontFallbackPriority::Emoji
Emoji>(fontDescription); | |
| 226 default: | |
| 227 ASSERT_NOT_REACHED(); | |
| 228 return nullptr; | |
| 229 } | |
| 230 } | |
| 231 | |
| 232 void FontCache::releaseFontData(const SimpleFontData* fontData) | 197 void FontCache::releaseFontData(const SimpleFontData* fontData) |
| 233 { | 198 { |
| 234 ASSERT(gFontDataCache); | 199 ASSERT(gFontDataCache); |
| 235 | 200 |
| 236 gFontDataCache->release(fontData); | 201 gFontDataCache->release(fontData); |
| 237 } | 202 } |
| 238 | 203 |
| 239 static inline void purgePlatformFontDataCache() | 204 static inline void purgePlatformFontDataCache() |
| 240 { | 205 { |
| 241 if (!gFontPlatformDataCache) | 206 if (!gFontPlatformDataCache) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 iter != gFallbackListShaperCache->end(); | 357 iter != gFallbackListShaperCache->end(); |
| 393 ++iter) { | 358 ++iter) { |
| 394 shapeResultCacheSize += iter->value->byteSize(); | 359 shapeResultCacheSize += iter->value->byteSize(); |
| 395 } | 360 } |
| 396 dump->addScalar("size", "bytes", shapeResultCacheSize); | 361 dump->addScalar("size", "bytes", shapeResultCacheSize); |
| 397 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); | 362 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); |
| 398 } | 363 } |
| 399 | 364 |
| 400 | 365 |
| 401 } // namespace blink | 366 } // namespace blink |
| OLD | NEW |