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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 } | 73 } |
74 virtual ~HTMLDocumentParser(); | 74 virtual ~HTMLDocumentParser(); |
75 | 75 |
76 // Exposed for HTMLParserScheduler | 76 // Exposed for HTMLParserScheduler |
77 void resumeParsingAfterYield(); | 77 void resumeParsingAfterYield(); |
78 | 78 |
79 static void parseDocumentFragment(const String&, DocumentFragment*, Element* contextElement, ParserContentPolicy = AllowScriptingContent); | 79 static void parseDocumentFragment(const String&, DocumentFragment*, Element* contextElement, ParserContentPolicy = AllowScriptingContent); |
80 | 80 |
81 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } | 81 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } |
82 | 82 |
83 virtual TextPosition textPosition() const; | 83 virtual TextPosition textPosition() const OVERRIDE FINAL; |
eseidel
2014/01/10 19:08:23
It's really sad this whole class isn't final. :(
Inactive
2014/01/10 19:11:45
Yes.. Sadly, TextDocumentParser derives from this
| |
84 virtual OrdinalNumber lineNumber() const; | 84 virtual OrdinalNumber lineNumber() const OVERRIDE FINAL; |
85 | 85 |
86 virtual void suspendScheduledTasks(); | 86 virtual void suspendScheduledTasks() OVERRIDE FINAL; |
87 virtual void resumeScheduledTasks(); | 87 virtual void resumeScheduledTasks() OVERRIDE FINAL; |
88 | 88 |
89 struct ParsedChunk { | 89 struct ParsedChunk { |
90 OwnPtr<CompactHTMLTokenStream> tokens; | 90 OwnPtr<CompactHTMLTokenStream> tokens; |
91 PreloadRequestStream preloads; | 91 PreloadRequestStream preloads; |
92 XSSInfoStream xssInfos; | 92 XSSInfoStream xssInfos; |
93 HTMLTokenizer::State tokenizerState; | 93 HTMLTokenizer::State tokenizerState; |
94 HTMLTreeBuilderSimulator::State treeBuilderState; | 94 HTMLTreeBuilderSimulator::State treeBuilderState; |
95 HTMLInputCheckpoint inputCheckpoint; | 95 HTMLInputCheckpoint inputCheckpoint; |
96 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; | 96 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; |
97 }; | 97 }; |
98 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 98 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
99 | 99 |
100 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi on()); } | 100 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi on()); } |
101 | 101 |
102 protected: | 102 protected: |
103 virtual void insert(const SegmentedString&) OVERRIDE; | 103 virtual void insert(const SegmentedString&) OVERRIDE FINAL; |
104 virtual void append(PassRefPtr<StringImpl>) OVERRIDE; | 104 virtual void append(PassRefPtr<StringImpl>) OVERRIDE; |
105 virtual void finish() OVERRIDE; | 105 virtual void finish() OVERRIDE FINAL; |
106 | 106 |
107 HTMLDocumentParser(HTMLDocument*, bool reportErrors); | 107 HTMLDocumentParser(HTMLDocument*, bool reportErrors); |
108 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent Policy); | 108 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent Policy); |
109 | 109 |
110 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } | 110 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } |
111 | 111 |
112 void forcePlaintextForTextDocument(); | 112 void forcePlaintextForTextDocument(); |
113 | 113 |
114 private: | 114 private: |
115 static PassRefPtr<HTMLDocumentParser> create(DocumentFragment* fragment, Ele ment* contextElement, ParserContentPolicy parserContentPolicy) | 115 static PassRefPtr<HTMLDocumentParser> create(DocumentFragment* fragment, Ele ment* contextElement, ParserContentPolicy parserContentPolicy) |
116 { | 116 { |
117 return adoptRef(new HTMLDocumentParser(fragment, contextElement, parserC ontentPolicy)); | 117 return adoptRef(new HTMLDocumentParser(fragment, contextElement, parserC ontentPolicy)); |
118 } | 118 } |
119 | 119 |
120 // DocumentParser | 120 // DocumentParser |
121 virtual void pinToMainThread() OVERRIDE; | 121 virtual void pinToMainThread() OVERRIDE FINAL; |
122 virtual void detach() OVERRIDE; | 122 virtual void detach() OVERRIDE FINAL; |
123 virtual bool hasInsertionPoint() OVERRIDE; | 123 virtual bool hasInsertionPoint() OVERRIDE FINAL; |
124 virtual bool processingData() const OVERRIDE; | 124 virtual bool processingData() const OVERRIDE FINAL; |
125 virtual void prepareToStopParsing() OVERRIDE; | 125 virtual void prepareToStopParsing() OVERRIDE FINAL; |
126 virtual void stopParsing() OVERRIDE; | 126 virtual void stopParsing() OVERRIDE FINAL; |
127 virtual bool isWaitingForScripts() const OVERRIDE; | 127 virtual bool isWaitingForScripts() const OVERRIDE FINAL; |
128 virtual bool isExecutingScript() const OVERRIDE; | 128 virtual bool isExecutingScript() const OVERRIDE FINAL; |
129 virtual void executeScriptsWaitingForResources() OVERRIDE; | 129 virtual void executeScriptsWaitingForResources() OVERRIDE FINAL; |
130 | 130 |
131 // HTMLScriptRunnerHost | 131 // HTMLScriptRunnerHost |
132 virtual void watchForLoad(Resource*) OVERRIDE; | 132 virtual void watchForLoad(Resource*) OVERRIDE FINAL; |
133 virtual void stopWatchingForLoad(Resource*) OVERRIDE; | 133 virtual void stopWatchingForLoad(Resource*) OVERRIDE FINAL; |
134 virtual HTMLInputStream& inputStream() { return m_input; } | 134 virtual HTMLInputStream& inputStream() OVERRIDE FINAL { return m_input; } |
135 virtual bool hasPreloadScanner() const { return m_preloadScanner.get() && !s houldUseThreading(); } | 135 virtual bool hasPreloadScanner() const OVERRIDE FINAL { return m_preloadScan ner.get() && !shouldUseThreading(); } |
136 virtual void appendCurrentInputStreamToPreloadScannerAndScan() OVERRIDE; | 136 virtual void appendCurrentInputStreamToPreloadScannerAndScan() OVERRIDE FINA L; |
137 | 137 |
138 // ResourceClient | 138 // ResourceClient |
139 virtual void notifyFinished(Resource*); | 139 virtual void notifyFinished(Resource*) OVERRIDE FINAL; |
140 | 140 |
141 void startBackgroundParser(); | 141 void startBackgroundParser(); |
142 void stopBackgroundParser(); | 142 void stopBackgroundParser(); |
143 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); | 143 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); |
144 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); | 144 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); |
145 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 145 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
146 void pumpPendingSpeculations(); | 146 void pumpPendingSpeculations(); |
147 | 147 |
148 Document* contextForParsingSession(); | 148 Document* contextForParsingSession(); |
149 | 149 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 | 199 |
200 bool m_isPinnedToMainThread; | 200 bool m_isPinnedToMainThread; |
201 bool m_endWasDelayed; | 201 bool m_endWasDelayed; |
202 bool m_haveBackgroundParser; | 202 bool m_haveBackgroundParser; |
203 unsigned m_pumpSessionNestingLevel; | 203 unsigned m_pumpSessionNestingLevel; |
204 }; | 204 }; |
205 | 205 |
206 } | 206 } |
207 | 207 |
208 #endif | 208 #endif |
OLD | NEW |