Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 1175183006: Make it possible to modify background HTML parser token limits. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back groundParser, document()->contextDocument().get())); 776 loader->attachThreadedDataReceiver(ParserDataReceiver::create(m_back groundParser, document()->contextDocument().get()));
777 } 777 }
778 778
779 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration); 779 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration);
780 config->options = m_options; 780 config->options = m_options;
781 config->parser = m_weakFactory.createWeakPtr(); 781 config->parser = m_weakFactory.createWeakPtr();
782 config->xssAuditor = adoptPtr(new XSSAuditor); 782 config->xssAuditor = adoptPtr(new XSSAuditor);
783 config->xssAuditor->init(document(), &m_xssAuditorDelegate); 783 config->xssAuditor->init(document(), &m_xssAuditorDelegate);
784 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), CachedDocumentParameters::create(document()))); 784 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), CachedDocumentParameters::create(document())));
785 config->decoder = takeDecoder(); 785 config->decoder = takeDecoder();
786 if (document()->settings()) {
Nate Chapin 2015/06/11 18:48:23 I think Document::settings should only be null her
Bryan McQuade 2015/06/12 14:12:59 Ah, interesting. I think varying these constants a
Nate Chapin 2015/06/12 17:02:59 I'm not terribly familiar with our XHR document lo
787 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit() > 0)
788 config->outstandingTokenLimit = document()->settings()->backgroundHt mlParserOutstandingTokenLimit();
789 if (document()->settings()->backgroundHtmlParserPendingTokenLimit() > 0)
Nate Chapin 2015/06/11 18:48:23 if these become unsigned, drop the " > 0"
Bryan McQuade 2015/06/12 14:12:59 Done.
790 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa rserPendingTokenLimit();
791 }
786 792
787 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); 793 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
788 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread()); 794 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread());
789 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s tart, reference.release(), config.release(), 795 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s tart, reference.release(), config.release(),
790 AllowCrossThreadAccess(Platform::current()->currentThread()->scheduler() ))); 796 AllowCrossThreadAccess(Platform::current()->currentThread()->scheduler() )));
791 } 797 }
792 798
793 void HTMLDocumentParser::stopBackgroundParser() 799 void HTMLDocumentParser::stopBackgroundParser()
794 { 800 {
795 ASSERT(shouldUseThreading()); 801 ASSERT(shouldUseThreading());
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) 1114 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
1109 { 1115 {
1110 ASSERT(decoder); 1116 ASSERT(decoder);
1111 DecodedDataDocumentParser::setDecoder(decoder); 1117 DecodedDataDocumentParser::setDecoder(decoder);
1112 1118
1113 if (m_haveBackgroundParser) 1119 if (m_haveBackgroundParser)
1114 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); 1120 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder()));
1115 } 1121 }
1116 1122
1117 } 1123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698