Chromium Code Reviews| 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 } | 771 } |
| 772 | 772 |
| 773 void HTMLDocumentParser::startBackgroundParser() | 773 void HTMLDocumentParser::startBackgroundParser() |
| 774 { | 774 { |
| 775 ASSERT(!isStopped()); | 775 ASSERT(!isStopped()); |
| 776 ASSERT(shouldUseThreading()); | 776 ASSERT(shouldUseThreading()); |
| 777 ASSERT(!m_haveBackgroundParser); | 777 ASSERT(!m_haveBackgroundParser); |
| 778 ASSERT(document()); | 778 ASSERT(document()); |
| 779 m_haveBackgroundParser = true; | 779 m_haveBackgroundParser = true; |
| 780 | 780 |
| 781 // Make sure that a resolver is set up, so that the correct viewport dimensi ons will be fed to the background parser and preload scanner. | |
| 782 document()->ensureStyleResolver(); | |
| 783 | |
| 781 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr oundHTMLParser>::createUnbound(); | 784 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr oundHTMLParser>::createUnbound(); |
| 782 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); | 785 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); |
| 783 | 786 |
| 784 // FIXME(oysteine): Disabled due to crbug.com/398076 until a full fix can be implemented. | 787 // FIXME(oysteine): Disabled due to crbug.com/398076 until a full fix can be implemented. |
| 785 if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) { | 788 if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) { |
| 786 if (DocumentLoader* loader = document()->loader()) | 789 if (DocumentLoader* loader = document()->loader()) |
| 787 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back groundParser, document()->contextDocument().get())); | 790 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back groundParser, document()->contextDocument().get())); |
| 788 } | 791 } |
| 789 | 792 |
| 790 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration); | 793 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration); |
| 791 config->options = m_options; | 794 config->options = m_options; |
| 792 config->parser = m_weakFactory.createWeakPtr(); | 795 config->parser = m_weakFactory.createWeakPtr(); |
| 793 config->xssAuditor = adoptPtr(new XSSAuditor); | 796 config->xssAuditor = adoptPtr(new XSSAuditor); |
| 794 config->xssAuditor->init(document(), &m_xssAuditorDelegate); | 797 config->xssAuditor->init(document(), &m_xssAuditorDelegate); |
| 798 | |
|
bokan
2015/10/22 16:56:46
Nit: Remove extra space?
| |
| 795 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), CachedDocumentParameters::create(document()))); | 799 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), CachedDocumentParameters::create(document()))); |
| 796 config->decoder = takeDecoder(); | 800 config->decoder = takeDecoder(); |
| 797 if (document()->settings()) { | 801 if (document()->settings()) { |
| 798 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) | 802 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) |
| 799 config->outstandingTokenLimit = document()->settings()->backgroundHt mlParserOutstandingTokenLimit(); | 803 config->outstandingTokenLimit = document()->settings()->backgroundHt mlParserOutstandingTokenLimit(); |
| 800 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) | 804 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) |
| 801 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa rserPendingTokenLimit(); | 805 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa rserPendingTokenLimit(); |
| 802 } | 806 } |
| 803 | 807 |
| 804 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 808 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1136 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1140 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1137 { | 1141 { |
| 1138 ASSERT(decoder); | 1142 ASSERT(decoder); |
| 1139 DecodedDataDocumentParser::setDecoder(decoder); | 1143 DecodedDataDocumentParser::setDecoder(decoder); |
| 1140 | 1144 |
| 1141 if (m_haveBackgroundParser) | 1145 if (m_haveBackgroundParser) |
| 1142 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); | 1146 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); |
| 1143 } | 1147 } |
| 1144 | 1148 |
| 1145 } | 1149 } |
| OLD | NEW |