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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 class HTMLDocumentParser : public ScriptableDocumentParser, private HTMLScriptR
unnerHost { | 67 class HTMLDocumentParser : public ScriptableDocumentParser, private HTMLScriptR
unnerHost { |
68 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 68 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
69 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser); | 69 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser); |
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 |
79 void resumeParsingAfterYield(); | 79 void resumeParsingAfterYield(); |
80 | 80 |
81 static void parseDocumentFragment(const String&, DocumentFragment*, Element*
contextElement, ParserContentPolicy = AllowScriptingContent); | 81 static void parseDocumentFragment(const String&, DocumentFragment*, Element*
contextElement, ParserContentPolicy = AllowScriptingContent); |
82 | 82 |
83 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } | 83 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } |
84 | 84 |
85 virtual TextPosition textPosition() const OVERRIDE FINAL; | 85 virtual TextPosition textPosition() const override final; |
86 virtual OrdinalNumber lineNumber() const OVERRIDE FINAL; | 86 virtual OrdinalNumber lineNumber() const override final; |
87 | 87 |
88 virtual void suspendScheduledTasks() OVERRIDE FINAL; | 88 virtual void suspendScheduledTasks() override final; |
89 virtual void resumeScheduledTasks() OVERRIDE FINAL; | 89 virtual void resumeScheduledTasks() override final; |
90 | 90 |
91 struct ParsedChunk { | 91 struct ParsedChunk { |
92 OwnPtr<CompactHTMLTokenStream> tokens; | 92 OwnPtr<CompactHTMLTokenStream> tokens; |
93 PreloadRequestStream preloads; | 93 PreloadRequestStream preloads; |
94 XSSInfoStream xssInfos; | 94 XSSInfoStream xssInfos; |
95 HTMLTokenizer::State tokenizerState; | 95 HTMLTokenizer::State tokenizerState; |
96 HTMLTreeBuilderSimulator::State treeBuilderState; | 96 HTMLTreeBuilderSimulator::State treeBuilderState; |
97 HTMLInputCheckpoint inputCheckpoint; | 97 HTMLInputCheckpoint inputCheckpoint; |
98 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; | 98 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; |
99 }; | 99 }; |
100 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 100 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
101 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&)
; | 101 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&)
; |
102 | 102 |
103 virtual void appendBytes(const char* bytes, size_t length) OVERRIDE; | 103 virtual void appendBytes(const char* bytes, size_t length) override; |
104 virtual void flush() OVERRIDE FINAL; | 104 virtual void flush() override final; |
105 virtual void setDecoder(PassOwnPtr<TextResourceDecoder>) OVERRIDE FINAL; | 105 virtual void setDecoder(PassOwnPtr<TextResourceDecoder>) override final; |
106 | 106 |
107 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi
on()); } | 107 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi
on()); } |
108 | 108 |
109 protected: | 109 protected: |
110 virtual void insert(const SegmentedString&) OVERRIDE FINAL; | 110 virtual void insert(const SegmentedString&) override final; |
111 virtual void append(PassRefPtr<StringImpl>) OVERRIDE; | 111 virtual void append(PassRefPtr<StringImpl>) override; |
112 virtual void finish() OVERRIDE FINAL; | 112 virtual void finish() override final; |
113 | 113 |
114 HTMLDocumentParser(HTMLDocument&, bool reportErrors); | 114 HTMLDocumentParser(HTMLDocument&, bool reportErrors); |
115 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent
Policy); | 115 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent
Policy); |
116 | 116 |
117 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } | 117 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } |
118 | 118 |
119 void forcePlaintextForTextDocument(); | 119 void forcePlaintextForTextDocument(); |
120 | 120 |
121 private: | 121 private: |
122 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(DocumentFragment* f
ragment, Element* contextElement, ParserContentPolicy parserContentPolicy) | 122 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(DocumentFragment* f
ragment, Element* contextElement, ParserContentPolicy parserContentPolicy) |
123 { | 123 { |
124 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen
t, parserContentPolicy)); | 124 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen
t, parserContentPolicy)); |
125 } | 125 } |
126 | 126 |
127 // DocumentParser | 127 // DocumentParser |
128 virtual void pinToMainThread() OVERRIDE FINAL; | 128 virtual void pinToMainThread() override final; |
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 notifyScriptLoaded(Resource*) OVERRIDE FINAL; | 139 virtual void notifyScriptLoaded(Resource*) override final; |
140 virtual HTMLInputStream& inputStream() OVERRIDE FINAL { return m_input; } | 140 virtual HTMLInputStream& inputStream() override final { return m_input; } |
141 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(); } |
142 virtual void appendCurrentInputStreamToPreloadScannerAndScan() OVERRIDE FINA
L; | 142 virtual void appendCurrentInputStreamToPreloadScannerAndScan() override fina
l; |
143 | 143 |
144 void startBackgroundParser(); | 144 void startBackgroundParser(); |
145 void stopBackgroundParser(); | 145 void stopBackgroundParser(); |
146 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); | 146 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); |
147 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas
sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); | 147 void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, Pas
sOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); |
148 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 148 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
149 void pumpPendingSpeculations(); | 149 void pumpPendingSpeculations(); |
150 | 150 |
151 Document* contextForParsingSession(); | 151 Document* contextForParsingSession(); |
152 | 152 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 bool m_isPinnedToMainThread; | 203 bool m_isPinnedToMainThread; |
204 bool m_endWasDelayed; | 204 bool m_endWasDelayed; |
205 bool m_haveBackgroundParser; | 205 bool m_haveBackgroundParser; |
206 unsigned m_pumpSessionNestingLevel; | 206 unsigned m_pumpSessionNestingLevel; |
207 }; | 207 }; |
208 | 208 |
209 } | 209 } |
210 | 210 |
211 #endif | 211 #endif |
OLD | NEW |