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 16 matching lines...) Expand all Loading... |
27 { | 27 { |
28 m_font->removeClient(this); | 28 m_font->removeClient(this); |
29 pruneTable(); | 29 pruneTable(); |
30 } | 30 } |
31 | 31 |
32 void RemoteFontFaceSource::pruneTable() | 32 void RemoteFontFaceSource::pruneTable() |
33 { | 33 { |
34 if (m_fontDataTable.isEmpty()) | 34 if (m_fontDataTable.isEmpty()) |
35 return; | 35 return; |
36 | 36 |
37 for (FontDataTable::iterator it = m_fontDataTable.begin(); it != m_fontDataT
able.end(); ++it) { | 37 for (const auto& item : m_fontDataTable) { |
38 SimpleFontData* fontData = it->value.get(); | 38 SimpleFontData* fontData = item.value.get(); |
39 if (fontData && fontData->customFontData()) | 39 if (fontData && fontData->customFontData()) |
40 fontData->customFontData()->clearFontFaceSource(); | 40 fontData->customFontData()->clearFontFaceSource(); |
41 } | 41 } |
42 m_fontDataTable.clear(); | 42 m_fontDataTable.clear(); |
43 } | 43 } |
44 | 44 |
45 bool RemoteFontFaceSource::isLoading() const | 45 bool RemoteFontFaceSource::isLoading() const |
46 { | 46 { |
47 return !m_font->stillNeedsLoad() && !m_font->isLoaded(); | 47 return !m_font->stillNeedsLoad() && !m_font->isLoaded(); |
48 } | 48 } |
(...skipping 139 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 |