Chromium Code Reviews| Index: Source/core/fetch/CSSStyleSheetResource.cpp |
| diff --git a/Source/core/fetch/CSSStyleSheetResource.cpp b/Source/core/fetch/CSSStyleSheetResource.cpp |
| index 1370b3bcb575081c6f1010f5c8ca43daac71b92b..62ca20f392603f71c859026240fc9a12bf009a50 100644 |
| --- a/Source/core/fetch/CSSStyleSheetResource.cpp |
| +++ b/Source/core/fetch/CSSStyleSheetResource.cpp |
| @@ -33,14 +33,18 @@ |
| #include "core/html/parser/TextResourceDecoder.h" |
| #include "platform/SharedBuffer.h" |
| #include "platform/network/HTTPParsers.h" |
| +#include "platform/text/SegmentedString.h" |
| #include "wtf/CurrentTime.h" |
| #include "wtf/Vector.h" |
| namespace WebCore { |
| -CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequest, const String& charset) |
| +CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequest, const String& charset, Document* document) |
| : StyleSheetResource(resourceRequest, CSSStyleSheet) |
| , m_decoder(TextResourceDecoder::create("text/css", charset)) |
| + , m_preloadScanner(adoptPtr(new CSSPreloadScanner)) |
| + , m_preloader(adoptPtr(new HTMLResourcePreloader(document))) |
|
abarth-chromium
2014/02/26 19:13:36
Why do we create these objects in the case where w
|
| + , m_prescan(document ? true : false) |
|
abarth-chromium
2014/02/26 19:13:36
There's no reason to write foo ? true : false. If
|
| { |
| DEFINE_STATIC_LOCAL(const AtomicString, acceptCSS, ("text/css,*/*;q=0.1", AtomicString::ConstructFromLiteral)); |
| @@ -124,6 +128,17 @@ void CSSStyleSheetResource::destroyDecodedDataIfPossible() |
| setDecodedSize(0); |
| } |
| +void CSSStyleSheetResource::appendData(const char* data, int length) |
| +{ |
| + Resource::appendData(data, length); |
| + if (m_prescan) { |
| + m_prescan = false; |
| + PreloadRequestStream pendingPreloads; |
| + m_preloadScanner->scan(data, SegmentedString(data), pendingPreloads); |
| + m_preloader->takeAndPreload(pendingPreloads); |
|
abarth-chromium
2014/02/26 19:13:36
Whey don't we destroy these objects when we're don
|
| + } |
| +} |
| + |
| bool CSSStyleSheetResource::canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const |
| { |
| if (errorOccurred()) |