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

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

Issue 521363002: Make XHR use the background HTML parser (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: register before finish Created 6 years, 3 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 | Annotate | Revision Log
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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 { 736 {
737 ASSERT(!isStopped()); 737 ASSERT(!isStopped());
738 ASSERT(shouldUseThreading()); 738 ASSERT(shouldUseThreading());
739 ASSERT(!m_haveBackgroundParser); 739 ASSERT(!m_haveBackgroundParser);
740 m_haveBackgroundParser = true; 740 m_haveBackgroundParser = true;
741 741
742 RefPtr<WeakReference<BackgroundHTMLParser> > reference = WeakReference<Backg roundHTMLParser>::createUnbound(); 742 RefPtr<WeakReference<BackgroundHTMLParser> > reference = WeakReference<Backg roundHTMLParser>::createUnbound();
743 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); 743 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference);
744 744
745 // TODO(oysteine): Disabled due to crbug.com/398076 until a full fix can be implemented. 745 // TODO(oysteine): Disabled due to crbug.com/398076 until a full fix can be implemented.
746 if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) 746 if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) {
747 document()->loader()->attachThreadedDataReceiver(adoptPtr(new ParserData Receiver(m_backgroundParser))); 747 if (DocumentLoader* loader = document()->loader())
748 loader->attachThreadedDataReceiver(adoptPtr(new ParserDataReceiver(m _backgroundParser)));
749 }
748 750
749 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration); 751 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration);
750 config->options = m_options; 752 config->options = m_options;
751 config->parser = m_weakFactory.createWeakPtr(); 753 config->parser = m_weakFactory.createWeakPtr();
752 config->xssAuditor = adoptPtr(new XSSAuditor); 754 config->xssAuditor = adoptPtr(new XSSAuditor);
753 config->xssAuditor->init(document(), &m_xssAuditorDelegate); 755 config->xssAuditor->init(document(), &m_xssAuditorDelegate);
754 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), createMediaValues(document()))); 756 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), createMediaValues(document())));
755 config->decoder = takeDecoder(); 757 config->decoder = takeDecoder();
756 758
757 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); 759 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) 1071 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
1070 { 1072 {
1071 ASSERT(decoder); 1073 ASSERT(decoder);
1072 DecodedDataDocumentParser::setDecoder(decoder); 1074 DecodedDataDocumentParser::setDecoder(decoder);
1073 1075
1074 if (m_haveBackgroundParser) 1076 if (m_haveBackgroundParser)
1075 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); 1077 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder()));
1076 } 1078 }
1077 1079
1078 } 1080 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698