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

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

Issue 2692803005: Avoid checking family name in getLastResortFallbackFont() on Windows (Closed)
Patch Set: Created 3 years, 10 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 Computer, Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007-2008 Torch Mobile, Inc. 3 * Copyright (C) 2007-2008 Torch Mobile, Inc.
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 class FontCacheClient; 62 class FontCacheClient;
63 class FontFaceCreationParams; 63 class FontFaceCreationParams;
64 class FontPlatformData; 64 class FontPlatformData;
65 class FontDescription; 65 class FontDescription;
66 class OpenTypeVerticalData; 66 class OpenTypeVerticalData;
67 class ShapeCache; 67 class ShapeCache;
68 class SimpleFontData; 68 class SimpleFontData;
69 69
70 enum ShouldRetain { Retain, DoNotRetain }; 70 enum ShouldRetain { Retain, DoNotRetain };
71 enum PurgeSeverity { PurgeIfNeeded, ForcePurge }; 71 enum PurgeSeverity { PurgeIfNeeded, ForcePurge };
72 enum class AlternateFontName { AllowAlternate, NoAlternate, LastResort };
72 73
73 class PLATFORM_EXPORT FontCache { 74 class PLATFORM_EXPORT FontCache {
74 friend class FontCachePurgePreventer; 75 friend class FontCachePurgePreventer;
75 76
76 WTF_MAKE_NONCOPYABLE(FontCache); 77 WTF_MAKE_NONCOPYABLE(FontCache);
77 USING_FAST_MALLOC(FontCache); 78 USING_FAST_MALLOC(FontCache);
78 79
79 public: 80 public:
80 static FontCache* fontCache(); 81 static FontCache* fontCache();
81 82
82 void releaseFontData(const SimpleFontData*); 83 void releaseFontData(const SimpleFontData*);
83 84
84 // This method is implemented by the plaform and used by 85 // This method is implemented by the plaform and used by
85 // FontFastPath to lookup the font for a given character. 86 // FontFastPath to lookup the font for a given character.
86 PassRefPtr<SimpleFontData> fallbackFontForCharacter( 87 PassRefPtr<SimpleFontData> fallbackFontForCharacter(
87 const FontDescription&, 88 const FontDescription&,
88 UChar32, 89 UChar32,
89 const SimpleFontData* fontDataToSubstitute, 90 const SimpleFontData* fontDataToSubstitute,
90 FontFallbackPriority = FontFallbackPriority::Text); 91 FontFallbackPriority = FontFallbackPriority::Text);
91 92
92 // Also implemented by the platform. 93 // Also implemented by the platform.
93 void platformInit(); 94 void platformInit();
94 95
95 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, 96 PassRefPtr<SimpleFontData> getFontData(
96 const AtomicString&, 97 const FontDescription&,
97 bool checkingAlternateName = false, 98 const AtomicString&,
98 ShouldRetain = Retain); 99 AlternateFontName = AlternateFontName::AllowAlternate,
100 ShouldRetain = Retain);
99 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&, 101 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
100 ShouldRetain = Retain); 102 ShouldRetain = Retain);
101 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&); 103 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&);
102 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); 104 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&);
103 static String firstAvailableOrFirst(const String&); 105 static String firstAvailableOrFirst(const String&);
104 106
105 // Returns the ShapeCache instance associated with the given cache key. 107 // Returns the ShapeCache instance associated with the given cache key.
106 // Creates a new instance as needed and as such is guaranteed not to return 108 // Creates a new instance as needed and as such is guaranteed not to return
107 // a nullptr. Instances are managed by FontCache and are only guaranteed to 109 // a nullptr. Instances are managed by FontCache and are only guaranteed to
108 // be valid for the duration of the current session, as controlled by 110 // be valid for the duration of the current session, as controlled by
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void purge(PurgeSeverity = PurgeIfNeeded); 204 void purge(PurgeSeverity = PurgeIfNeeded);
203 205
204 void disablePurging() { m_purgePreventCount++; } 206 void disablePurging() { m_purgePreventCount++; }
205 void enablePurging() { 207 void enablePurging() {
206 ASSERT(m_purgePreventCount); 208 ASSERT(m_purgePreventCount);
207 if (!--m_purgePreventCount) 209 if (!--m_purgePreventCount)
208 purge(PurgeIfNeeded); 210 purge(PurgeIfNeeded);
209 } 211 }
210 212
211 // FIXME: This method should eventually be removed. 213 // FIXME: This method should eventually be removed.
212 FontPlatformData* getFontPlatformData(const FontDescription&, 214 FontPlatformData* getFontPlatformData(
213 const FontFaceCreationParams&, 215 const FontDescription&,
214 bool checkingAlternateName = false); 216 const FontFaceCreationParams&,
217 AlternateFontName = AlternateFontName::AllowAlternate);
215 #if !OS(MACOSX) 218 #if !OS(MACOSX)
216 FontPlatformData* systemFontPlatformData(const FontDescription&); 219 FontPlatformData* systemFontPlatformData(const FontDescription&);
217 #endif 220 #endif
218 221
219 // These methods are implemented by each platform. 222 // These methods are implemented by each platform.
220 std::unique_ptr<FontPlatformData> createFontPlatformData( 223 std::unique_ptr<FontPlatformData> createFontPlatformData(
221 const FontDescription&, 224 const FontDescription&,
222 const FontFaceCreationParams&, 225 const FontFaceCreationParams&,
223 float fontSize); 226 float fontSize,
227 AlternateFontName = AlternateFontName::AllowAlternate);
224 std::unique_ptr<FontPlatformData> scaleFontPlatformData( 228 std::unique_ptr<FontPlatformData> scaleFontPlatformData(
225 const FontPlatformData&, 229 const FontPlatformData&,
226 const FontDescription&, 230 const FontDescription&,
227 const FontFaceCreationParams&, 231 const FontFaceCreationParams&,
228 float fontSize); 232 float fontSize);
229 233
230 // Implemented on skia platforms. 234 // Implemented on skia platforms.
231 sk_sp<SkTypeface> createTypeface(const FontDescription&, 235 sk_sp<SkTypeface> createTypeface(const FontDescription&,
232 const FontFaceCreationParams&, 236 const FontFaceCreationParams&,
233 CString& name); 237 CString& name);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 public: 280 public:
277 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } 281 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); }
278 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } 282 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); }
279 }; 283 };
280 284
281 AtomicString toAtomicString(const SkString&); 285 AtomicString toAtomicString(const SkString&);
282 286
283 } // namespace blink 287 } // namespace blink
284 288
285 #endif 289 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/LocalFontFaceSource.cpp ('k') | third_party/WebKit/Source/platform/fonts/FontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698