| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // registered at this FontResource. Associating the same URL to different | 63 // registered at this FontResource. Associating the same URL to different |
| 64 // font-family causes the case, but we treat them as indivisual resources. | 64 // font-family causes the case, but we treat them as indivisual resources. |
| 65 m_histograms.loadStarted(); | 65 m_histograms.loadStarted(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void RemoteFontFaceSource::fontLoaded(FontResource*) | 68 void RemoteFontFaceSource::fontLoaded(FontResource*) |
| 69 { | 69 { |
| 70 m_histograms.recordRemoteFont(m_font.get()); | 70 m_histograms.recordRemoteFont(m_font.get()); |
| 71 | 71 |
| 72 pruneTable(); | 72 pruneTable(); |
| 73 if (m_face) | 73 if (m_face) { |
| 74 m_fontLoader->fontFaceInvalidated(); |
| 74 m_face->fontLoaded(this); | 75 m_face->fontLoaded(this); |
| 76 } |
| 75 } | 77 } |
| 76 | 78 |
| 77 void RemoteFontFaceSource::fontLoadWaitLimitExceeded(FontResource*) | 79 void RemoteFontFaceSource::fontLoadWaitLimitExceeded(FontResource*) |
| 78 { | 80 { |
| 79 pruneTable(); | 81 pruneTable(); |
| 80 if (m_face) | 82 if (m_face) { |
| 83 m_fontLoader->fontFaceInvalidated(); |
| 81 m_face->fontLoadWaitLimitExceeded(this); | 84 m_face->fontLoadWaitLimitExceeded(this); |
| 85 } |
| 82 | 86 |
| 83 m_histograms.recordFallbackTime(m_font.get()); | 87 m_histograms.recordFallbackTime(m_font.get()); |
| 84 } | 88 } |
| 85 | 89 |
| 86 PassRefPtr<SimpleFontData> RemoteFontFaceSource::createFontData(const FontDescri
ption& fontDescription) | 90 PassRefPtr<SimpleFontData> RemoteFontFaceSource::createFontData(const FontDescri
ption& fontDescription) |
| 87 { | 91 { |
| 88 if (!isLoaded()) | 92 if (!isLoaded()) |
| 89 return createLoadingFallbackFontData(fontDescription); | 93 return createLoadingFallbackFontData(fontDescription); |
| 90 | 94 |
| 91 // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef
. | 95 // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef
. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (size < 50 * 1024) | 184 if (size < 50 * 1024) |
| 181 return "WebFont.DownloadTime.1.10KBTo50KB"; | 185 return "WebFont.DownloadTime.1.10KBTo50KB"; |
| 182 if (size < 100 * 1024) | 186 if (size < 100 * 1024) |
| 183 return "WebFont.DownloadTime.2.50KBTo100KB"; | 187 return "WebFont.DownloadTime.2.50KBTo100KB"; |
| 184 if (size < 1024 * 1024) | 188 if (size < 1024 * 1024) |
| 185 return "WebFont.DownloadTime.3.100KBTo1MB"; | 189 return "WebFont.DownloadTime.3.100KBTo1MB"; |
| 186 return "WebFont.DownloadTime.4.Over1MB"; | 190 return "WebFont.DownloadTime.4.Over1MB"; |
| 187 } | 191 } |
| 188 | 192 |
| 189 } // namespace WebCore | 193 } // namespace WebCore |
| OLD | NEW |