summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/html/parser/html_document_parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/parser/html_document_parser.h')
-rw-r--r--chromium/third_party/blink/renderer/core/html/parser/html_document_parser.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/parser/html_document_parser.h b/chromium/third_party/blink/renderer/core/html/parser/html_document_parser.h
index cac43e4b796..97ebb884b7f 100644
--- a/chromium/third_party/blink/renderer/core/html/parser/html_document_parser.h
+++ b/chromium/third_party/blink/renderer/core/html/parser/html_document_parser.h
@@ -67,6 +67,13 @@ class HTMLResourcePreloader;
class HTMLTreeBuilder;
class HTMLDocumentParserState;
+enum ParserPrefetchPolicy {
+ // Indicates that prefetches/preloads should happen for this document type.
+ kAllowPrefetching,
+ // Indicates that prefetches are forbidden for this document type.
+ kDisallowPrefetching
+};
+
// TODO(https://crbug.com/1049898): These are only exposed to make it possible
// to delete an expired histogram. The test should be rewritten to test at a
// different level, so it won't have to make assertions about internal state.
@@ -78,10 +85,13 @@ class CORE_EXPORT HTMLDocumentParser : public ScriptableDocumentParser,
USING_PRE_FINALIZER(HTMLDocumentParser, Dispose);
public:
- HTMLDocumentParser(HTMLDocument&, ParserSynchronizationPolicy);
+ HTMLDocumentParser(HTMLDocument&,
+ ParserSynchronizationPolicy,
+ ParserPrefetchPolicy prefetch_policy = kAllowPrefetching);
HTMLDocumentParser(DocumentFragment*,
Element* context_element,
- ParserContentPolicy);
+ ParserContentPolicy,
+ ParserPrefetchPolicy prefetch_policy = kAllowPrefetching);
~HTMLDocumentParser() override;
void Trace(Visitor*) const override;
@@ -156,7 +166,10 @@ class CORE_EXPORT HTMLDocumentParser : public ScriptableDocumentParser,
private:
HTMLDocumentParser(Document&,
ParserContentPolicy,
- ParserSynchronizationPolicy);
+ ParserSynchronizationPolicy,
+ ParserPrefetchPolicy);
+
+ enum NextTokenStatus { NoTokens, HaveTokens, HaveTokensAfterScript };
// DocumentParser
void Detach() final;
@@ -194,7 +207,7 @@ class CORE_EXPORT HTMLDocumentParser : public ScriptableDocumentParser,
bool*);
void PumpPendingSpeculations();
- bool CanTakeNextToken();
+ NextTokenStatus CanTakeNextToken();
bool PumpTokenizer();
void PumpTokenizerIfPossible();
void DeferredPumpTokenizerIfPossible();
@@ -228,7 +241,7 @@ class CORE_EXPORT HTMLDocumentParser : public ScriptableDocumentParser,
std::unique_ptr<HTMLPreloadScanner> CreatePreloadScanner(
TokenPreloadScanner::ScannerType);
- // Let the given HTMLPreloadScanner scan the input it has, and then preloads
+ // Let the given HTMLPreloadScanner scan the input it has, and then preload
// resources using the resulting PreloadRequests and |preloader_|.
void ScanAndPreload(HTMLPreloadScanner*);
void FetchQueuedPreloads();