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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 if (!alternateName.isEmpty()) { | 179 if (!alternateName.isEmpty()) { |
180 FontFaceCreationParams createByAlternateFamily(alternateName); | 180 FontFaceCreationParams createByAlternateFamily(alternateName); |
181 result = | 181 result = |
182 getFontPlatformData(fontDescription, createByAlternateFamily, true); | 182 getFontPlatformData(fontDescription, createByAlternateFamily, true); |
183 } | 183 } |
184 if (result) { | 184 if (result) { |
185 // Cache the result under the old name. | 185 // Cache the result under the old name. |
186 auto adding = | 186 auto adding = |
187 &gFontPlatformDataCache->add(key, SizedFontPlatformDataSet()) | 187 &gFontPlatformDataCache->add(key, SizedFontPlatformDataSet()) |
188 .storedValue->value; | 188 .storedValue->value; |
189 adding->set(roundedSize, wrapUnique(new FontPlatformData(*result))); | 189 adding->set(roundedSize, WTF::wrapUnique(new FontPlatformData(*result))); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 return result; | 193 return result; |
194 } | 194 } |
195 | 195 |
196 std::unique_ptr<FontPlatformData> FontCache::scaleFontPlatformData( | 196 std::unique_ptr<FontPlatformData> FontCache::scaleFontPlatformData( |
197 const FontPlatformData& fontPlatformData, | 197 const FontPlatformData& fontPlatformData, |
198 const FontDescription& fontDescription, | 198 const FontDescription& fontDescription, |
199 const FontFaceCreationParams& creationParams, | 199 const FontFaceCreationParams& creationParams, |
200 float fontSize) { | 200 float fontSize) { |
201 #if OS(MACOSX) | 201 #if OS(MACOSX) |
202 return createFontPlatformData(fontDescription, creationParams, fontSize); | 202 return createFontPlatformData(fontDescription, creationParams, fontSize); |
203 #else | 203 #else |
204 return makeUnique<FontPlatformData>(fontPlatformData, fontSize); | 204 return WTF::makeUnique<FontPlatformData>(fontPlatformData, fontSize); |
205 #endif | 205 #endif |
206 } | 206 } |
207 | 207 |
208 ShapeCache* FontCache::getShapeCache(const FallbackListCompositeKey& key) { | 208 ShapeCache* FontCache::getShapeCache(const FallbackListCompositeKey& key) { |
209 if (!gFallbackListShaperCache) | 209 if (!gFallbackListShaperCache) |
210 gFallbackListShaperCache = new FallbackListShaperCache; | 210 gFallbackListShaperCache = new FallbackListShaperCache; |
211 | 211 |
212 FallbackListShaperCache::iterator it = gFallbackListShaperCache->find(key); | 212 FallbackListShaperCache::iterator it = gFallbackListShaperCache->find(key); |
213 ShapeCache* result = nullptr; | 213 ShapeCache* result = nullptr; |
214 if (it == gFallbackListShaperCache->end()) { | 214 if (it == gFallbackListShaperCache->end()) { |
215 result = new ShapeCache(); | 215 result = new ShapeCache(); |
216 gFallbackListShaperCache->set(key, wrapUnique(result)); | 216 gFallbackListShaperCache->set(key, WTF::wrapUnique(result)); |
217 } else { | 217 } else { |
218 result = it->value.get(); | 218 result = it->value.get(); |
219 } | 219 } |
220 | 220 |
221 ASSERT(result); | 221 ASSERT(result); |
222 return result; | 222 return result; |
223 } | 223 } |
224 | 224 |
225 typedef HashMap<FontCache::FontFileKey, | 225 typedef HashMap<FontCache::FontFileKey, |
226 RefPtr<OpenTypeVerticalData>, | 226 RefPtr<OpenTypeVerticalData>, |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 for (iter = gFallbackListShaperCache->begin(); | 485 for (iter = gFallbackListShaperCache->begin(); |
486 iter != gFallbackListShaperCache->end(); ++iter) { | 486 iter != gFallbackListShaperCache->end(); ++iter) { |
487 shapeResultCacheSize += iter->value->byteSize(); | 487 shapeResultCacheSize += iter->value->byteSize(); |
488 } | 488 } |
489 dump->AddScalar("size", "bytes", shapeResultCacheSize); | 489 dump->AddScalar("size", "bytes", shapeResultCacheSize); |
490 memoryDump->AddSuballocation(dump->guid(), | 490 memoryDump->AddSuballocation(dump->guid(), |
491 WTF::Partitions::kAllocatedObjectPoolName); | 491 WTF::Partitions::kAllocatedObjectPoolName); |
492 } | 492 } |
493 | 493 |
494 } // namespace blink | 494 } // namespace blink |
OLD | NEW |