| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL | 93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL |
| 94 { | 94 { |
| 95 return &HTMLParserThread::shared()->platformThread(); | 95 return &HTMLParserThread::shared()->platformThread(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 WeakPtr<BackgroundHTMLParser> m_backgroundParser; | 99 WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 // FIXME: HTMLDocument should be a reference. |
| 102 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors
) | 103 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors
) |
| 103 : ScriptableDocumentParser(document) | 104 : ScriptableDocumentParser(*document) |
| 104 , m_options(document) | 105 , m_options(document) |
| 105 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) | 106 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) |
| 106 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt
ions)) | 107 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt
ions)) |
| 107 , m_scriptRunner(HTMLScriptRunner::create(document, this)) | 108 , m_scriptRunner(HTMLScriptRunner::create(document, this)) |
| 108 , m_treeBuilder(HTMLTreeBuilder::create(this, document, parserContentPolicy(
), reportErrors, m_options)) | 109 , m_treeBuilder(HTMLTreeBuilder::create(this, document, parserContentPolicy(
), reportErrors, m_options)) |
| 109 , m_parserScheduler(HTMLParserScheduler::create(this)) | 110 , m_parserScheduler(HTMLParserScheduler::create(this)) |
| 110 , m_xssAuditorDelegate(document) | 111 , m_xssAuditorDelegate(document) |
| 111 , m_weakFactory(this) | 112 , m_weakFactory(this) |
| 112 , m_preloader(adoptPtr(new HTMLResourcePreloader(document))) | 113 , m_preloader(adoptPtr(new HTMLResourcePreloader(document))) |
| 113 , m_isPinnedToMainThread(false) | 114 , m_isPinnedToMainThread(false) |
| 114 , m_endWasDelayed(false) | 115 , m_endWasDelayed(false) |
| 115 , m_haveBackgroundParser(false) | 116 , m_haveBackgroundParser(false) |
| 116 , m_pumpSessionNestingLevel(0) | 117 , m_pumpSessionNestingLevel(0) |
| 117 { | 118 { |
| 118 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); | 119 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); |
| 119 } | 120 } |
| 120 | 121 |
| 121 // FIXME: Member variables should be grouped into self-initializing structs to | 122 // FIXME: Member variables should be grouped into self-initializing structs to |
| 122 // minimize code duplication between these constructors. | 123 // minimize code duplication between these constructors. |
| 123 HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* cont
extElement, ParserContentPolicy parserContentPolicy) | 124 HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* cont
extElement, ParserContentPolicy parserContentPolicy) |
| 124 : ScriptableDocumentParser(&fragment->document(), parserContentPolicy) | 125 : ScriptableDocumentParser(fragment->document(), parserContentPolicy) |
| 125 , m_options(&fragment->document()) | 126 , m_options(&fragment->document()) |
| 126 , m_token(adoptPtr(new HTMLToken)) | 127 , m_token(adoptPtr(new HTMLToken)) |
| 127 , m_tokenizer(HTMLTokenizer::create(m_options)) | 128 , m_tokenizer(HTMLTokenizer::create(m_options)) |
| 128 , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this
->parserContentPolicy(), m_options)) | 129 , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this
->parserContentPolicy(), m_options)) |
| 129 , m_xssAuditorDelegate(&fragment->document()) | 130 , m_xssAuditorDelegate(&fragment->document()) |
| 130 , m_weakFactory(this) | 131 , m_weakFactory(this) |
| 131 , m_isPinnedToMainThread(true) | 132 , m_isPinnedToMainThread(true) |
| 132 , m_endWasDelayed(false) | 133 , m_endWasDelayed(false) |
| 133 , m_haveBackgroundParser(false) | 134 , m_haveBackgroundParser(false) |
| 134 , m_pumpSessionNestingLevel(0) | 135 , m_pumpSessionNestingLevel(0) |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1048 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1048 { | 1049 { |
| 1049 ASSERT(decoder); | 1050 ASSERT(decoder); |
| 1050 DecodedDataDocumentParser::setDecoder(decoder); | 1051 DecodedDataDocumentParser::setDecoder(decoder); |
| 1051 | 1052 |
| 1052 if (m_haveBackgroundParser) | 1053 if (m_haveBackgroundParser) |
| 1053 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1054 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
| 1054 } | 1055 } |
| 1055 | 1056 |
| 1056 } | 1057 } |
| OLD | NEW |