Changeset 236383 in webkit
- Timestamp:
- Sep 22, 2018, 12:56:20 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236379 r236383 1 2018-09-22 Chris Dumez <cdumez@apple.com> 2 3 FontDataCache should use Ref<Font> instead of a RefPtr<Font> 4 https://bugs.webkit.org/show_bug.cgi?id=189861 5 6 Reviewed by Antti Koivisto. 7 8 * platform/graphics/FontCache.cpp: 9 (WebCore::FontCache::fontForPlatformData): 10 (WebCore::FontCache::purgeInactiveFontData): 11 1 12 2018-09-21 Justin Michaud <justin_michaud@apple.com> 2 13 -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r236254 r236383 284 284 }; 285 285 286 typedef HashMap<FontPlatformData, Ref Ptr<Font>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;286 typedef HashMap<FontPlatformData, Ref<Font>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache; 287 287 288 288 static FontDataCache& cachedFonts() … … 338 338 #endif 339 339 340 auto addResult = cachedFonts(). add(platformData, nullptr);341 if (addResult.isNewEntry)342 addResult.iterator->value = Font::create(platformData);340 auto addResult = cachedFonts().ensure(platformData, [&] { 341 return Font::create(platformData); 342 }); 343 343 344 344 ASSERT(addResult.iterator->value->platformData() == platformData); 345 345 346 return *addResult.iterator->value;346 return addResult.iterator->value.copyRef(); 347 347 } 348 348 … … 376 376 377 377 while (purgeCount) { 378 Vector<Ref Ptr<Font>, 20> fontsToDelete;379 for (auto font : cachedFonts().values()) {378 Vector<Ref<Font>, 20> fontsToDelete; 379 for (auto& font : cachedFonts().values()) { 380 380 LOG(Fonts, " trying to purge font %s (has one ref %d)", font->platformData().description().utf8().data(), font->hasOneRef()); 381 381 if (!font->hasOneRef()) 382 382 continue; 383 fontsToDelete.append( WTFMove(font));383 fontsToDelete.append(font.copyRef()); 384 384 if (!--purgeCount) 385 385 break;
Note:
See TracChangeset
for help on using the changeset viewer.