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..8a2bb3e2c99555276817edcfae14e258b4a96764 100644 |
--- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h |
+++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h |
@@ -27,17 +27,19 @@ |
#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(); |
WTF_MAKE_NONCOPYABLE(CSSPreloadScanner); |
+ DISALLOW_NEW(); |
Yoav Weiss
2016/03/30 21:38:31
spurious change or is the order here meaningful?
Charlie Harrison
2016/03/31 03:59:59
Oops, spurious. Sorry.
|
public: |
CSSPreloadScanner(); |
~CSSPreloadScanner(); |
@@ -80,6 +82,22 @@ 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 { |
+public: |
+ CSSPreloaderResourceClient(HTMLResourcePreloader*); |
+ void didAppendData(const CSSStyleSheetResource*) override; |
+ String debugName() const override { return "CSSPreloaderResourceClient"; } |
+ |
+private: |
+ void preloadChunk(const String& chunk, const CSSStyleSheetResource*); |
+ CSSPreloadScanner m_cssPreloadScanner; |
+ RawPtrWillBeWeakPersistent<HTMLResourcePreloader> m_preloader; |
+ size_t m_streamPosition; |
+}; |
+ |
} // namespace blink |
#endif |