| Index: third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
|
| index 15a5aaf1d36714052c7ccaf8db2548737a75454c..78d76e8b88219bc5fe685357144cbcb61f38ac99 100644
|
| --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
|
| +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
|
| @@ -27,8 +27,10 @@
|
|
|
| #include "core/html/parser/CSSPreloadScanner.h"
|
|
|
| +#include "core/fetch/CSSStyleSheetResource.h"
|
| #include "core/fetch/FetchInitiatorTypeNames.h"
|
| #include "core/html/parser/HTMLParserIdioms.h"
|
| +#include "core/html/parser/HTMLResourcePreloader.h"
|
| #include "platform/text/SegmentedString.h"
|
|
|
| namespace blink {
|
| @@ -233,4 +235,25 @@ void CSSPreloadScanner::emitRule(const SegmentedString& source)
|
| m_ruleValue.clear();
|
| }
|
|
|
| +CSSPreloaderResourceClient::CSSPreloaderResourceClient(HTMLResourcePreloader* preloader)
|
| + : m_preloader(preloader)
|
| + , m_streamPosition(0)
|
| +{
|
| +}
|
| +
|
| +void CSSPreloaderResourceClient::didAppendData(const CSSStyleSheetResource* resource)
|
| +{
|
| + preloadChunk(resource->streamDecodedText(&m_streamPosition), resource);
|
| +}
|
| +
|
| +void CSSPreloaderResourceClient::preloadChunk(const String& chunk, const CSSStyleSheetResource* resource)
|
| +{
|
| + if (chunk.isNull())
|
| + return;
|
| + PreloadRequestStream preloads;
|
| + // TODO(csharrison): Should SegmentedString be populated?
|
| + m_cssPreloadScanner.scan(chunk, SegmentedString(), preloads, resource->response().url());
|
| + m_preloader->takeAndPreload(preloads);
|
| +}
|
| +
|
| } // namespace blink
|
|
|