| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 RELEASE_ASSERT(!isStopped()); | 680 RELEASE_ASSERT(!isStopped()); |
| 681 | 681 |
| 682 if (isWaitingForScripts()) { | 682 if (isWaitingForScripts()) { |
| 683 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); | 683 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); |
| 684 | 684 |
| 685 ASSERT(m_preloader); | 685 ASSERT(m_preloader); |
| 686 // TODO(kouhei): m_preloader should be always available for synchronous
parsing case, | 686 // TODO(kouhei): m_preloader should be always available for synchronous
parsing case, |
| 687 // adding paranoia if for speculative crash fix for crbug.com/465478 | 687 // adding paranoia if for speculative crash fix for crbug.com/465478 |
| 688 if (m_preloader) { | 688 if (m_preloader) { |
| 689 if (!m_preloadScanner) { | 689 if (!m_preloadScanner) { |
| 690 m_preloadScanner = HTMLPreloadScanner::create( | 690 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, |
| 691 m_options, | |
| 692 document()->url(), | 691 document()->url(), |
| 693 CachedDocumentParameters::create(document()), | 692 CachedDocumentParameters::create(document()))); |
| 694 MediaValuesCached::MediaValuesCachedData(*document())); | |
| 695 m_preloadScanner->appendToEnd(m_input.current()); | 693 m_preloadScanner->appendToEnd(m_input.current()); |
| 696 } | 694 } |
| 697 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL
()); | 695 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL
()); |
| 698 } | 696 } |
| 699 } | 697 } |
| 700 | 698 |
| 701 TRACE_EVENT_END1("devtools.timeline", "ParseHTML", "endData", InspectorParse
HtmlEvent::endData(m_input.current().currentLine().zeroBasedInt() - 1)); | 699 TRACE_EVENT_END1("devtools.timeline", "ParseHTML", "endData", InspectorParse
HtmlEvent::endData(m_input.current().currentLine().zeroBasedInt() - 1)); |
| 702 } | 700 } |
| 703 | 701 |
| 704 void HTMLDocumentParser::constructTreeFromHTMLToken() | 702 void HTMLDocumentParser::constructTreeFromHTMLToken() |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 | 764 |
| 767 SegmentedString excludedLineNumberSource(source); | 765 SegmentedString excludedLineNumberSource(source); |
| 768 excludedLineNumberSource.setExcludeLineNumbers(); | 766 excludedLineNumberSource.setExcludeLineNumbers(); |
| 769 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource); | 767 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource); |
| 770 pumpTokenizerIfPossible(); | 768 pumpTokenizerIfPossible(); |
| 771 | 769 |
| 772 if (isWaitingForScripts()) { | 770 if (isWaitingForScripts()) { |
| 773 // Check the document.write() output with a separate preload scanner as | 771 // Check the document.write() output with a separate preload scanner as |
| 774 // the main scanner can't deal with insertions. | 772 // the main scanner can't deal with insertions. |
| 775 if (!m_insertionPreloadScanner) { | 773 if (!m_insertionPreloadScanner) { |
| 776 m_insertionPreloadScanner = HTMLPreloadScanner::create( | 774 m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_option
s, |
| 777 m_options, | |
| 778 document()->url(), | 775 document()->url(), |
| 779 CachedDocumentParameters::create(document()), | 776 CachedDocumentParameters::create(document()))); |
| 780 MediaValuesCached::MediaValuesCachedData(*document())); | |
| 781 } | 777 } |
| 782 | 778 |
| 783 m_insertionPreloadScanner->appendToEnd(source); | 779 m_insertionPreloadScanner->appendToEnd(source); |
| 784 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme
ntURL()); | 780 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme
ntURL()); |
| 785 } | 781 } |
| 786 | 782 |
| 787 endIfDelayed(); | 783 endIfDelayed(); |
| 788 } | 784 } |
| 789 | 785 |
| 790 void HTMLDocumentParser::startBackgroundParser() | 786 void HTMLDocumentParser::startBackgroundParser() |
| (...skipping 16 matching lines...) Expand all Loading... |
| 807 if (DocumentLoader* loader = document()->loader()) | 803 if (DocumentLoader* loader = document()->loader()) |
| 808 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back
groundParser, document()->contextDocument().get())); | 804 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back
groundParser, document()->contextDocument().get())); |
| 809 } | 805 } |
| 810 | 806 |
| 811 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background
HTMLParser::Configuration); | 807 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background
HTMLParser::Configuration); |
| 812 config->options = m_options; | 808 config->options = m_options; |
| 813 config->parser = m_weakFactory.createWeakPtr(); | 809 config->parser = m_weakFactory.createWeakPtr(); |
| 814 config->xssAuditor = adoptPtr(new XSSAuditor); | 810 config->xssAuditor = adoptPtr(new XSSAuditor); |
| 815 config->xssAuditor->init(document(), &m_xssAuditorDelegate); | 811 config->xssAuditor->init(document(), &m_xssAuditorDelegate); |
| 816 | 812 |
| 813 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url().
copy(), CachedDocumentParameters::create(document()))); |
| 817 config->decoder = takeDecoder(); | 814 config->decoder = takeDecoder(); |
| 818 config->parsedChunkQueue = m_parsedChunkQueue.get(); | 815 config->parsedChunkQueue = m_parsedChunkQueue.get(); |
| 819 if (document()->settings()) { | 816 if (document()->settings()) { |
| 820 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) | 817 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) |
| 821 config->outstandingTokenLimit = document()->settings()->backgroundHt
mlParserOutstandingTokenLimit(); | 818 config->outstandingTokenLimit = document()->settings()->backgroundHt
mlParserOutstandingTokenLimit(); |
| 822 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) | 819 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) |
| 823 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa
rserPendingTokenLimit(); | 820 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa
rserPendingTokenLimit(); |
| 824 } | 821 } |
| 825 | 822 |
| 826 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 823 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
| 827 HTMLParserThread::shared()->postTask(threadSafeBind( | 824 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread()); |
| 828 &BackgroundHTMLParser::start, | 825 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s
tart, reference.release(), config.release(), |
| 829 reference.release(), | |
| 830 config.release(), | |
| 831 document()->url(), | |
| 832 CachedDocumentParameters::create(document()), | |
| 833 MediaValuesCached::MediaValuesCachedData(*document()), | |
| 834 adoptPtr(m_loadingTaskRunner->clone()))); | 826 adoptPtr(m_loadingTaskRunner->clone()))); |
| 835 } | 827 } |
| 836 | 828 |
| 837 void HTMLDocumentParser::stopBackgroundParser() | 829 void HTMLDocumentParser::stopBackgroundParser() |
| 838 { | 830 { |
| 839 ASSERT(shouldUseThreading()); | 831 ASSERT(shouldUseThreading()); |
| 840 ASSERT(m_haveBackgroundParser); | 832 ASSERT(m_haveBackgroundParser); |
| 841 m_haveBackgroundParser = false; | 833 m_haveBackgroundParser = false; |
| 842 | 834 |
| 843 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s
top, AllowCrossThreadAccess(m_backgroundParser))); | 835 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s
top, AllowCrossThreadAccess(m_backgroundParser))); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1155 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1164 { | 1156 { |
| 1165 ASSERT(decoder); | 1157 ASSERT(decoder); |
| 1166 DecodedDataDocumentParser::setDecoder(decoder); | 1158 DecodedDataDocumentParser::setDecoder(decoder); |
| 1167 | 1159 |
| 1168 if (m_haveBackgroundParser) | 1160 if (m_haveBackgroundParser) |
| 1169 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); | 1161 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); |
| 1170 } | 1162 } |
| 1171 | 1163 |
| 1172 } // namespace blink | 1164 } // namespace blink |
| OLD | NEW |