Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontCache.cpp

Issue 1931393002: Introduce typeface cache in blink::FontCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip: others Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 FontCacheKey key = fontDescription.cacheKey(creationParams); 99 FontCacheKey key = fontDescription.cacheKey(creationParams);
100 FontPlatformData* result; 100 FontPlatformData* result;
101 bool foundResult; 101 bool foundResult;
102 { 102 {
103 // addResult's scope must end before we recurse for alternate family nam es below, 103 // addResult's scope must end before we recurse for alternate family nam es below,
104 // to avoid trigering its dtor hash-changed asserts. 104 // to avoid trigering its dtor hash-changed asserts.
105 auto addResult = gFontPlatformDataCache->add(key, nullptr); 105 auto addResult = gFontPlatformDataCache->add(key, nullptr);
106 if (addResult.isNewEntry) 106 if (addResult.isNewEntry)
107 addResult.storedValue->value = createFontPlatformData(fontDescriptio n, creationParams, fontDescription.effectiveFontSize()); 107 addResult.storedValue->value = createFontPlatformData(fontDescriptio n, creationParams);
108 108
109 result = addResult.storedValue->value.get(); 109 result = addResult.storedValue->value.get();
110 foundResult = result || !addResult.isNewEntry; 110 foundResult = result || !addResult.isNewEntry;
111 } 111 }
112 112
113 if (!foundResult && !checkingAlternateName && creationParams.creationType() == CreateFontByFamily) { 113 if (!foundResult && !checkingAlternateName && creationParams.creationType() == CreateFontByFamily) {
114 // We were unable to find a font. We have a small set of fonts that we a lias to other names, 114 // We were unable to find a font. We have a small set of fonts that we a lias to other names,
115 // e.g., Arial/Helvetica, Courier/Courier New, etc. Try looking up the f ont under the aliased name. 115 // e.g., Arial/Helvetica, Courier/Courier New, etc. Try looking up the f ont under the aliased name.
116 const AtomicString& alternateName = alternateFamilyName(creationParams.f amily()); 116 const AtomicString& alternateName = alternateFamilyName(creationParams.f amily());
117 if (!alternateName.isEmpty()) { 117 if (!alternateName.isEmpty()) {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 case USCRIPT_SIMPLIFIED_HAN: 384 case USCRIPT_SIMPLIFIED_HAN:
385 return "zh-Hans"; 385 return "zh-Hans";
386 case USCRIPT_TRADITIONAL_HAN: 386 case USCRIPT_TRADITIONAL_HAN:
387 return "zh-Hant"; 387 return "zh-Hant";
388 default: 388 default:
389 return locale.ascii(); 389 return locale.ascii();
390 } 390 }
391 } 391 }
392 392
393 } // namespace blink 393 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698