OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/css/RemoteFontFaceSource.h" | 6 #include "core/css/RemoteFontFaceSource.h" |
7 | 7 |
8 #include "core/css/CSSCustomFontData.h" | 8 #include "core/css/CSSCustomFontData.h" |
9 #include "core/css/CSSFontFace.h" | 9 #include "core/css/CSSFontFace.h" |
10 #include "core/css/FontLoader.h" | 10 #include "core/css/FontLoader.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef
. | 95 // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef
. |
96 if (!m_font->ensureCustomFontData()) | 96 if (!m_font->ensureCustomFontData()) |
97 return nullptr; | 97 return nullptr; |
98 | 98 |
99 m_histograms.recordFallbackTime(m_font.get()); | 99 m_histograms.recordFallbackTime(m_font.get()); |
100 | 100 |
101 return SimpleFontData::create( | 101 return SimpleFontData::create( |
102 m_font->platformDataFromCustomData(fontDescription.effectiveFontSize(), | 102 m_font->platformDataFromCustomData(fontDescription.effectiveFontSize(), |
103 fontDescription.isSyntheticBold(), fontDescription.isSyntheticItalic
(), | 103 fontDescription.isSyntheticBold(), fontDescription.isSyntheticItalic
(), |
104 fontDescription.orientation(), fontDescription.widthVariant()), Cust
omFontData::create()); | 104 fontDescription.orientation()), CustomFontData::create()); |
105 } | 105 } |
106 | 106 |
107 PassRefPtr<SimpleFontData> RemoteFontFaceSource::createLoadingFallbackFontData(c
onst FontDescription& fontDescription) | 107 PassRefPtr<SimpleFontData> RemoteFontFaceSource::createLoadingFallbackFontData(c
onst FontDescription& fontDescription) |
108 { | 108 { |
109 // This temporary font is not retained and should not be returned. | 109 // This temporary font is not retained and should not be returned. |
110 FontCachePurgePreventer fontCachePurgePreventer; | 110 FontCachePurgePreventer fontCachePurgePreventer; |
111 SimpleFontData* temporaryFont = FontCache::fontCache()->getNonRetainedLastRe
sortFallbackFont(fontDescription); | 111 SimpleFontData* temporaryFont = FontCache::fontCache()->getNonRetainedLastRe
sortFallbackFont(fontDescription); |
112 if (!temporaryFont) { | 112 if (!temporaryFont) { |
113 ASSERT_NOT_REACHED(); | 113 ASSERT_NOT_REACHED(); |
114 return nullptr; | 114 return nullptr; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if (size < 50 * 1024) | 188 if (size < 50 * 1024) |
189 return "WebFont.DownloadTime.1.10KBTo50KB"; | 189 return "WebFont.DownloadTime.1.10KBTo50KB"; |
190 if (size < 100 * 1024) | 190 if (size < 100 * 1024) |
191 return "WebFont.DownloadTime.2.50KBTo100KB"; | 191 return "WebFont.DownloadTime.2.50KBTo100KB"; |
192 if (size < 1024 * 1024) | 192 if (size < 1024 * 1024) |
193 return "WebFont.DownloadTime.3.100KBTo1MB"; | 193 return "WebFont.DownloadTime.3.100KBTo1MB"; |
194 return "WebFont.DownloadTime.4.Over1MB"; | 194 return "WebFont.DownloadTime.4.Over1MB"; |
195 } | 195 } |
196 | 196 |
197 } // namespace blink | 197 } // namespace blink |
OLD | NEW |