Chromium Code Reviews| Index: Source/core/html/HTMLLinkElement.cpp |
| diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp |
| index 3ee6600b7302235de6b0ff3d4cefcf801407c2f1..dfdd1bd416601b9bb0dbed3839d415652f090659 100644 |
| --- a/Source/core/html/HTMLLinkElement.cpp |
| +++ b/Source/core/html/HTMLLinkElement.cpp |
| @@ -436,6 +436,8 @@ PassOwnPtrWillBeRawPtr<LinkStyle> LinkStyle::create(HTMLLinkElement* owner) |
| LinkStyle::LinkStyle(HTMLLinkElement* owner) |
| : LinkResource(owner) |
| + , m_preloadScanner(adoptPtr(new CSSPreloadScanner)) |
| + , m_preloadInput(adoptPtr(new SegmentedString)) |
| , m_disabledState(Unset) |
| , m_pendingSheetType(None) |
| , m_loading(false) |
| @@ -502,6 +504,23 @@ void LinkStyle::setCSSStyleSheet(const String& href, const KURL& baseURL, const |
| const_cast<CSSStyleSheetResource*>(cachedStyleSheet)->saveParsedStyleSheet(styleSheet); |
| } |
| +void LinkStyle::dataReceived(const CSSStyleSheetResource* cachedStyleSheet, const char* data, int length) |
| +{ |
| + if (!m_preloadScanner) |
| + return; |
| + |
| + PreloadRequestStream pendingPreloads; |
| + m_preloadInput->append(SegmentedString(data)); |
|
abarth-chromium
2014/06/26 16:37:59
Why don't we need to use |length| on this line?
|
| + m_preloadScanner->scan(data, *m_preloadInput, pendingPreloads); |
| + HTMLResourcePreloader m_preloader(&document()); |
| + m_preloader.takeAndPreload(pendingPreloads); |
| + |
| + if (m_preloadScanner->isDoneParsingImports()) { |
|
eseidel
2014/05/28 23:52:52
Could you explain the magic here a bit more?
// N
|
| + m_preloadScanner.clear(); |
| + m_preloadInput.clear(); |
| + } |
| +} |
| + |
| bool LinkStyle::sheetLoaded() |
| { |
| if (!styleSheetIsLoading()) { |