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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 class HTMLDocument; | 58 class HTMLDocument; |
59 class HTMLParserScheduler; | 59 class HTMLParserScheduler; |
60 class HTMLScriptRunner; | 60 class HTMLScriptRunner; |
61 class HTMLTreeBuilder; | 61 class HTMLTreeBuilder; |
62 class HTMLResourcePreloader; | 62 class HTMLResourcePreloader; |
63 class ScriptController; | 63 class ScriptController; |
64 class ScriptSourceCode; | 64 class ScriptSourceCode; |
65 | 65 |
66 class PumpSession; | 66 class PumpSession; |
67 | 67 |
68 class HTMLDocumentParser : public ScriptableDocumentParser, HTMLScriptRunnerHos t, ResourceClient { | 68 class HTMLDocumentParser : public ScriptableDocumentParser, private HTMLScriptR unnerHost { |
69 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 69 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
70 public: | 70 public: |
71 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(HTMLDocument& docum ent, bool reportErrors) | 71 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(HTMLDocument& docum ent, bool reportErrors) |
72 { | 72 { |
73 return adoptRefWillBeNoop(new HTMLDocumentParser(document, reportErrors) ); | 73 return adoptRefWillBeNoop(new HTMLDocumentParser(document, reportErrors) ); |
74 } | 74 } |
75 virtual ~HTMLDocumentParser(); | 75 virtual ~HTMLDocumentParser(); |
76 virtual void trace(Visitor*) OVERRIDE; | 76 virtual void trace(Visitor*) OVERRIDE; |
77 | 77 |
78 // Exposed for HTMLParserScheduler | 78 // Exposed for HTMLParserScheduler |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 virtual void detach() OVERRIDE FINAL; | 129 virtual void detach() OVERRIDE FINAL; |
130 virtual bool hasInsertionPoint() OVERRIDE FINAL; | 130 virtual bool hasInsertionPoint() OVERRIDE FINAL; |
131 virtual bool processingData() const OVERRIDE FINAL; | 131 virtual bool processingData() const OVERRIDE FINAL; |
132 virtual void prepareToStopParsing() OVERRIDE FINAL; | 132 virtual void prepareToStopParsing() OVERRIDE FINAL; |
133 virtual void stopParsing() OVERRIDE FINAL; | 133 virtual void stopParsing() OVERRIDE FINAL; |
134 virtual bool isWaitingForScripts() const OVERRIDE FINAL; | 134 virtual bool isWaitingForScripts() const OVERRIDE FINAL; |
135 virtual bool isExecutingScript() const OVERRIDE FINAL; | 135 virtual bool isExecutingScript() const OVERRIDE FINAL; |
136 virtual void executeScriptsWaitingForResources() OVERRIDE FINAL; | 136 virtual void executeScriptsWaitingForResources() OVERRIDE FINAL; |
137 | 137 |
138 // HTMLScriptRunnerHost | 138 // HTMLScriptRunnerHost |
139 virtual void watchForLoad(Resource*) OVERRIDE FINAL; | 139 virtual void notifyScriptLoaded(Resource*) OVERRIDE FINAL; |
140 virtual void stopWatchingForLoad(Resource*) OVERRIDE FINAL; | |
141 virtual HTMLInputStream& inputStream() OVERRIDE FINAL { return m_input; } | 140 virtual HTMLInputStream& inputStream() OVERRIDE FINAL { return m_input; } |
142 virtual bool hasPreloadScanner() const OVERRIDE FINAL { return m_preloadScan ner.get() && !shouldUseThreading(); } | 141 virtual bool hasPreloadScanner() const OVERRIDE FINAL { return m_preloadScan ner.get() && !shouldUseThreading(); } |
143 virtual void appendCurrentInputStreamToPreloadScannerAndScan() OVERRIDE FINA L; | 142 virtual void appendCurrentInputStreamToPreloadScannerAndScan() OVERRIDE FINA L; |
144 | 143 |
145 // ResourceClient | 144 // ResourceClient |
sof
2014/05/27 08:41:19
Will remove this line.
| |
146 virtual void notifyFinished(Resource*) OVERRIDE FINAL; | |
147 | 145 |
148 void startBackgroundParser(); | 146 void startBackgroundParser(); |
149 void stopBackgroundParser(); | 147 void stopBackgroundParser(); |
150 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); | 148 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); |
151 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); | 149 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); |
152 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 150 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
153 void pumpPendingSpeculations(); | 151 void pumpPendingSpeculations(); |
154 | 152 |
155 Document* contextForParsingSession(); | 153 Document* contextForParsingSession(); |
156 | 154 |
(...skipping 22 matching lines...) Expand all Loading... | |
179 bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } | 177 bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } |
180 bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts( ) || isScheduledForResume() || isExecutingScript(); } | 178 bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts( ) || isScheduledForResume() || isExecutingScript(); } |
181 | 179 |
182 HTMLToken& token() { return *m_token; } | 180 HTMLToken& token() { return *m_token; } |
183 | 181 |
184 HTMLParserOptions m_options; | 182 HTMLParserOptions m_options; |
185 HTMLInputStream m_input; | 183 HTMLInputStream m_input; |
186 | 184 |
187 OwnPtr<HTMLToken> m_token; | 185 OwnPtr<HTMLToken> m_token; |
188 OwnPtr<HTMLTokenizer> m_tokenizer; | 186 OwnPtr<HTMLTokenizer> m_tokenizer; |
189 OwnPtr<HTMLScriptRunner> m_scriptRunner; | 187 OwnPtrWillBeMember<HTMLScriptRunner> m_scriptRunner; |
190 OwnPtrWillBeMember<HTMLTreeBuilder> m_treeBuilder; | 188 OwnPtrWillBeMember<HTMLTreeBuilder> m_treeBuilder; |
191 OwnPtr<HTMLPreloadScanner> m_preloadScanner; | 189 OwnPtr<HTMLPreloadScanner> m_preloadScanner; |
192 OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; | 190 OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; |
193 OwnPtr<HTMLParserScheduler> m_parserScheduler; | 191 OwnPtr<HTMLParserScheduler> m_parserScheduler; |
194 HTMLSourceTracker m_sourceTracker; | 192 HTMLSourceTracker m_sourceTracker; |
195 TextPosition m_textPosition; | 193 TextPosition m_textPosition; |
196 XSSAuditor m_xssAuditor; | 194 XSSAuditor m_xssAuditor; |
197 XSSAuditorDelegate m_xssAuditorDelegate; | 195 XSSAuditorDelegate m_xssAuditorDelegate; |
198 | 196 |
199 // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should be combined into a single state object | 197 // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should be combined into a single state object |
200 // so they can be set and cleared together and passed between threads togeth er. | 198 // so they can be set and cleared together and passed between threads togeth er. |
201 OwnPtr<ParsedChunk> m_lastChunkBeforeScript; | 199 OwnPtr<ParsedChunk> m_lastChunkBeforeScript; |
202 Deque<OwnPtr<ParsedChunk> > m_speculations; | 200 Deque<OwnPtr<ParsedChunk> > m_speculations; |
203 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; | 201 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; |
204 WeakPtr<BackgroundHTMLParser> m_backgroundParser; | 202 WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
205 OwnPtr<HTMLResourcePreloader> m_preloader; | 203 OwnPtr<HTMLResourcePreloader> m_preloader; |
206 | 204 |
207 bool m_isPinnedToMainThread; | 205 bool m_isPinnedToMainThread; |
208 bool m_endWasDelayed; | 206 bool m_endWasDelayed; |
209 bool m_haveBackgroundParser; | 207 bool m_haveBackgroundParser; |
210 unsigned m_pumpSessionNestingLevel; | 208 unsigned m_pumpSessionNestingLevel; |
211 }; | 209 }; |
212 | 210 |
213 } | 211 } |
214 | 212 |
215 #endif | 213 #endif |
OLD | NEW |