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

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

Issue 2550373005: Make WebTaskRunner ThreadSafeRefCounted (Closed)
Patch Set: +DISALLOW_COPY_AND_ASSIGN for win build fix Created 3 years, 11 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 : ScriptableDocumentParser(document, contentPolicy), 126 : ScriptableDocumentParser(document, contentPolicy),
127 m_options(&document), 127 m_options(&document),
128 m_reentryPermit(HTMLParserReentryPermit::create()), 128 m_reentryPermit(HTMLParserReentryPermit::create()),
129 m_token(syncPolicy == ForceSynchronousParsing 129 m_token(syncPolicy == ForceSynchronousParsing
130 ? WTF::wrapUnique(new HTMLToken) 130 ? WTF::wrapUnique(new HTMLToken)
131 : nullptr), 131 : nullptr),
132 m_tokenizer(syncPolicy == ForceSynchronousParsing 132 m_tokenizer(syncPolicy == ForceSynchronousParsing
133 ? HTMLTokenizer::create(m_options) 133 ? HTMLTokenizer::create(m_options)
134 : nullptr), 134 : nullptr),
135 m_loadingTaskRunner( 135 m_loadingTaskRunner(
136 TaskRunnerHelper::get(TaskType::Networking, &document)->clone()), 136 TaskRunnerHelper::get(TaskType::Networking, &document)),
137 m_parserScheduler( 137 m_parserScheduler(
138 syncPolicy == AllowAsynchronousParsing 138 syncPolicy == AllowAsynchronousParsing
139 ? HTMLParserScheduler::create(this, m_loadingTaskRunner.get()) 139 ? HTMLParserScheduler::create(this, m_loadingTaskRunner.get())
140 : nullptr), 140 : nullptr),
141 m_xssAuditorDelegate(&document), 141 m_xssAuditorDelegate(&document),
142 m_weakFactory(this), 142 m_weakFactory(this),
143 m_preloader(HTMLResourcePreloader::create(document)), 143 m_preloader(HTMLResourcePreloader::create(document)),
144 m_tokenizedChunkQueue(TokenizedChunkQueue::create()), 144 m_tokenizedChunkQueue(TokenizedChunkQueue::create()),
145 m_evaluator(DocumentWriteEvaluator::create(document)), 145 m_evaluator(DocumentWriteEvaluator::create(document)),
146 m_pendingCSPMetaToken(nullptr), 146 m_pendingCSPMetaToken(nullptr),
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 document()->settings()->getBackgroundHtmlParserPendingTokenLimit(); 844 document()->settings()->getBackgroundHtmlParserPendingTokenLimit();
845 } 845 }
846 config->shouldCoalesceChunks = 846 config->shouldCoalesceChunks =
847 document()->settings()->getParseHTMLOnMainThreadCoalesceChunks(); 847 document()->settings()->getParseHTMLOnMainThreadCoalesceChunks();
848 } 848 }
849 849
850 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); 850 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
851 851
852 // The background parser is created on the main thread, but may otherwise 852 // The background parser is created on the main thread, but may otherwise
853 // only be used from the parser thread. 853 // only be used from the parser thread.
854 m_backgroundParser = BackgroundHTMLParser::create( 854 m_backgroundParser =
855 std::move(config), m_loadingTaskRunner->clone()); 855 BackgroundHTMLParser::create(std::move(config), m_loadingTaskRunner);
856 // TODO(csharrison): This is a hack to initialize MediaValuesCached on the 856 // TODO(csharrison): This is a hack to initialize MediaValuesCached on the
857 // correct thread. We should get rid of it. 857 // correct thread. We should get rid of it.
858 postTaskToLookaheadParser( 858 postTaskToLookaheadParser(
859 Synchronous, &BackgroundHTMLParser::init, m_backgroundParser, 859 Synchronous, &BackgroundHTMLParser::init, m_backgroundParser,
860 document()->url(), 860 document()->url(),
861 WTF::passed(CachedDocumentParameters::create(document())), 861 WTF::passed(CachedDocumentParameters::create(document())),
862 MediaValuesCached::MediaValuesCachedData(*document())); 862 MediaValuesCached::MediaValuesCachedData(*document()));
863 } 863 }
864 864
865 void HTMLDocumentParser::stopBackgroundParser() { 865 void HTMLDocumentParser::stopBackgroundParser() {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 case Asynchronous: 1316 case Asynchronous:
1317 m_loadingTaskRunner->postTask( 1317 m_loadingTaskRunner->postTask(
1318 BLINK_FROM_HERE, 1318 BLINK_FROM_HERE,
1319 WTF::bind(function, std::forward<Ps>(parameters)...)); 1319 WTF::bind(function, std::forward<Ps>(parameters)...));
1320 return; 1320 return;
1321 } 1321 }
1322 NOTREACHED(); 1322 NOTREACHED();
1323 } 1323 }
1324 1324
1325 } // namespace blink 1325 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698