| 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 |
| 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 "bindings/core/v8/DocumentWriteEvaluator.h" | 29 #include "bindings/core/v8/DocumentWriteEvaluator.h" |
| 30 #include "core/CoreExport.h" |
| 30 #include "core/dom/ParserContentPolicy.h" | 31 #include "core/dom/ParserContentPolicy.h" |
| 31 #include "core/dom/ScriptableDocumentParser.h" | 32 #include "core/dom/ScriptableDocumentParser.h" |
| 32 #include "core/fetch/ResourceClient.h" | 33 #include "core/fetch/ResourceClient.h" |
| 33 #include "core/frame/UseCounter.h" | 34 #include "core/frame/UseCounter.h" |
| 34 #include "core/html/parser/BackgroundHTMLInputStream.h" | 35 #include "core/html/parser/BackgroundHTMLInputStream.h" |
| 35 #include "core/html/parser/CompactHTMLToken.h" | 36 #include "core/html/parser/CompactHTMLToken.h" |
| 36 #include "core/html/parser/HTMLInputStream.h" | 37 #include "core/html/parser/HTMLInputStream.h" |
| 37 #include "core/html/parser/HTMLParserOptions.h" | 38 #include "core/html/parser/HTMLParserOptions.h" |
| 38 #include "core/html/parser/HTMLParserReentryPermit.h" | 39 #include "core/html/parser/HTMLParserReentryPermit.h" |
| 39 #include "core/html/parser/HTMLPreloadScanner.h" | 40 #include "core/html/parser/HTMLPreloadScanner.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 class DocumentFragment; | 63 class DocumentFragment; |
| 63 class Element; | 64 class Element; |
| 64 class HTMLDocument; | 65 class HTMLDocument; |
| 65 class HTMLParserScheduler; | 66 class HTMLParserScheduler; |
| 66 class HTMLResourcePreloader; | 67 class HTMLResourcePreloader; |
| 67 class HTMLScriptRunner; | 68 class HTMLScriptRunner; |
| 68 class HTMLTreeBuilder; | 69 class HTMLTreeBuilder; |
| 69 class PumpSession; | 70 class PumpSession; |
| 70 class TokenizedChunkQueue; | 71 class TokenizedChunkQueue; |
| 71 | 72 |
| 72 class HTMLDocumentParser : public ScriptableDocumentParser, private HTMLScriptR
unnerHost { | 73 class CORE_EXPORT HTMLDocumentParser : public ScriptableDocumentParser, private
HTMLScriptRunnerHost { |
| 73 USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser); | 74 USING_GARBAGE_COLLECTED_MIXIN(HTMLDocumentParser); |
| 74 USING_PRE_FINALIZER(HTMLDocumentParser, dispose); | 75 USING_PRE_FINALIZER(HTMLDocumentParser, dispose); |
| 75 public: | 76 public: |
| 76 static HTMLDocumentParser* create(HTMLDocument& document, ParserSynchronizat
ionPolicy backgroundParsingPolicy) | 77 static HTMLDocumentParser* create(HTMLDocument& document, ParserSynchronizat
ionPolicy backgroundParsingPolicy) |
| 77 { | 78 { |
| 78 return new HTMLDocumentParser(document, backgroundParsingPolicy); | 79 return new HTMLDocumentParser(document, backgroundParsingPolicy); |
| 79 } | 80 } |
| 80 ~HTMLDocumentParser() override; | 81 ~HTMLDocumentParser() override; |
| 81 DECLARE_VIRTUAL_TRACE(); | 82 DECLARE_VIRTUAL_TRACE(); |
| 82 | 83 |
| 83 // TODO(alexclarke): Remove when background parser goes away. | 84 // TODO(alexclarke): Remove when background parser goes away. |
| 84 void dispose(); | 85 void dispose(); |
| 85 | 86 |
| 86 // Exposed for HTMLParserScheduler | 87 // Exposed for HTMLParserScheduler |
| 87 void resumeParsingAfterYield(); | 88 void resumeParsingAfterYield(); |
| 88 | 89 |
| 89 static void parseDocumentFragment(const String&, DocumentFragment*, Element*
contextElement, ParserContentPolicy = AllowScriptingContent); | 90 static void parseDocumentFragment(const String&, DocumentFragment*, Element*
contextElement, ParserContentPolicy = AllowScriptingContent); |
| 90 | 91 |
| 92 // Exposed for testing. |
| 93 HTMLScriptRunnerHost* asHTMLScriptRunnerHostForTesting() { return this; } |
| 94 |
| 91 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } | 95 HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); } |
| 92 | 96 |
| 93 TextPosition textPosition() const final; | 97 TextPosition textPosition() const final; |
| 94 bool isParsingAtLineNumber() const final; | 98 bool isParsingAtLineNumber() const final; |
| 95 OrdinalNumber lineNumber() const final; | 99 OrdinalNumber lineNumber() const final; |
| 96 | 100 |
| 97 void suspendScheduledTasks() final; | 101 void suspendScheduledTasks() final; |
| 98 void resumeScheduledTasks() final; | 102 void resumeScheduledTasks() final; |
| 99 | 103 |
| 100 HTMLParserReentryPermit* reentryPermit() { return m_reentryPermit.get(); } | 104 HTMLParserReentryPermit* reentryPermit() { return m_reentryPermit.get(); } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 bool m_tasksWereSuspended; | 245 bool m_tasksWereSuspended; |
| 242 unsigned m_pumpSessionNestingLevel; | 246 unsigned m_pumpSessionNestingLevel; |
| 243 unsigned m_pumpSpeculationsSessionNestingLevel; | 247 unsigned m_pumpSpeculationsSessionNestingLevel; |
| 244 bool m_isParsingAtLineNumber; | 248 bool m_isParsingAtLineNumber; |
| 245 bool m_triedLoadingLinkHeaders; | 249 bool m_triedLoadingLinkHeaders; |
| 246 }; | 250 }; |
| 247 | 251 |
| 248 } // namespace blink | 252 } // namespace blink |
| 249 | 253 |
| 250 #endif | 254 #endif |
| OLD | NEW |