Chromium Code Reviews| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 FontPlatformData* FontCache::getFontPlatformData( | 101 FontPlatformData* FontCache::getFontPlatformData( |
| 102 const FontDescription& fontDescription, | 102 const FontDescription& fontDescription, |
| 103 const FontFaceCreationParams& creationParams, | 103 const FontFaceCreationParams& creationParams, |
| 104 bool checkingAlternateName) { | 104 bool checkingAlternateName) { |
| 105 if (!gFontPlatformDataCache) { | 105 if (!gFontPlatformDataCache) { |
| 106 gFontPlatformDataCache = new FontPlatformDataCache; | 106 gFontPlatformDataCache = new FontPlatformDataCache; |
| 107 platformInit(); | 107 platformInit(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (creationParams.creationType() == CreateFontByFamily) { | |
| 111 #if !OS(MACOSX) | |
| 112 if (creationParams.family() == FontFamilyNames::system_ui) { | |
| 113 const AtomicString& actualFamily = FontCache::systemFontFamily(); | |
| 114 #if OS(LINUX) | |
| 115 if (actualFamily.isEmpty() || actualFamily == FontFamilyNames::system_ui) | |
| 116 return nullptr; | |
| 117 #else | |
| 118 DCHECK(!actualFamily.isEmpty() && | |
| 119 actualFamily != FontFamilyNames::system_ui); | |
| 120 #endif | |
| 121 return getFontPlatformData(fontDescription, | |
| 122 FontFaceCreationParams(actualFamily), true); | |
| 123 } | |
| 124 #else | |
|
drott
2016/10/18 10:16:30
Nit perhaps, but I am considering how we could mak
kojii
2016/10/18 10:37:35
Ok, it's still nesting IIUC but nest in #else migh
kojii
2016/10/18 10:42:40
Note, this part will need some re-write, since whe
| |
| 125 if (creationParams.family() == FontCache::legacySystemFontFamily()) { | |
| 126 return getFontPlatformData( | |
| 127 fontDescription, FontFaceCreationParams(FontFamilyNames::system_ui), | |
| 128 true); | |
| 129 } | |
| 130 #endif | |
| 131 } | |
| 132 | |
| 110 float size = fontDescription.effectiveFontSize(); | 133 float size = fontDescription.effectiveFontSize(); |
| 111 unsigned roundedSize = size * FontCacheKey::precisionMultiplier(); | 134 unsigned roundedSize = size * FontCacheKey::precisionMultiplier(); |
| 112 FontCacheKey key = fontDescription.cacheKey(creationParams); | 135 FontCacheKey key = fontDescription.cacheKey(creationParams); |
| 113 | 136 |
| 114 // Remove the font size from the cache key, and handle the font size | 137 // Remove the font size from the cache key, and handle the font size |
| 115 // separately in the inner HashMap. So that different size of FontPlatformData | 138 // separately in the inner HashMap. So that different size of FontPlatformData |
| 116 // can share underlying SkTypeface. | 139 // can share underlying SkTypeface. |
| 117 if (RuntimeEnabledFeatures::fontCacheScalingEnabled()) | 140 if (RuntimeEnabledFeatures::fontCacheScalingEnabled()) |
| 118 key.clearFontSize(); | 141 key.clearFontSize(); |
| 119 | 142 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 for (iter = gFallbackListShaperCache->begin(); | 472 for (iter = gFallbackListShaperCache->begin(); |
| 450 iter != gFallbackListShaperCache->end(); ++iter) { | 473 iter != gFallbackListShaperCache->end(); ++iter) { |
| 451 shapeResultCacheSize += iter->value->byteSize(); | 474 shapeResultCacheSize += iter->value->byteSize(); |
| 452 } | 475 } |
| 453 dump->AddScalar("size", "bytes", shapeResultCacheSize); | 476 dump->AddScalar("size", "bytes", shapeResultCacheSize); |
| 454 memoryDump->AddSuballocation(dump->guid(), | 477 memoryDump->AddSuballocation(dump->guid(), |
| 455 WTF::Partitions::kAllocatedObjectPoolName); | 478 WTF::Partitions::kAllocatedObjectPoolName); |
| 456 } | 479 } |
| 457 | 480 |
| 458 } // namespace blink | 481 } // namespace blink |
| OLD | NEW |