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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return nullptr; 141 return nullptr;
142 } 142 }
143 143
144 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescri ption& description, ShouldRetain shouldRetain) 144 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescri ption& description, ShouldRetain shouldRetain)
145 { 145 {
146 const FontFaceCreationParams fallbackCreationParams(getFallbackFontFamily(de scription)); 146 const FontFaceCreationParams fallbackCreationParams(getFallbackFontFamily(de scription));
147 const FontPlatformData* fontPlatformData = getFontPlatformData(description, fallbackCreationParams); 147 const FontPlatformData* fontPlatformData = getFontPlatformData(description, fallbackCreationParams);
148 148
149 // We should at least have Sans or Arial which is the last resort fallback o f SkFontHost ports. 149 // We should at least have Sans or Arial which is the last resort fallback o f SkFontHost ports.
150 if (!fontPlatformData) { 150 if (!fontPlatformData) {
151 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, sansCreationParams, (A tomicString("Sans", AtomicString::ConstructFromLiteral))); 151 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, sansCreationParams, (A tomicString("Sans")));
152 fontPlatformData = getFontPlatformData(description, sansCreationParams); 152 fontPlatformData = getFontPlatformData(description, sansCreationParams);
153 } 153 }
154 if (!fontPlatformData) { 154 if (!fontPlatformData) {
155 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, arialCreationParams, ( AtomicString("Arial", AtomicString::ConstructFromLiteral))); 155 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, arialCreationParams, ( AtomicString("Arial")));
156 fontPlatformData = getFontPlatformData(description, arialCreationParams) ; 156 fontPlatformData = getFontPlatformData(description, arialCreationParams) ;
157 } 157 }
158 #if OS(WIN) 158 #if OS(WIN)
159 // Try some more Windows-specific fallbacks. 159 // Try some more Windows-specific fallbacks.
160 if (!fontPlatformData) { 160 if (!fontPlatformData) {
161 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, msuigothicCreationPara ms, (AtomicString("MS UI Gothic", AtomicString::ConstructFromLiteral))); 161 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, msuigothicCreationPara ms, (AtomicString("MS UI Gothic")));
162 fontPlatformData = getFontPlatformData(description, msuigothicCreationPa rams); 162 fontPlatformData = getFontPlatformData(description, msuigothicCreationPa rams);
163 } 163 }
164 if (!fontPlatformData) { 164 if (!fontPlatformData) {
165 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, mssansserifCreationPar ams, (AtomicString("Microsoft Sans Serif", AtomicString::ConstructFromLiteral))) ; 165 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, mssansserifCreationPar ams, (AtomicString("Microsoft Sans Serif")));
166 fontPlatformData = getFontPlatformData(description, mssansserifCreationP arams); 166 fontPlatformData = getFontPlatformData(description, mssansserifCreationP arams);
167 } 167 }
168 #endif 168 #endif
169 169
170 ASSERT(fontPlatformData); 170 ASSERT(fontPlatformData);
171 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); 171 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain);
172 } 172 }
173 173
174 #if OS(WIN) || OS(LINUX) 174 #if OS(WIN) || OS(LINUX)
175 static inline SkFontStyle fontStyle(const FontDescription& fontDescription) 175 static inline SkFontStyle fontStyle(const FontDescription& fontDescription)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 name.data(), 258 name.data(),
259 fontSize, 259 fontSize,
260 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(), 260 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(),
261 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), 261 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(),
262 fontDescription.orientation(), 262 fontDescription.orientation(),
263 fontDescription.useSubpixelPositioning())); 263 fontDescription.useSubpixelPositioning()));
264 } 264 }
265 #endif // !OS(WIN) 265 #endif // !OS(WIN)
266 266
267 } // namespace blink 267 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698