| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
) | 105 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
) |
| 106 : ScriptableDocumentParser(document) | 106 : ScriptableDocumentParser(document) |
| 107 , m_options(&document) | 107 , m_options(&document) |
| 108 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) | 108 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) |
| 109 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt
ions)) | 109 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt
ions)) |
| 110 , m_scriptRunner(HTMLScriptRunner::create(&document, this)) | 110 , m_scriptRunner(HTMLScriptRunner::create(&document, this)) |
| 111 , m_treeBuilder(HTMLTreeBuilder::create(this, &document, parserContentPolicy
(), reportErrors, m_options)) | 111 , m_treeBuilder(HTMLTreeBuilder::create(this, &document, parserContentPolicy
(), reportErrors, m_options)) |
| 112 , m_parserScheduler(HTMLParserScheduler::create(this)) | 112 , m_parserScheduler(HTMLParserScheduler::create(this)) |
| 113 , m_xssAuditorDelegate(&document) | 113 , m_xssAuditorDelegate(&document) |
| 114 , m_weakFactory(this) | 114 , m_weakFactory(this) |
| 115 , m_preloader(adoptPtr(new HTMLResourcePreloader(&document))) | 115 , m_preloader(HTMLResourcePreloader::create(document)) |
| 116 , m_isPinnedToMainThread(false) | 116 , m_isPinnedToMainThread(false) |
| 117 , m_endWasDelayed(false) | 117 , m_endWasDelayed(false) |
| 118 , m_haveBackgroundParser(false) | 118 , m_haveBackgroundParser(false) |
| 119 , m_pumpSessionNestingLevel(0) | 119 , m_pumpSessionNestingLevel(0) |
| 120 { | 120 { |
| 121 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); | 121 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // FIXME: Member variables should be grouped into self-initializing structs to | 124 // FIXME: Member variables should be grouped into self-initializing structs to |
| 125 // minimize code duplication between these constructors. | 125 // minimize code duplication between these constructors. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // but there are cases where that's not true currently. For example, | 159 // but there are cases where that's not true currently. For example, |
| 160 // we we're told to stop parsing before we've consumed all the input. | 160 // we we're told to stop parsing before we've consumed all the input. |
| 161 #endif | 161 #endif |
| 162 } | 162 } |
| 163 | 163 |
| 164 void HTMLDocumentParser::trace(Visitor* visitor) | 164 void HTMLDocumentParser::trace(Visitor* visitor) |
| 165 { | 165 { |
| 166 visitor->trace(m_treeBuilder); | 166 visitor->trace(m_treeBuilder); |
| 167 visitor->trace(m_xssAuditorDelegate); | 167 visitor->trace(m_xssAuditorDelegate); |
| 168 visitor->trace(m_scriptRunner); | 168 visitor->trace(m_scriptRunner); |
| 169 visitor->trace(m_preloader); |
| 169 ScriptableDocumentParser::trace(visitor); | 170 ScriptableDocumentParser::trace(visitor); |
| 170 HTMLScriptRunnerHost::trace(visitor); | 171 HTMLScriptRunnerHost::trace(visitor); |
| 171 } | 172 } |
| 172 | 173 |
| 173 void HTMLDocumentParser::pinToMainThread() | 174 void HTMLDocumentParser::pinToMainThread() |
| 174 { | 175 { |
| 175 ASSERT(!m_haveBackgroundParser); | 176 ASSERT(!m_haveBackgroundParser); |
| 176 ASSERT(!m_isPinnedToMainThread); | 177 ASSERT(!m_isPinnedToMainThread); |
| 177 m_isPinnedToMainThread = true; | 178 m_isPinnedToMainThread = true; |
| 178 if (!m_tokenizer) { | 179 if (!m_tokenizer) { |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1061 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1061 { | 1062 { |
| 1062 ASSERT(decoder); | 1063 ASSERT(decoder); |
| 1063 DecodedDataDocumentParser::setDecoder(decoder); | 1064 DecodedDataDocumentParser::setDecoder(decoder); |
| 1064 | 1065 |
| 1065 if (m_haveBackgroundParser) | 1066 if (m_haveBackgroundParser) |
| 1066 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1067 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
| 1067 } | 1068 } |
| 1068 | 1069 |
| 1069 } | 1070 } |
| OLD | NEW |