| 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 std::unique_ptr<BackgroundHTMLParser::Configuration> config = | 824 std::unique_ptr<BackgroundHTMLParser::Configuration> config = |
| 825 WTF::wrapUnique(new BackgroundHTMLParser::Configuration); | 825 WTF::wrapUnique(new BackgroundHTMLParser::Configuration); |
| 826 config->options = m_options; | 826 config->options = m_options; |
| 827 config->parser = m_weakFactory.createWeakPtr(); | 827 config->parser = m_weakFactory.createWeakPtr(); |
| 828 config->xssAuditor = WTF::wrapUnique(new XSSAuditor); | 828 config->xssAuditor = WTF::wrapUnique(new XSSAuditor); |
| 829 config->xssAuditor->init(document(), &m_xssAuditorDelegate); | 829 config->xssAuditor->init(document(), &m_xssAuditorDelegate); |
| 830 | 830 |
| 831 config->decoder = takeDecoder(); | 831 config->decoder = takeDecoder(); |
| 832 config->tokenizedChunkQueue = m_tokenizedChunkQueue.get(); | 832 config->tokenizedChunkQueue = m_tokenizedChunkQueue.get(); |
| 833 if (document()->settings()) { | 833 if (document()->settings()) { |
| 834 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) | 834 if (document() |
| 835 ->settings() |
| 836 ->getBackgroundHtmlParserOutstandingTokenLimit()) { |
| 835 config->outstandingTokenLimit = | 837 config->outstandingTokenLimit = |
| 836 document()->settings()->backgroundHtmlParserOutstandingTokenLimit(); | 838 document() |
| 837 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) | 839 ->settings() |
| 840 ->getBackgroundHtmlParserOutstandingTokenLimit(); |
| 841 } |
| 842 if (document()->settings()->getBackgroundHtmlParserPendingTokenLimit()) { |
| 838 config->pendingTokenLimit = | 843 config->pendingTokenLimit = |
| 839 document()->settings()->backgroundHtmlParserPendingTokenLimit(); | 844 document()->settings()->getBackgroundHtmlParserPendingTokenLimit(); |
| 845 } |
| 840 config->shouldCoalesceChunks = | 846 config->shouldCoalesceChunks = |
| 841 document()->settings()->parseHTMLOnMainThreadCoalesceChunks(); | 847 document()->settings()->getParseHTMLOnMainThreadCoalesceChunks(); |
| 842 } | 848 } |
| 843 | 849 |
| 844 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 850 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
| 845 | 851 |
| 846 // The background parser is created on the main thread, but may otherwise | 852 // The background parser is created on the main thread, but may otherwise |
| 847 // only be used from the parser thread. | 853 // only be used from the parser thread. |
| 848 m_backgroundParser = BackgroundHTMLParser::create( | 854 m_backgroundParser = BackgroundHTMLParser::create( |
| 849 std::move(config), m_loadingTaskRunner->clone()); | 855 std::move(config), m_loadingTaskRunner->clone()); |
| 850 // TODO(csharrison): This is a hack to initialize MediaValuesCached on the | 856 // TODO(csharrison): This is a hack to initialize MediaValuesCached on the |
| 851 // correct thread. We should get rid of it. | 857 // correct thread. We should get rid of it. |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 startBackgroundParser(); | 1155 startBackgroundParser(); |
| 1150 | 1156 |
| 1151 std::unique_ptr<Vector<char>> buffer = | 1157 std::unique_ptr<Vector<char>> buffer = |
| 1152 WTF::makeUnique<Vector<char>>(length); | 1158 WTF::makeUnique<Vector<char>>(length); |
| 1153 memcpy(buffer->data(), data, length); | 1159 memcpy(buffer->data(), data, length); |
| 1154 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), | 1160 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), |
| 1155 "HTMLDocumentParser::appendBytes", "size", (unsigned)length); | 1161 "HTMLDocumentParser::appendBytes", "size", (unsigned)length); |
| 1156 | 1162 |
| 1157 LookaheadParserTaskSynchrony policy = | 1163 LookaheadParserTaskSynchrony policy = |
| 1158 document()->settings() && | 1164 document()->settings() && |
| 1159 document()->settings()->parseHTMLOnMainThreadSyncTokenize() | 1165 document()->settings()->getParseHTMLOnMainThreadSyncTokenize() |
| 1160 ? Synchronous | 1166 ? Synchronous |
| 1161 : Asynchronous; | 1167 : Asynchronous; |
| 1162 postTaskToLookaheadParser( | 1168 postTaskToLookaheadParser( |
| 1163 policy, &BackgroundHTMLParser::appendRawBytesFromMainThread, | 1169 policy, &BackgroundHTMLParser::appendRawBytesFromMainThread, |
| 1164 m_backgroundParser, WTF::passed(std::move(buffer)), bytesReceivedTime); | 1170 m_backgroundParser, WTF::passed(std::move(buffer)), bytesReceivedTime); |
| 1165 return; | 1171 return; |
| 1166 } | 1172 } |
| 1167 | 1173 |
| 1168 DecodedDataDocumentParser::appendBytes(data, length); | 1174 DecodedDataDocumentParser::appendBytes(data, length); |
| 1169 } | 1175 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 case Asynchronous: | 1316 case Asynchronous: |
| 1311 m_loadingTaskRunner->postTask( | 1317 m_loadingTaskRunner->postTask( |
| 1312 BLINK_FROM_HERE, | 1318 BLINK_FROM_HERE, |
| 1313 WTF::bind(function, std::forward<Ps>(parameters)...)); | 1319 WTF::bind(function, std::forward<Ps>(parameters)...)); |
| 1314 return; | 1320 return; |
| 1315 } | 1321 } |
| 1316 NOTREACHED(); | 1322 NOTREACHED(); |
| 1317 } | 1323 } |
| 1318 | 1324 |
| 1319 } // namespace blink | 1325 } // namespace blink |
| OLD | NEW |