| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 if (isWaitingForScripts()) { | 658 if (isWaitingForScripts()) { |
| 659 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); | 659 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); |
| 660 | 660 |
| 661 ASSERT(m_preloader); | 661 ASSERT(m_preloader); |
| 662 // TODO(kouhei): m_preloader should be always available for synchronous
parsing case, | 662 // TODO(kouhei): m_preloader should be always available for synchronous
parsing case, |
| 663 // adding paranoia if for speculative crash fix for crbug.com/465478 | 663 // adding paranoia if for speculative crash fix for crbug.com/465478 |
| 664 if (m_preloader) { | 664 if (m_preloader) { |
| 665 if (!m_preloadScanner) { | 665 if (!m_preloadScanner) { |
| 666 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, | 666 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, |
| 667 document()->url(), | 667 document()->url(), |
| 668 CachedDocumentParameters::create(document()))); | 668 CachedDocumentParameters::create(document()), |
| 669 Preconnecter::create())); |
| 669 m_preloadScanner->appendToEnd(m_input.current()); | 670 m_preloadScanner->appendToEnd(m_input.current()); |
| 670 } | 671 } |
| 671 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL
()); | 672 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL
()); |
| 672 } | 673 } |
| 673 } | 674 } |
| 674 | 675 |
| 675 TRACE_EVENT_END1("devtools.timeline", "ParseHTML", "endData", InspectorParse
HtmlEvent::endData(m_input.current().currentLine().zeroBasedInt() - 1)); | 676 TRACE_EVENT_END1("devtools.timeline", "ParseHTML", "endData", InspectorParse
HtmlEvent::endData(m_input.current().currentLine().zeroBasedInt() - 1)); |
| 676 } | 677 } |
| 677 | 678 |
| 678 void HTMLDocumentParser::constructTreeFromHTMLToken() | 679 void HTMLDocumentParser::constructTreeFromHTMLToken() |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 excludedLineNumberSource.setExcludeLineNumbers(); | 743 excludedLineNumberSource.setExcludeLineNumbers(); |
| 743 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource); | 744 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource); |
| 744 pumpTokenizerIfPossible(); | 745 pumpTokenizerIfPossible(); |
| 745 | 746 |
| 746 if (isWaitingForScripts()) { | 747 if (isWaitingForScripts()) { |
| 747 // Check the document.write() output with a separate preload scanner as | 748 // Check the document.write() output with a separate preload scanner as |
| 748 // the main scanner can't deal with insertions. | 749 // the main scanner can't deal with insertions. |
| 749 if (!m_insertionPreloadScanner) { | 750 if (!m_insertionPreloadScanner) { |
| 750 m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_option
s, | 751 m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_option
s, |
| 751 document()->url(), | 752 document()->url(), |
| 752 CachedDocumentParameters::create(document()))); | 753 CachedDocumentParameters::create(document()), |
| 754 Preconnecter::create())); |
| 753 } | 755 } |
| 754 | 756 |
| 755 m_insertionPreloadScanner->appendToEnd(source); | 757 m_insertionPreloadScanner->appendToEnd(source); |
| 756 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme
ntURL()); | 758 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme
ntURL()); |
| 757 } | 759 } |
| 758 | 760 |
| 759 endIfDelayed(); | 761 endIfDelayed(); |
| 760 } | 762 } |
| 761 | 763 |
| 762 void HTMLDocumentParser::startBackgroundParser() | 764 void HTMLDocumentParser::startBackgroundParser() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 774 if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) { | 776 if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) { |
| 775 if (DocumentLoader* loader = document()->loader()) | 777 if (DocumentLoader* loader = document()->loader()) |
| 776 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back
groundParser, document()->contextDocument().get())); | 778 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back
groundParser, document()->contextDocument().get())); |
| 777 } | 779 } |
| 778 | 780 |
| 779 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background
HTMLParser::Configuration); | 781 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background
HTMLParser::Configuration); |
| 780 config->options = m_options; | 782 config->options = m_options; |
| 781 config->parser = m_weakFactory.createWeakPtr(); | 783 config->parser = m_weakFactory.createWeakPtr(); |
| 782 config->xssAuditor = adoptPtr(new XSSAuditor); | 784 config->xssAuditor = adoptPtr(new XSSAuditor); |
| 783 config->xssAuditor->init(document(), &m_xssAuditorDelegate); | 785 config->xssAuditor->init(document(), &m_xssAuditorDelegate); |
| 784 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url().
copy(), CachedDocumentParameters::create(document()))); | 786 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url().
copy(), CachedDocumentParameters::create(document()), Preconnecter::create())); |
| 785 config->decoder = takeDecoder(); | 787 config->decoder = takeDecoder(); |
| 786 | 788 |
| 787 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 789 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
| 788 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread()); | 790 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread()); |
| 789 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s
tart, reference.release(), config.release(), | 791 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s
tart, reference.release(), config.release(), |
| 790 AllowCrossThreadAccess(Platform::current()->currentThread()->scheduler()
))); | 792 AllowCrossThreadAccess(Platform::current()->currentThread()->scheduler()
))); |
| 791 } | 793 } |
| 792 | 794 |
| 793 void HTMLDocumentParser::stopBackgroundParser() | 795 void HTMLDocumentParser::stopBackgroundParser() |
| 794 { | 796 { |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1110 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1109 { | 1111 { |
| 1110 ASSERT(decoder); | 1112 ASSERT(decoder); |
| 1111 DecodedDataDocumentParser::setDecoder(decoder); | 1113 DecodedDataDocumentParser::setDecoder(decoder); |
| 1112 | 1114 |
| 1113 if (m_haveBackgroundParser) | 1115 if (m_haveBackgroundParser) |
| 1114 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); | 1116 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); |
| 1115 } | 1117 } |
| 1116 | 1118 |
| 1117 } | 1119 } |
| OLD | NEW |