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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 RefPtr<OpenTypeVerticalData>, | 226 RefPtr<OpenTypeVerticalData>, |
227 IntHash<FontCache::FontFileKey>, | 227 IntHash<FontCache::FontFileKey>, |
228 UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey>> | 228 UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey>> |
229 FontVerticalDataCache; | 229 FontVerticalDataCache; |
230 | 230 |
231 FontVerticalDataCache& fontVerticalDataCacheInstance() { | 231 FontVerticalDataCache& fontVerticalDataCacheInstance() { |
232 DEFINE_STATIC_LOCAL(FontVerticalDataCache, fontVerticalDataCache, ()); | 232 DEFINE_STATIC_LOCAL(FontVerticalDataCache, fontVerticalDataCache, ()); |
233 return fontVerticalDataCache; | 233 return fontVerticalDataCache; |
234 } | 234 } |
235 | 235 |
236 void FontCache::setFontManager(const sk_sp<SkFontMgr>& fontManager) { | 236 void FontCache::setFontManager(sk_sp<SkFontMgr> fontManager) { |
237 DCHECK(!s_staticFontManager); | 237 DCHECK(!s_staticFontManager); |
238 s_staticFontManager = fontManager.get(); | 238 s_staticFontManager = fontManager.release(); |
239 // Explicitly AddRef since we're going to hold on to the object for the life | |
240 // of the program. | |
241 s_staticFontManager->ref(); | |
242 } | 239 } |
243 | 240 |
244 PassRefPtr<OpenTypeVerticalData> FontCache::getVerticalData( | 241 PassRefPtr<OpenTypeVerticalData> FontCache::getVerticalData( |
245 const FontFileKey& key, | 242 const FontFileKey& key, |
246 const FontPlatformData& platformData) { | 243 const FontPlatformData& platformData) { |
247 FontVerticalDataCache& fontVerticalDataCache = | 244 FontVerticalDataCache& fontVerticalDataCache = |
248 fontVerticalDataCacheInstance(); | 245 fontVerticalDataCacheInstance(); |
249 FontVerticalDataCache::iterator result = fontVerticalDataCache.find(key); | 246 FontVerticalDataCache::iterator result = fontVerticalDataCache.find(key); |
250 if (result != fontVerticalDataCache.end()) | 247 if (result != fontVerticalDataCache.end()) |
251 return result.get()->value; | 248 return result.get()->value; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 for (iter = gFallbackListShaperCache->begin(); | 482 for (iter = gFallbackListShaperCache->begin(); |
486 iter != gFallbackListShaperCache->end(); ++iter) { | 483 iter != gFallbackListShaperCache->end(); ++iter) { |
487 shapeResultCacheSize += iter->value->byteSize(); | 484 shapeResultCacheSize += iter->value->byteSize(); |
488 } | 485 } |
489 dump->AddScalar("size", "bytes", shapeResultCacheSize); | 486 dump->AddScalar("size", "bytes", shapeResultCacheSize); |
490 memoryDump->AddSuballocation(dump->guid(), | 487 memoryDump->AddSuballocation(dump->guid(), |
491 WTF::Partitions::kAllocatedObjectPoolName); | 488 WTF::Partitions::kAllocatedObjectPoolName); |
492 } | 489 } |
493 | 490 |
494 } // namespace blink | 491 } // namespace blink |
OLD | NEW |