Chromium Code Reviews| 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..e42e5e14b4af1c1898acab09216fdaaa16002c7c 100644 |
| --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h |
| +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h |
| @@ -27,13 +27,15 @@ |
| #ifndef CSSPreloadScanner_h |
| #define CSSPreloadScanner_h |
| -#include "core/html/parser/HTMLResourcePreloader.h" |
| +#include "core/fetch/StyleSheetResourceClient.h" |
| #include "core/html/parser/HTMLToken.h" |
| +#include "core/html/parser/PreloadRequest.h" |
| #include "wtf/text/StringBuilder.h" |
| namespace blink { |
| class SegmentedString; |
| +class HTMLResourcePreloader; |
| class CSSPreloadScanner { |
| DISALLOW_NEW(); |
| @@ -80,6 +82,24 @@ 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 CSSPreloaderResourceClient : public StyleSheetResourceClient { |
|
hiroshige
2016/06/17 12:15:17
It's better to make CSSPreloaderResourceClient to
Charlie Harrison
2016/07/13 18:18:14
Done.
|
| +public: |
| + CSSPreloaderResourceClient(Resource*, HTMLResourcePreloader*); |
| + ~CSSPreloaderResourceClient(); |
| + void notifyFinished(Resource*) override; |
|
hiroshige
2016/06/17 12:15:17
notifyFinished() is not called for StyleSheetResou
Charlie Harrison
2016/07/13 18:18:14
Replaced it with setCSSStyleSheet().
|
| + void didAppendFirstData(const CSSStyleSheetResource*) override; |
| + String debugName() const override { return "CSSPreloaderResourceClient"; } |
| + |
| +private: |
| + void clearResource(); |
| + void scanCSS(const CSSStyleSheetResource*); |
| + Persistent<Resource> m_resource; |
| + WeakPersistent<HTMLResourcePreloader> m_preloader; |
| +}; |
| + |
| } // namespace blink |
| #endif |