| Index: third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h
|
| diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h
|
| index b56ef885e8301e0609db0e85ab6ab34b236d835f..f53cf262eaf78769ec4a8746577bac08e165fd84 100644
|
| --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h
|
| +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h
|
| @@ -27,13 +27,18 @@
|
| #ifndef CSSPreloadScanner_h
|
| #define CSSPreloadScanner_h
|
|
|
| -#include "core/html/parser/HTMLResourcePreloader.h"
|
| +#include "core/fetch/CSSStyleSheetResource.h"
|
| +#include "core/fetch/ResourceOwner.h"
|
| +#include "core/fetch/StyleSheetResourceClient.h"
|
| #include "core/html/parser/HTMLToken.h"
|
| +#include "core/html/parser/PreloadRequest.h"
|
| +#include "platform/heap/Handle.h"
|
| #include "wtf/text/StringBuilder.h"
|
|
|
| namespace blink {
|
|
|
| class SegmentedString;
|
| +class HTMLResourcePreloader;
|
|
|
| class CSSPreloadScanner {
|
| DISALLOW_NEW();
|
| @@ -80,6 +85,31 @@ private:
|
| const KURL* m_predictedBaseElementURL = nullptr;
|
| };
|
|
|
| +// Each CSSPreloaderResourceClient keeps track of a single CSS resource, and
|
| +// drives a CSSPreloadScanner as raw data arrives for it. This lets us preload
|
| +// @import tags before parsing.
|
| +class CORE_EXPORT CSSPreloaderResourceClient : public GarbageCollectedFinalized<CSSPreloaderResourceClient>, public ResourceOwner<CSSStyleSheetResource, StyleSheetResourceClient> {
|
| + USING_GARBAGE_COLLECTED_MIXIN(CSSPreloaderResourceClient);
|
| +public:
|
| + CSSPreloaderResourceClient(Resource*, HTMLResourcePreloader*);
|
| + ~CSSPreloaderResourceClient();
|
| + void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CSSStyleSheetResource*) override;
|
| + void didAppendFirstData(const CSSStyleSheetResource*) override;
|
| + String debugName() const override { return "CSSPreloaderResourceClient"; }
|
| +
|
| + DECLARE_TRACE();
|
| +
|
| +protected:
|
| + // Protected for tests, which don't want to initialize a fully featured
|
| + // DocumentLoader.
|
| + virtual void fetchPreloads(PreloadRequestStream& preloads);
|
| +
|
| +private:
|
| + void scanCSS(const CSSStyleSheetResource*);
|
| +
|
| + WeakMember<HTMLResourcePreloader> m_preloader;
|
| +};
|
| +
|
| } // namespace blink
|
|
|
| #endif
|
|
|