| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 #endif // !OS(WIN) && !OS(LINUX) | 70 #endif // !OS(WIN) && !OS(LINUX) |
| 71 | 71 |
| 72 typedef HashMap<unsigned, std::unique_ptr<FontPlatformData>, WTF::IntHash<unsign
ed>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet; | 72 typedef HashMap<unsigned, std::unique_ptr<FontPlatformData>, WTF::IntHash<unsign
ed>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet; |
| 73 typedef HashMap<FontCacheKey, SizedFontPlatformDataSet, FontCacheKeyHash, FontCa
cheKeyTraits> FontPlatformDataCache; | 73 typedef HashMap<FontCacheKey, SizedFontPlatformDataSet, FontCacheKeyHash, FontCa
cheKeyTraits> FontPlatformDataCache; |
| 74 typedef HashMap<FallbackListCompositeKey, std::unique_ptr<ShapeCache>, FallbackL
istCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache; | 74 typedef HashMap<FallbackListCompositeKey, std::unique_ptr<ShapeCache>, FallbackL
istCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache; |
| 75 | 75 |
| 76 static FontPlatformDataCache* gFontPlatformDataCache = nullptr; | 76 static FontPlatformDataCache* gFontPlatformDataCache = nullptr; |
| 77 static FallbackListShaperCache* gFallbackListShaperCache = nullptr; | 77 static FallbackListShaperCache* gFallbackListShaperCache = nullptr; |
| 78 | 78 |
| 79 SkFontMgr* FontCache::s_fontManager = nullptr; | 79 SkFontMgr* FontCache::s_staticFontManager = nullptr; |
| 80 | 80 |
| 81 #if OS(WIN) | 81 #if OS(WIN) |
| 82 bool FontCache::s_antialiasedTextEnabled = false; | 82 bool FontCache::s_antialiasedTextEnabled = false; |
| 83 bool FontCache::s_lcdTextEnabled = false; | 83 bool FontCache::s_lcdTextEnabled = false; |
| 84 float FontCache::s_deviceScaleFactor = 1.0; | 84 float FontCache::s_deviceScaleFactor = 1.0; |
| 85 bool FontCache::s_useSkiaFontFallback = false; | 85 bool FontCache::s_useSkiaFontFallback = false; |
| 86 #endif // OS(WIN) | 86 #endif // OS(WIN) |
| 87 | 87 |
| 88 FontCache* FontCache::fontCache() | 88 FontCache* FontCache::fontCache() |
| 89 { | 89 { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeVerticalData>, IntHash<Fo
ntCache::FontFileKey>, UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey>> Fo
ntVerticalDataCache; | 180 typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeVerticalData>, IntHash<Fo
ntCache::FontFileKey>, UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey>> Fo
ntVerticalDataCache; |
| 181 | 181 |
| 182 FontVerticalDataCache& fontVerticalDataCacheInstance() | 182 FontVerticalDataCache& fontVerticalDataCacheInstance() |
| 183 { | 183 { |
| 184 DEFINE_STATIC_LOCAL(FontVerticalDataCache, fontVerticalDataCache, ()); | 184 DEFINE_STATIC_LOCAL(FontVerticalDataCache, fontVerticalDataCache, ()); |
| 185 return fontVerticalDataCache; | 185 return fontVerticalDataCache; |
| 186 } | 186 } |
| 187 | 187 |
| 188 void FontCache::setFontManager(const RefPtr<SkFontMgr>& fontManager) | 188 void FontCache::setFontManager(const RefPtr<SkFontMgr>& fontManager) |
| 189 { | 189 { |
| 190 ASSERT(!s_fontManager); | 190 DCHECK(!s_staticFontManager); |
| 191 s_fontManager = fontManager.get(); | 191 s_staticFontManager = fontManager.get(); |
| 192 // Explicitly AddRef since we're going to hold on to the object for the life
of the program. | 192 // Explicitly AddRef since we're going to hold on to the object for the life
of the program. |
| 193 s_fontManager->ref(); | 193 s_staticFontManager->ref(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 PassRefPtr<OpenTypeVerticalData> FontCache::getVerticalData(const FontFileKey& k
ey, const FontPlatformData& platformData) | 196 PassRefPtr<OpenTypeVerticalData> FontCache::getVerticalData(const FontFileKey& k
ey, const FontPlatformData& platformData) |
| 197 { | 197 { |
| 198 FontVerticalDataCache& fontVerticalDataCache = fontVerticalDataCacheInstance
(); | 198 FontVerticalDataCache& fontVerticalDataCache = fontVerticalDataCacheInstance
(); |
| 199 FontVerticalDataCache::iterator result = fontVerticalDataCache.find(key); | 199 FontVerticalDataCache::iterator result = fontVerticalDataCache.find(key); |
| 200 if (result != fontVerticalDataCache.end()) | 200 if (result != fontVerticalDataCache.end()) |
| 201 return result.get()->value; | 201 return result.get()->value; |
| 202 | 202 |
| 203 RefPtr<OpenTypeVerticalData> verticalData = OpenTypeVerticalData::create(pla
tformData); | 203 RefPtr<OpenTypeVerticalData> verticalData = OpenTypeVerticalData::create(pla
tformData); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 for (iter = gFallbackListShaperCache->begin(); | 405 for (iter = gFallbackListShaperCache->begin(); |
| 406 iter != gFallbackListShaperCache->end(); | 406 iter != gFallbackListShaperCache->end(); |
| 407 ++iter) { | 407 ++iter) { |
| 408 shapeResultCacheSize += iter->value->byteSize(); | 408 shapeResultCacheSize += iter->value->byteSize(); |
| 409 } | 409 } |
| 410 dump->AddScalar("size", "bytes", shapeResultCacheSize); | 410 dump->AddScalar("size", "bytes", shapeResultCacheSize); |
| 411 memoryDump->AddSuballocation(dump->guid(), WTF::Partitions::kAllocatedObject
PoolName); | 411 memoryDump->AddSuballocation(dump->guid(), WTF::Partitions::kAllocatedObject
PoolName); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace blink | 414 } // namespace blink |
| OLD | NEW |