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

Side by Side Diff: sky/engine/core/html/parser/HTMLDocumentParser.h

Issue 680583003: Delete ScriptableDocumentParser (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Sort headers Created 6 years, 2 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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef HTMLDocumentParser_h 26 #ifndef HTMLDocumentParser_h
27 #define HTMLDocumentParser_h 27 #define HTMLDocumentParser_h
28 28
29 #include "base/memory/weak_ptr.h" 29 #include "base/memory/weak_ptr.h"
30 #include "core/dom/ParserContentPolicy.h" 30 #include "core/dom/DecodedDataDocumentParser.h"
31 #include "core/dom/ScriptableDocumentParser.h"
32 #include "core/fetch/ResourceClient.h" 31 #include "core/fetch/ResourceClient.h"
33 #include "core/frame/UseCounter.h" 32 #include "core/frame/UseCounter.h"
34 #include "core/html/parser/CompactHTMLToken.h" 33 #include "core/html/parser/CompactHTMLToken.h"
35 #include "core/html/parser/HTMLInputStream.h" 34 #include "core/html/parser/HTMLInputStream.h"
36 #include "core/html/parser/HTMLParserOptions.h" 35 #include "core/html/parser/HTMLParserOptions.h"
37 #include "core/html/parser/HTMLScriptRunner.h" 36 #include "core/html/parser/HTMLScriptRunner.h"
38 #include "core/html/parser/HTMLToken.h" 37 #include "core/html/parser/HTMLToken.h"
39 #include "core/html/parser/HTMLTokenizer.h" 38 #include "core/html/parser/HTMLTokenizer.h"
40 #include "core/html/parser/TextResourceDecoder.h" 39 #include "core/html/parser/TextResourceDecoder.h"
41 #include "platform/text/SegmentedString.h" 40 #include "platform/text/SegmentedString.h"
(...skipping 10 matching lines...) Expand all
52 class DocumentFragment; 51 class DocumentFragment;
53 class Element; 52 class Element;
54 class HTMLDocument; 53 class HTMLDocument;
55 class HTMLParserScheduler; 54 class HTMLParserScheduler;
56 class HTMLTreeBuilder; 55 class HTMLTreeBuilder;
57 class ScriptController; 56 class ScriptController;
58 class ScriptSourceCode; 57 class ScriptSourceCode;
59 58
60 class PumpSession; 59 class PumpSession;
61 60
62 class HTMLDocumentParser : public ScriptableDocumentParser { 61 class HTMLDocumentParser : public DecodedDataDocumentParser {
63 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 62 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser); 63 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser);
65 public: 64 public:
66 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(HTMLDocument& docum ent, bool reportErrors) 65 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(HTMLDocument& docum ent, bool reportErrors)
67 { 66 {
68 return adoptRefWillBeNoop(new HTMLDocumentParser(document, reportErrors) ); 67 return adoptRefWillBeNoop(new HTMLDocumentParser(document, reportErrors) );
69 } 68 }
70 virtual ~HTMLDocumentParser(); 69 virtual ~HTMLDocumentParser();
71 virtual void trace(Visitor*) OVERRIDE; 70 virtual void trace(Visitor*) OVERRIDE;
72 71
73 // Exposed for HTMLParserScheduler 72 // Exposed for HTMLParserScheduler
74 void resumeParsingAfterYield(); 73 void resumeParsingAfterYield();
75 74
76 static void parseDocumentFragment(const String&, DocumentFragment*, Element* contextElement, ParserContentPolicy = AllowScriptingContent); 75 static void parseDocumentFragment(const String&, DocumentFragment*, Element* contextElement);
77 76
78 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } 77 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); }
79 78
80 virtual TextPosition textPosition() const OVERRIDE FINAL; 79 TextPosition textPosition() const;
81 virtual OrdinalNumber lineNumber() const OVERRIDE FINAL; 80 OrdinalNumber lineNumber() const;
82 81
83 struct ParsedChunk { 82 struct ParsedChunk {
84 OwnPtr<CompactHTMLTokenStream> tokens; 83 OwnPtr<CompactHTMLTokenStream> tokens;
85 }; 84 };
86 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); 85 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>);
87 86
88 virtual void appendBytes(const char* bytes, size_t length) OVERRIDE; 87 virtual void appendBytes(const char* bytes, size_t length) OVERRIDE;
89 virtual void flush() OVERRIDE FINAL; 88 virtual void flush() OVERRIDE FINAL;
90 89
90 bool isWaitingForScripts() const;
91 bool isExecutingScript() const;
92 void executeScriptsWaitingForResources();
93
91 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi on()); } 94 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi on()); }
92 95
93 protected: 96 protected:
94 virtual void insert(const SegmentedString&) OVERRIDE FINAL; 97 virtual void insert(const SegmentedString&) OVERRIDE FINAL;
95 virtual void append(PassRefPtr<StringImpl>) OVERRIDE; 98 virtual void append(PassRefPtr<StringImpl>) OVERRIDE;
96 virtual void finish() OVERRIDE FINAL; 99 virtual void finish() OVERRIDE FINAL;
97 100
98 HTMLDocumentParser(HTMLDocument&, bool reportErrors); 101 HTMLDocumentParser(HTMLDocument&, bool reportErrors);
99 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent Policy); 102 HTMLDocumentParser(DocumentFragment*, Element* contextElement);
100 103
101 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } 104 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); }
102 105
103 private: 106 private:
104 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(DocumentFragment* f ragment, Element* contextElement, ParserContentPolicy parserContentPolicy) 107 static PassRefPtrWillBeRawPtr<HTMLDocumentParser> create(DocumentFragment* f ragment, Element* contextElement)
105 { 108 {
106 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen t, parserContentPolicy)); 109 return adoptRefWillBeNoop(new HTMLDocumentParser(fragment, contextElemen t));
107 } 110 }
108 111
112 virtual HTMLDocumentParser* asHTMLDocumentParser() OVERRIDE FINAL { return t his; }
113
109 // DocumentParser 114 // DocumentParser
110 virtual void detach() OVERRIDE FINAL; 115 virtual void detach() OVERRIDE FINAL;
111 virtual bool hasInsertionPoint() OVERRIDE FINAL; 116 virtual bool hasInsertionPoint() OVERRIDE FINAL;
112 virtual bool processingData() const OVERRIDE FINAL; 117 virtual bool processingData() const OVERRIDE FINAL;
113 virtual void prepareToStopParsing() OVERRIDE FINAL; 118 virtual void prepareToStopParsing() OVERRIDE FINAL;
114 virtual void stopParsing() OVERRIDE FINAL; 119 virtual void stopParsing() OVERRIDE FINAL;
115 virtual bool isWaitingForScripts() const OVERRIDE FINAL;
116 virtual bool isExecutingScript() const OVERRIDE FINAL;
117 virtual void executeScriptsWaitingForResources() OVERRIDE FINAL;
118 120
119 void startBackgroundParser(); 121 void startBackgroundParser();
120 void stopBackgroundParser(); 122 void stopBackgroundParser();
121 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); 123 void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk);
122 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); 124 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>);
123 void pumpPendingSpeculations(); 125 void pumpPendingSpeculations();
124 126
125 Document* contextForParsingSession(); 127 Document* contextForParsingSession();
126 128
127 enum SynchronousMode { 129 enum SynchronousMode {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 172
171 bool m_isFragment; 173 bool m_isFragment;
172 bool m_endWasDelayed; 174 bool m_endWasDelayed;
173 bool m_haveBackgroundParser; 175 bool m_haveBackgroundParser;
174 unsigned m_pumpSessionNestingLevel; 176 unsigned m_pumpSessionNestingLevel;
175 }; 177 };
176 178
177 } 179 }
178 180
179 #endif 181 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/html/parser/HTMLConstructionSite.cpp ('k') | sky/engine/core/html/parser/HTMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698