| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 class Element; | 60 class Element; |
| 61 class HTMLDocument; | 61 class HTMLDocument; |
| 62 class HTMLParserScheduler; | 62 class HTMLParserScheduler; |
| 63 class HTMLResourcePreloader; | 63 class HTMLResourcePreloader; |
| 64 class HTMLScriptRunner; | 64 class HTMLScriptRunner; |
| 65 class HTMLTreeBuilder; | 65 class HTMLTreeBuilder; |
| 66 class ParsedChunkQueue; | 66 class ParsedChunkQueue; |
| 67 class PumpSession; | 67 class PumpSession; |
| 68 | 68 |
| 69 class HTMLDocumentParser : public ScriptableDocumentParser, private HTMLScriptR
unnerHost { | 69 class HTMLDocumentParser : public ScriptableDocumentParser, private HTMLScriptR
unnerHost { |
| 70 USING_FAST_MALLOC_WILL_BE_REMOVED(HTMLDocumentParser); | 70 USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser); |
| 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser); | |
| 72 public: | 71 public: |
| 73 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(HTMLDocument& docum
ent, bool reportErrors, ParserSynchronizationPolicy backgroundParsingPolicy) | 72 static RawPtr<HTMLDocumentParser> create(HTMLDocument& document, bool report
Errors, ParserSynchronizationPolicy backgroundParsingPolicy) |
| 74 { | 73 { |
| 75 return adoptRefWillBeNoop(new HTMLDocumentParser(document, reportErrors,
backgroundParsingPolicy)); | 74 return new HTMLDocumentParser(document, reportErrors, backgroundParsingP
olicy); |
| 76 } | 75 } |
| 77 ~HTMLDocumentParser() override; | 76 ~HTMLDocumentParser() override; |
| 78 DECLARE_VIRTUAL_TRACE(); | 77 DECLARE_VIRTUAL_TRACE(); |
| 79 | 78 |
| 80 // Exposed for HTMLParserScheduler | 79 // Exposed for HTMLParserScheduler |
| 81 void resumeParsingAfterYield(); | 80 void resumeParsingAfterYield(); |
| 82 | 81 |
| 83 static void parseDocumentFragment(const String&, DocumentFragment*, Element*
contextElement, ParserContentPolicy = AllowScriptingContent); | 82 static void parseDocumentFragment(const String&, DocumentFragment*, Element*
contextElement, ParserContentPolicy = AllowScriptingContent); |
| 84 | 83 |
| 85 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } | 84 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void finish() final; | 116 void finish() final; |
| 118 | 117 |
| 119 HTMLDocumentParser(HTMLDocument&, bool reportErrors, ParserSynchronizationPo
licy); | 118 HTMLDocumentParser(HTMLDocument&, bool reportErrors, ParserSynchronizationPo
licy); |
| 120 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent
Policy); | 119 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent
Policy); |
| 121 | 120 |
| 122 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } | 121 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } |
| 123 | 122 |
| 124 void forcePlaintextForTextDocument(); | 123 void forcePlaintextForTextDocument(); |
| 125 | 124 |
| 126 private: | 125 private: |
| 127 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(DocumentFragment* f
ragment, Element* contextElement, ParserContentPolicy parserContentPolicy) | 126 static RawPtr<HTMLDocumentParser> create(DocumentFragment* fragment, Element
* contextElement, ParserContentPolicy parserContentPolicy) |
| 128 { | 127 { |
| 129 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen
t, parserContentPolicy)); | 128 return new HTMLDocumentParser(fragment, contextElement, parserContentPol
icy); |
| 130 } | 129 } |
| 131 | 130 |
| 132 // DocumentParser | 131 // DocumentParser |
| 133 void detach() final; | 132 void detach() final; |
| 134 bool hasInsertionPoint() final; | 133 bool hasInsertionPoint() final; |
| 135 void prepareToStopParsing() final; | 134 void prepareToStopParsing() final; |
| 136 void stopParsing() final; | 135 void stopParsing() final; |
| 137 bool isWaitingForScripts() const final; | 136 bool isWaitingForScripts() const final; |
| 138 bool isExecutingScript() const final; | 137 bool isExecutingScript() const final; |
| 139 void executeScriptsWaitingForResources() final; | 138 void executeScriptsWaitingForResources() final; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } | 171 bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } |
| 173 bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts(
) || isScheduledForResume() || isExecutingScript(); } | 172 bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts(
) || isScheduledForResume() || isExecutingScript(); } |
| 174 | 173 |
| 175 HTMLToken& token() { return *m_token; } | 174 HTMLToken& token() { return *m_token; } |
| 176 | 175 |
| 177 HTMLParserOptions m_options; | 176 HTMLParserOptions m_options; |
| 178 HTMLInputStream m_input; | 177 HTMLInputStream m_input; |
| 179 | 178 |
| 180 OwnPtr<HTMLToken> m_token; | 179 OwnPtr<HTMLToken> m_token; |
| 181 OwnPtr<HTMLTokenizer> m_tokenizer; | 180 OwnPtr<HTMLTokenizer> m_tokenizer; |
| 182 OwnPtrWillBeMember<HTMLScriptRunner> m_scriptRunner; | 181 Member<HTMLScriptRunner> m_scriptRunner; |
| 183 OwnPtrWillBeMember<HTMLTreeBuilder> m_treeBuilder; | 182 Member<HTMLTreeBuilder> m_treeBuilder; |
| 184 OwnPtr<HTMLPreloadScanner> m_preloadScanner; | 183 OwnPtr<HTMLPreloadScanner> m_preloadScanner; |
| 185 OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; | 184 OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; |
| 186 OwnPtr<WebTaskRunner> m_loadingTaskRunner; | 185 OwnPtr<WebTaskRunner> m_loadingTaskRunner; |
| 187 OwnPtrWillBeMember<HTMLParserScheduler> m_parserScheduler; | 186 Member<HTMLParserScheduler> m_parserScheduler; |
| 188 HTMLSourceTracker m_sourceTracker; | 187 HTMLSourceTracker m_sourceTracker; |
| 189 TextPosition m_textPosition; | 188 TextPosition m_textPosition; |
| 190 XSSAuditor m_xssAuditor; | 189 XSSAuditor m_xssAuditor; |
| 191 XSSAuditorDelegate m_xssAuditorDelegate; | 190 XSSAuditorDelegate m_xssAuditorDelegate; |
| 192 | 191 |
| 193 // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should
be combined into a single state object | 192 // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should
be combined into a single state object |
| 194 // so they can be set and cleared together and passed between threads togeth
er. | 193 // so they can be set and cleared together and passed between threads togeth
er. |
| 195 OwnPtr<ParsedChunk> m_lastChunkBeforeScript; | 194 OwnPtr<ParsedChunk> m_lastChunkBeforeScript; |
| 196 Deque<OwnPtr<ParsedChunk>> m_speculations; | 195 Deque<OwnPtr<ParsedChunk>> m_speculations; |
| 197 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; | 196 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; |
| 198 WeakPtr<BackgroundHTMLParser> m_backgroundParser; | 197 WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
| 199 OwnPtrWillBeMember<HTMLResourcePreloader> m_preloader; | 198 Member<HTMLResourcePreloader> m_preloader; |
| 200 PreloadRequestStream m_queuedPreloads; | 199 PreloadRequestStream m_queuedPreloads; |
| 201 RefPtr<ParsedChunkQueue> m_parsedChunkQueue; | 200 RefPtr<ParsedChunkQueue> m_parsedChunkQueue; |
| 202 | 201 |
| 203 bool m_shouldUseThreading; | 202 bool m_shouldUseThreading; |
| 204 bool m_endWasDelayed; | 203 bool m_endWasDelayed; |
| 205 bool m_haveBackgroundParser; | 204 bool m_haveBackgroundParser; |
| 206 bool m_tasksWereSuspended; | 205 bool m_tasksWereSuspended; |
| 207 unsigned m_pumpSessionNestingLevel; | 206 unsigned m_pumpSessionNestingLevel; |
| 208 unsigned m_pumpSpeculationsSessionNestingLevel; | 207 unsigned m_pumpSpeculationsSessionNestingLevel; |
| 209 bool m_isParsingAtLineNumber; | 208 bool m_isParsingAtLineNumber; |
| 210 bool m_triedLoadingLinkHeaders; | 209 bool m_triedLoadingLinkHeaders; |
| 211 }; | 210 }; |
| 212 | 211 |
| 213 } // namespace blink | 212 } // namespace blink |
| 214 | 213 |
| 215 #endif | 214 #endif |
| OLD | NEW |