| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ParserSynchronizationPolicy syncPolicy) | 124 ParserSynchronizationPolicy syncPolicy) |
| 125 : ScriptableDocumentParser(document, contentPolicy), | 125 : ScriptableDocumentParser(document, contentPolicy), |
| 126 m_options(&document), | 126 m_options(&document), |
| 127 m_reentryPermit(HTMLParserReentryPermit::create()), | 127 m_reentryPermit(HTMLParserReentryPermit::create()), |
| 128 m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken) | 128 m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken) |
| 129 : nullptr), | 129 : nullptr), |
| 130 m_tokenizer(syncPolicy == ForceSynchronousParsing | 130 m_tokenizer(syncPolicy == ForceSynchronousParsing |
| 131 ? HTMLTokenizer::create(m_options) | 131 ? HTMLTokenizer::create(m_options) |
| 132 : nullptr), | 132 : nullptr), |
| 133 m_loadingTaskRunner( | 133 m_loadingTaskRunner( |
| 134 TaskRunnerHelper::get(TaskType::Networking, &document)->clone()), | 134 TaskRunnerHelper::get(TaskType::Networking, &document)), |
| 135 m_parserScheduler( | 135 m_parserScheduler( |
| 136 syncPolicy == AllowAsynchronousParsing | 136 syncPolicy == AllowAsynchronousParsing |
| 137 ? HTMLParserScheduler::create(this, m_loadingTaskRunner.get()) | 137 ? HTMLParserScheduler::create(this, m_loadingTaskRunner.get()) |
| 138 : nullptr), | 138 : nullptr), |
| 139 m_xssAuditorDelegate(&document), | 139 m_xssAuditorDelegate(&document), |
| 140 m_weakFactory(this), | 140 m_weakFactory(this), |
| 141 m_preloader(HTMLResourcePreloader::create(document)), | 141 m_preloader(HTMLResourcePreloader::create(document)), |
| 142 m_tokenizedChunkQueue(TokenizedChunkQueue::create()), | 142 m_tokenizedChunkQueue(TokenizedChunkQueue::create()), |
| 143 m_evaluator(DocumentWriteEvaluator::create(document)), | 143 m_evaluator(DocumentWriteEvaluator::create(document)), |
| 144 m_pendingCSPMetaToken(nullptr), | 144 m_pendingCSPMetaToken(nullptr), |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 config->pendingTokenLimit = | 837 config->pendingTokenLimit = |
| 838 document()->settings()->backgroundHtmlParserPendingTokenLimit(); | 838 document()->settings()->backgroundHtmlParserPendingTokenLimit(); |
| 839 config->shouldCoalesceChunks = | 839 config->shouldCoalesceChunks = |
| 840 document()->settings()->parseHTMLOnMainThreadCoalesceChunks(); | 840 document()->settings()->parseHTMLOnMainThreadCoalesceChunks(); |
| 841 } | 841 } |
| 842 | 842 |
| 843 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 843 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
| 844 | 844 |
| 845 // The background parser is created on the main thread, but may otherwise | 845 // The background parser is created on the main thread, but may otherwise |
| 846 // only be used from the parser thread. | 846 // only be used from the parser thread. |
| 847 m_backgroundParser = BackgroundHTMLParser::create( | 847 m_backgroundParser = |
| 848 std::move(config), m_loadingTaskRunner->clone()); | 848 BackgroundHTMLParser::create(std::move(config), m_loadingTaskRunner); |
| 849 // TODO(csharrison): This is a hack to initialize MediaValuesCached on the | 849 // TODO(csharrison): This is a hack to initialize MediaValuesCached on the |
| 850 // correct thread. We should get rid of it. | 850 // correct thread. We should get rid of it. |
| 851 postTaskToLookaheadParser( | 851 postTaskToLookaheadParser( |
| 852 Synchronous, &BackgroundHTMLParser::init, m_backgroundParser, | 852 Synchronous, &BackgroundHTMLParser::init, m_backgroundParser, |
| 853 document()->url(), passed(CachedDocumentParameters::create(document())), | 853 document()->url(), passed(CachedDocumentParameters::create(document())), |
| 854 MediaValuesCached::MediaValuesCachedData(*document())); | 854 MediaValuesCached::MediaValuesCachedData(*document())); |
| 855 } | 855 } |
| 856 | 856 |
| 857 void HTMLDocumentParser::stopBackgroundParser() { | 857 void HTMLDocumentParser::stopBackgroundParser() { |
| 858 ASSERT(shouldUseThreading()); | 858 ASSERT(shouldUseThreading()); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 case Asynchronous: | 1306 case Asynchronous: |
| 1307 m_loadingTaskRunner->postTask( | 1307 m_loadingTaskRunner->postTask( |
| 1308 BLINK_FROM_HERE, | 1308 BLINK_FROM_HERE, |
| 1309 WTF::bind(function, std::forward<Ps>(parameters)...)); | 1309 WTF::bind(function, std::forward<Ps>(parameters)...)); |
| 1310 return; | 1310 return; |
| 1311 } | 1311 } |
| 1312 NOTREACHED(); | 1312 NOTREACHED(); |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 } // namespace blink | 1315 } // namespace blink |
| OLD | NEW |