Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1674)

Unified Diff: third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h

Issue 1819593002: Preload scan external css for @import (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: kouhei@ review Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9117b08c3df9761800f35a2520566af23a98033d 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,21 @@ 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(Resource*, HTMLResourcePreloader*);
+ void notifyFinished(Resource*) override;
+ void didAppendFirstData(const CSSStyleSheetResource*) override;
+ String debugName() const override { return "CSSPreloaderResourceClient"; }
+
+private:
+ Persistent<Resource> m_resource;
+ WeakPersistent<HTMLResourcePreloader> m_preloader;
+};
+
} // namespace blink
#endif

Powered by Google App Engine
This is Rietveld 408576698