OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010, 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // We don't want to check alternate font family names here, so pass true
as the checkingAlternateName parameter. | 137 // We don't want to check alternate font family names here, so pass true
as the checkingAlternateName parameter. |
138 RefPtr<SimpleFontData> fontData = FontCache::fontCache()->getFontData(fo
ntDescription, m_string, true); | 138 RefPtr<SimpleFontData> fontData = FontCache::fontCache()->getFontData(fo
ntDescription, m_string, true); |
139 m_histograms.recordLocalFont(fontData); | 139 m_histograms.recordLocalFont(fontData); |
140 return fontData; | 140 return fontData; |
141 } | 141 } |
142 | 142 |
143 // See if we have a mapping in our FontData cache. | 143 // See if we have a mapping in our FontData cache. |
144 AtomicString emptyFontFamily = ""; | 144 AtomicString emptyFontFamily = ""; |
145 FontCacheKey key = fontDescription.cacheKey(emptyFontFamily); | 145 FontCacheKey key = fontDescription.cacheKey(emptyFontFamily); |
146 | 146 |
147 RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(key.hash(), 0).iterat
or->value; | 147 RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(key.hash(), 0).stored
Value->value; |
148 if (fontData) | 148 if (fontData) |
149 return fontData; // No release, because fontData is a reference to a Ref
Ptr that is held in the m_fontDataTable. | 149 return fontData; // No release, because fontData is a reference to a Ref
Ptr that is held in the m_fontDataTable. |
150 | 150 |
151 // If we are still loading, then we let the system pick a font. | 151 // If we are still loading, then we let the system pick a font. |
152 if (isLoaded()) { | 152 if (isLoaded()) { |
153 if (m_font) { | 153 if (m_font) { |
154 #if ENABLE(SVG_FONTS) | 154 #if ENABLE(SVG_FONTS) |
155 if (m_hasExternalSVGFont) { | 155 if (m_hasExternalSVGFont) { |
156 // For SVG fonts parse the external SVG document, and extract th
e <font> element. | 156 // For SVG fonts parse the external SVG document, and extract th
e <font> element. |
157 if (!m_font->ensureSVGFontData()) | 157 if (!m_font->ensureSVGFontData()) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 if (size < 50 * 1024) | 312 if (size < 50 * 1024) |
313 return "WebFont.DownloadTime.1.10KBTo50KB"; | 313 return "WebFont.DownloadTime.1.10KBTo50KB"; |
314 if (size < 100 * 1024) | 314 if (size < 100 * 1024) |
315 return "WebFont.DownloadTime.2.50KBTo100KB"; | 315 return "WebFont.DownloadTime.2.50KBTo100KB"; |
316 if (size < 1024 * 1024) | 316 if (size < 1024 * 1024) |
317 return "WebFont.DownloadTime.3.100KBTo1MB"; | 317 return "WebFont.DownloadTime.3.100KBTo1MB"; |
318 return "WebFont.DownloadTime.4.Over1MB"; | 318 return "WebFont.DownloadTime.4.Over1MB"; |
319 } | 319 } |
320 | 320 |
321 } | 321 } |
OLD | NEW |