| 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 30 matching lines...) Expand all Loading... |
| 41 #include "sky/engine/wtf/OwnPtr.h" | 41 #include "sky/engine/wtf/OwnPtr.h" |
| 42 #include "sky/engine/wtf/WeakPtr.h" | 42 #include "sky/engine/wtf/WeakPtr.h" |
| 43 #include "sky/engine/wtf/text/TextPosition.h" | 43 #include "sky/engine/wtf/text/TextPosition.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class BackgroundHTMLParser; | 47 class BackgroundHTMLParser; |
| 48 class CompactHTMLToken; | 48 class CompactHTMLToken; |
| 49 class Document; | 49 class Document; |
| 50 class Element; | 50 class Element; |
| 51 class HTMLDocument; | |
| 52 class HTMLParserScheduler; | 51 class HTMLParserScheduler; |
| 53 class HTMLTreeBuilder; | 52 class HTMLTreeBuilder; |
| 54 class ScriptController; | 53 class ScriptController; |
| 55 class ScriptSourceCode; | 54 class ScriptSourceCode; |
| 56 | 55 |
| 57 class PumpSession; | 56 class PumpSession; |
| 58 | 57 |
| 59 class HTMLDocumentParser : public DocumentParser { | 58 class HTMLDocumentParser : public DocumentParser { |
| 60 WTF_MAKE_FAST_ALLOCATED; | 59 WTF_MAKE_FAST_ALLOCATED; |
| 61 public: | 60 public: |
| 62 static PassRefPtr<HTMLDocumentParser> create(HTMLDocument& document, bool re
portErrors) | 61 static PassRefPtr<HTMLDocumentParser> create(Document& document, bool report
Errors) |
| 63 { | 62 { |
| 64 return adoptRef(new HTMLDocumentParser(document, reportErrors)); | 63 return adoptRef(new HTMLDocumentParser(document, reportErrors)); |
| 65 } | 64 } |
| 66 virtual ~HTMLDocumentParser(); | 65 virtual ~HTMLDocumentParser(); |
| 67 | 66 |
| 68 void parse(mojo::ScopedDataPipeConsumerHandle, | 67 void parse(mojo::ScopedDataPipeConsumerHandle, |
| 69 const base::Closure& completionCallback) override; | 68 const base::Closure& completionCallback) override; |
| 70 | 69 |
| 71 // Exposed for HTMLParserScheduler | 70 // Exposed for HTMLParserScheduler |
| 72 void resumeParsingAfterYield(); | 71 void resumeParsingAfterYield(); |
| 73 | 72 |
| 74 TextPosition textPosition() const; | 73 TextPosition textPosition() const; |
| 75 OrdinalNumber lineNumber() const; | 74 OrdinalNumber lineNumber() const; |
| 76 | 75 |
| 77 struct ParsedChunk { | 76 struct ParsedChunk { |
| 78 OwnPtr<CompactHTMLTokenStream> tokens; | 77 OwnPtr<CompactHTMLTokenStream> tokens; |
| 79 }; | 78 }; |
| 80 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 79 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
| 81 | 80 |
| 82 // From DocumentParser: | 81 // From DocumentParser: |
| 83 void detach() override final; | 82 void detach() override final; |
| 84 void prepareToStopParsing() override final; | 83 void prepareToStopParsing() override final; |
| 85 void stopParsing() override final; | 84 void stopParsing() override final; |
| 86 bool isWaitingForScripts() const override final; | 85 bool isWaitingForScripts() const override final; |
| 87 bool isExecutingScript() const override final; | 86 bool isExecutingScript() const override final; |
| 88 void resumeAfterWaitingForImports() override final; | 87 void resumeAfterWaitingForImports() override final; |
| 89 | 88 |
| 90 private: | 89 private: |
| 91 HTMLDocumentParser(HTMLDocument&, bool reportErrors); | 90 HTMLDocumentParser(Document&, bool reportErrors); |
| 92 | 91 |
| 93 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } | 92 HTMLTreeBuilder* treeBuilder() const { return m_treeBuilder.get(); } |
| 94 | 93 |
| 95 bool hasInsertionPoint(); | 94 bool hasInsertionPoint(); |
| 96 | 95 |
| 97 void stopBackgroundParser(); | 96 void stopBackgroundParser(); |
| 98 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); | 97 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); |
| 99 void pumpPendingSpeculations(); | 98 void pumpPendingSpeculations(); |
| 100 | 99 |
| 101 Document* contextForParsingSession(); | 100 Document* contextForParsingSession(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 129 | 128 |
| 130 bool m_isFragment; | 129 bool m_isFragment; |
| 131 bool m_endWasDelayed; | 130 bool m_endWasDelayed; |
| 132 bool m_haveBackgroundParser; | 131 bool m_haveBackgroundParser; |
| 133 unsigned m_pumpSessionNestingLevel; | 132 unsigned m_pumpSessionNestingLevel; |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 } | 135 } |
| 137 | 136 |
| 138 #endif // SKY_ENGINE_CORE_HTML_PARSER_HTMLDOCUMENTPARSER_H_ | 137 #endif // SKY_ENGINE_CORE_HTML_PARSER_HTMLDOCUMENTPARSER_H_ |
| OLD | NEW |