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..c969af88ebf487e64fae3156fd78d13b739d075a 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_input(adoptPtr(new SegmentedString)) |
|
eseidel
2014/05/20 07:10:37
You might want to name this m_preloaderInput? Sin
|
| , m_disabledState(Unset) |
| , m_pendingSheetType(None) |
| , m_loading(false) |
| @@ -502,6 +504,21 @@ 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.get()) { |
|
eseidel
2014/05/20 06:27:04
Normally these are written as early returns.
if (
|
| + PreloadRequestStream pendingPreloads; |
| + m_input->append(SegmentedString(data)); |
| + m_preloadScanner->scan(data, *m_input, pendingPreloads); |
| + HTMLResourcePreloader m_preloader(&document()); |
| + m_preloader.takeAndPreload(pendingPreloads); |
| + if (m_preloadScanner->isDoneParsing()) { |
|
eseidel
2014/05/20 06:27:04
I'm not familiar with this method. How does the p
|
| + m_preloadScanner.clear(); |
| + m_input.clear(); |
| + } |
| + } |
| +} |
| + |
| bool LinkStyle::sheetLoaded() |
| { |
| if (!styleSheetIsLoading()) { |