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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; | 103 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; |
104 bool startingScript; | 104 bool startingScript; |
105 }; | 105 }; |
106 void notifyPendingParsedChunks(); | 106 void notifyPendingParsedChunks(); |
107 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&)
; | 107 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&)
; |
108 | 108 |
109 void appendBytes(const char* bytes, size_t length) override; | 109 void appendBytes(const char* bytes, size_t length) override; |
110 void flush() final; | 110 void flush() final; |
111 void setDecoder(PassOwnPtr<TextResourceDecoder>) final; | 111 void setDecoder(PassOwnPtr<TextResourceDecoder>) final; |
112 | 112 |
113 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi
on()); } | |
114 | |
115 protected: | 113 protected: |
116 void insert(const SegmentedString&) final; | 114 void insert(const SegmentedString&) final; |
117 void append(const String&) override; | 115 void append(const String&) override; |
118 void finish() final; | 116 void finish() final; |
119 | 117 |
120 HTMLDocumentParser(HTMLDocument&, bool reportErrors, ParserSynchronizationPo
licy); | 118 HTMLDocumentParser(HTMLDocument&, bool reportErrors, ParserSynchronizationPo
licy); |
121 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent
Policy); | 119 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent
Policy); |
122 | 120 |
123 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } | 121 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } |
124 | 122 |
125 void forcePlaintextForTextDocument(); | 123 void forcePlaintextForTextDocument(); |
126 | 124 |
127 private: | 125 private: |
128 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(DocumentFragment* f
ragment, Element* contextElement, ParserContentPolicy parserContentPolicy) | 126 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(DocumentFragment* f
ragment, Element* contextElement, ParserContentPolicy parserContentPolicy) |
129 { | 127 { |
130 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen
t, parserContentPolicy)); | 128 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen
t, parserContentPolicy)); |
131 } | 129 } |
132 | 130 |
133 // DocumentParser | 131 // DocumentParser |
134 void detach() final; | 132 void detach() final; |
135 bool hasInsertionPoint() final; | 133 bool hasInsertionPoint() final; |
136 bool processingData() const final; | |
137 void prepareToStopParsing() final; | 134 void prepareToStopParsing() final; |
138 void stopParsing() final; | 135 void stopParsing() final; |
139 bool isWaitingForScripts() const final; | 136 bool isWaitingForScripts() const final; |
140 bool isExecutingScript() const final; | 137 bool isExecutingScript() const final; |
141 void executeScriptsWaitingForResources() final; | 138 void executeScriptsWaitingForResources() final; |
142 | 139 |
143 // HTMLScriptRunnerHost | 140 // HTMLScriptRunnerHost |
144 void notifyScriptLoaded(Resource*) final; | 141 void notifyScriptLoaded(Resource*) final; |
145 HTMLInputStream& inputStream() final { return m_input; } | 142 HTMLInputStream& inputStream() final { return m_input; } |
146 bool hasPreloadScanner() const final { return m_preloadScanner.get() && !sho
uldUseThreading(); } | 143 bool hasPreloadScanner() const final { return m_preloadScanner.get() && !sho
uldUseThreading(); } |
147 void appendCurrentInputStreamToPreloadScannerAndScan() final; | 144 void appendCurrentInputStreamToPreloadScannerAndScan() final; |
148 | 145 |
149 void startBackgroundParser(); | 146 void startBackgroundParser(); |
150 void stopBackgroundParser(); | 147 void stopBackgroundParser(); |
151 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); | 148 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); |
152 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas
sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); | 149 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas
sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); |
153 size_t processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 150 size_t processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
154 void pumpPendingSpeculations(); | 151 void pumpPendingSpeculations(); |
155 | 152 |
156 Document* contextForParsingSession(); | |
157 | |
158 bool canTakeNextToken(); | 153 bool canTakeNextToken(); |
159 void pumpTokenizer(); | 154 void pumpTokenizer(); |
160 void pumpTokenizerIfPossible(); | 155 void pumpTokenizerIfPossible(); |
161 void constructTreeFromHTMLToken(); | 156 void constructTreeFromHTMLToken(); |
162 void constructTreeFromCompactHTMLToken(const CompactHTMLToken&); | 157 void constructTreeFromCompactHTMLToken(const CompactHTMLToken&); |
163 | 158 |
164 void runScriptsForPausedTreeBuilder(); | 159 void runScriptsForPausedTreeBuilder(); |
165 void resumeParsingAfterScriptExecution(); | 160 void resumeParsingAfterScriptExecution(); |
166 | 161 |
167 void attemptToEnd(); | 162 void attemptToEnd(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 bool m_haveBackgroundParser; | 204 bool m_haveBackgroundParser; |
210 bool m_tasksWereSuspended; | 205 bool m_tasksWereSuspended; |
211 unsigned m_pumpSessionNestingLevel; | 206 unsigned m_pumpSessionNestingLevel; |
212 unsigned m_pumpSpeculationsSessionNestingLevel; | 207 unsigned m_pumpSpeculationsSessionNestingLevel; |
213 bool m_isParsingAtLineNumber; | 208 bool m_isParsingAtLineNumber; |
214 }; | 209 }; |
215 | 210 |
216 } // namespace blink | 211 } // namespace blink |
217 | 212 |
218 #endif | 213 #endif |
OLD | NEW |