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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h

Issue 1772853002: Block the HTML parser on external stylesheets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified parser blocking logic Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen t, parserContentPolicy)); 130 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen t, parserContentPolicy));
131 } 131 }
132 132
133 // DocumentParser 133 // DocumentParser
134 void detach() final; 134 void detach() final;
135 bool hasInsertionPoint() final; 135 bool hasInsertionPoint() final;
136 bool processingData() const final; 136 bool processingData() const final;
137 void prepareToStopParsing() final; 137 void prepareToStopParsing() final;
138 void stopParsing() final; 138 void stopParsing() final;
139 bool isWaitingForScripts() const final; 139 bool isWaitingForScripts() const final;
140 bool isWaitingForStyles() const;
141 bool isWaitingForImports() const;
142 bool isWaitingForBlockingResource() const;
140 bool isExecutingScript() const final; 143 bool isExecutingScript() const final;
141 void executeScriptsWaitingForResources() final; 144 void executeScriptsWaitingForResources() final;
142 145
143 // HTMLScriptRunnerHost 146 // HTMLScriptRunnerHost
144 void notifyScriptLoaded(Resource*) final; 147 void notifyScriptLoaded(Resource*) final;
145 HTMLInputStream& inputStream() final { return m_input; } 148 HTMLInputStream& inputStream() final { return m_input; }
146 bool hasPreloadScanner() const final { return m_preloadScanner.get() && !sho uldUseThreading(); } 149 bool hasPreloadScanner() const final { return m_preloadScanner.get() && !sho uldUseThreading(); }
147 void appendCurrentInputStreamToPreloadScannerAndScan() final; 150 void appendCurrentInputStreamToPreloadScannerAndScan() final;
148 151
149 void startBackgroundParser(); 152 void startBackgroundParser();
150 void stopBackgroundParser(); 153 void stopBackgroundParser();
151 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); 154 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk);
152 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); 155 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>);
153 size_t processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); 156 size_t processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>);
154 void pumpPendingSpeculations(); 157 void pumpPendingSpeculations();
155 158
156 Document* contextForParsingSession(); 159 Document* contextForParsingSession();
157 160
158 bool canTakeNextToken(); 161 bool canTakeNextToken();
159 void pumpTokenizer(); 162 void pumpTokenizer();
160 void pumpTokenizerIfPossible(); 163 void pumpTokenizerIfPossible();
161 void constructTreeFromHTMLToken(); 164 void constructTreeFromHTMLToken();
162 void constructTreeFromCompactHTMLToken(const CompactHTMLToken&); 165 void constructTreeFromCompactHTMLToken(const CompactHTMLToken&);
163 166
164 void runScriptsForPausedTreeBuilder(); 167 void runScriptsForPausedTreeBuilder();
165 void resumeParsingAfterScriptExecution(); 168 void resumeParsingAfterBlock();
166 169
167 void attemptToEnd(); 170 void attemptToEnd();
168 void endIfDelayed(); 171 void endIfDelayed();
169 void attemptToRunDeferredScriptsAndEnd(); 172 void attemptToRunDeferredScriptsAndEnd();
170 void end(); 173 void end();
171 174
172 bool shouldUseThreading() const { return m_shouldUseThreading; } 175 bool shouldUseThreading() const { return m_shouldUseThreading; }
173 176
174 bool isParsingFragment() const; 177 bool isParsingFragment() const;
175 bool isScheduledForResume() const; 178 bool isScheduledForResume() const;
(...skipping 11 matching lines...) Expand all
187 OwnPtrWillBeMember<HTMLTreeBuilder> m_treeBuilder; 190 OwnPtrWillBeMember<HTMLTreeBuilder> m_treeBuilder;
188 OwnPtr<HTMLPreloadScanner> m_preloadScanner; 191 OwnPtr<HTMLPreloadScanner> m_preloadScanner;
189 OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; 192 OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner;
190 OwnPtr<WebTaskRunner> m_loadingTaskRunner; 193 OwnPtr<WebTaskRunner> m_loadingTaskRunner;
191 OwnPtrWillBeMember<HTMLParserScheduler> m_parserScheduler; 194 OwnPtrWillBeMember<HTMLParserScheduler> m_parserScheduler;
192 HTMLSourceTracker m_sourceTracker; 195 HTMLSourceTracker m_sourceTracker;
193 TextPosition m_textPosition; 196 TextPosition m_textPosition;
194 XSSAuditor m_xssAuditor; 197 XSSAuditor m_xssAuditor;
195 XSSAuditorDelegate m_xssAuditorDelegate; 198 XSSAuditorDelegate m_xssAuditorDelegate;
196 199
197 // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should be combined into a single state object 200 // FIXME: m_lastChunkBeforeBlockingResource m_tokenizer, m_token, and m_inpu t should be combined into a single state object
198 // so they can be set and cleared together and passed between threads togeth er. 201 // so they can be set and cleared together and passed between threads togeth er.
199 OwnPtr<ParsedChunk> m_lastChunkBeforeScript; 202 OwnPtr<ParsedChunk> m_lastChunkBeforeBlockingResource;
200 Deque<OwnPtr<ParsedChunk>> m_speculations; 203 Deque<OwnPtr<ParsedChunk>> m_speculations;
201 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; 204 WeakPtrFactory<HTMLDocumentParser> m_weakFactory;
202 WeakPtr<BackgroundHTMLParser> m_backgroundParser; 205 WeakPtr<BackgroundHTMLParser> m_backgroundParser;
203 OwnPtrWillBeMember<HTMLResourcePreloader> m_preloader; 206 OwnPtrWillBeMember<HTMLResourcePreloader> m_preloader;
204 PreloadRequestStream m_queuedPreloads; 207 PreloadRequestStream m_queuedPreloads;
205 RefPtr<ParsedChunkQueue> m_parsedChunkQueue; 208 RefPtr<ParsedChunkQueue> m_parsedChunkQueue;
206 209
207 bool m_shouldUseThreading; 210 bool m_shouldUseThreading;
208 bool m_endWasDelayed; 211 bool m_endWasDelayed;
209 bool m_haveBackgroundParser; 212 bool m_haveBackgroundParser;
210 bool m_tasksWereSuspended; 213 bool m_tasksWereSuspended;
211 unsigned m_pumpSessionNestingLevel; 214 unsigned m_pumpSessionNestingLevel;
212 unsigned m_pumpSpeculationsSessionNestingLevel; 215 unsigned m_pumpSpeculationsSessionNestingLevel;
213 bool m_isParsingAtLineNumber; 216 bool m_isParsingAtLineNumber;
214 }; 217 };
215 218
216 } // namespace blink 219 } // namespace blink
217 220
218 #endif 221 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698