| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // FIXME: Use RequestCountTracker??!! | 63 // FIXME: Use RequestCountTracker??!! |
| 64 // Increment the request count now, in order to prevent didFinishLoad from b
eing dispatched | 64 // Increment the request count now, in order to prevent didFinishLoad from b
eing dispatched |
| 65 // after this font has been requested but before it began loading. Balanced
by | 65 // after this font has been requested but before it began loading. Balanced
by |
| 66 // decrementRequestCount() in beginLoadTimerFired() and in clearDocument(). | 66 // decrementRequestCount() in beginLoadTimerFired() and in clearDocument(). |
| 67 m_resourceFetcher->incrementRequestCount(fontResource); | 67 m_resourceFetcher->incrementRequestCount(fontResource); |
| 68 m_beginLoadingTimer.startOneShot(0); | 68 m_beginLoadingTimer.startOneShot(0); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void FontLoader::beginLoadTimerFired(Timer<WebCore::FontLoader>*) | 71 void FontLoader::beginLoadTimerFired(Timer<WebCore::FontLoader>*) |
| 72 { | 72 { |
| 73 loadPendingFonts(); |
| 74 } |
| 75 |
| 76 void FontLoader::loadPendingFonts() |
| 77 { |
| 73 ASSERT(m_resourceFetcher); | 78 ASSERT(m_resourceFetcher); |
| 74 | 79 |
| 75 Vector<ResourcePtr<FontResource> > fontsToBeginLoading; | 80 Vector<ResourcePtr<FontResource> > fontsToBeginLoading; |
| 76 fontsToBeginLoading.swap(m_fontsToBeginLoading); | 81 fontsToBeginLoading.swap(m_fontsToBeginLoading); |
| 77 | 82 |
| 78 for (size_t i = 0; i < fontsToBeginLoading.size(); ++i) { | 83 for (size_t i = 0; i < fontsToBeginLoading.size(); ++i) { |
| 79 fontsToBeginLoading[i]->beginLoadIfNeeded(m_resourceFetcher); | 84 fontsToBeginLoading[i]->beginLoadIfNeeded(m_resourceFetcher); |
| 80 // Balances incrementRequestCount() in beginLoadingFontSoon(). | 85 // Balances incrementRequestCount() in beginLoadingFontSoon(). |
| 81 m_resourceFetcher->decrementRequestCount(fontsToBeginLoading[i].get()); | 86 m_resourceFetcher->decrementRequestCount(fontsToBeginLoading[i].get()); |
| 82 } | 87 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 { | 180 { |
| 176 m_fontLoader.clearResourceFetcher(); | 181 m_fontLoader.clearResourceFetcher(); |
| 177 m_document = 0; | 182 m_document = 0; |
| 178 } | 183 } |
| 179 | 184 |
| 180 void CSSFontSelector::beginLoadingFontSoon(FontResource* font) | 185 void CSSFontSelector::beginLoadingFontSoon(FontResource* font) |
| 181 { | 186 { |
| 182 m_fontLoader.addFontToBeginLoading(font); | 187 m_fontLoader.addFontToBeginLoading(font); |
| 183 } | 188 } |
| 184 | 189 |
| 190 void CSSFontSelector::loadPendingFonts() |
| 191 { |
| 192 m_fontLoader.loadPendingFonts(); |
| 185 } | 193 } |
| 194 |
| 195 } |
| OLD | NEW |