Index: Source/core/css/FontLoader.cpp |
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp |
index 8646bfac6081351779dfab144ff835b6477edbc5..247ab09ff9021bdd0c1e21df5386785b23abb7de 100644 |
--- a/Source/core/css/FontLoader.cpp |
+++ b/Source/core/css/FontLoader.cpp |
@@ -26,20 +26,20 @@ FontLoader::~FontLoader() |
return; |
} |
m_beginLoadingTimer.stop(); |
- |
- // When the m_fontsToBeginLoading vector is destroyed it will decrement the |
- // request counts on the ResourceFetcher for all the fonts that were pending |
- // at the time the FontLoader dies. |
+ // This will decrement the request counts on the ResourceFetcher for all the |
+ // fonts that were pending at the time the FontLoader dies. |
+ clearPendingFonts(); |
#endif |
} |
void FontLoader::addFontToBeginLoading(FontResource* fontResource) |
{ |
- if (!m_resourceFetcher || !fontResource->stillNeedsLoad()) |
+ if (!m_resourceFetcher || !fontResource->stillNeedsLoad() || fontResource->loadScheduled()) |
return; |
m_fontsToBeginLoading.append( |
std::make_pair(fontResource, ResourceLoader::RequestCountTracker(m_resourceFetcher, fontResource))); |
+ fontResource->setLoadScheduled(true); |
if (!m_beginLoadingTimer.isActive()) |
m_beginLoadingTimer.startOneShot(0, FROM_HERE); |
} |
@@ -80,12 +80,19 @@ void FontLoader::clearResourceFetcherAndFontSelector() |
} |
m_beginLoadingTimer.stop(); |
- m_fontsToBeginLoading.clear(); |
+ clearPendingFonts(); |
m_resourceFetcher = nullptr; |
m_fontSelector = nullptr; |
} |
#endif |
+void FontLoader::clearPendingFonts() |
+{ |
+ for (FontsToLoadVector::iterator it = m_fontsToBeginLoading.begin(); it != m_fontsToBeginLoading.end(); ++it) |
+ it->first->setLoadScheduled(false); |
+ m_fontsToBeginLoading.clear(); |
+} |
+ |
void FontLoader::trace(Visitor* visitor) |
{ |
visitor->trace(m_resourceFetcher); |