| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 HTMLDocumentParser::HTMLDocumentParser(Document& document, ParserContentPolicy c
ontentPolicy, ParserSynchronizationPolicy syncPolicy) | 110 HTMLDocumentParser::HTMLDocumentParser(Document& document, ParserContentPolicy c
ontentPolicy, ParserSynchronizationPolicy syncPolicy) |
| 111 : ScriptableDocumentParser(document, contentPolicy) | 111 : ScriptableDocumentParser(document, contentPolicy) |
| 112 , m_options(&document) | 112 , m_options(&document) |
| 113 , m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken)
: nullptr) | 113 , m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken)
: nullptr) |
| 114 , m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(
m_options) : nullptr) | 114 , m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(
m_options) : nullptr) |
| 115 , m_loadingTaskRunner(TaskRunnerHelper::getLoadingTaskRunner(&document)->clo
ne()) | 115 , m_loadingTaskRunner(TaskRunnerHelper::getLoadingTaskRunner(&document)->clo
ne()) |
| 116 , m_parserScheduler(syncPolicy == AllowAsynchronousParsing ? HTMLParserSched
uler::create(this, m_loadingTaskRunner.get()) : nullptr) | 116 , m_parserScheduler(syncPolicy == AllowAsynchronousParsing ? HTMLParserSched
uler::create(this, m_loadingTaskRunner.get()) : nullptr) |
| 117 , m_xssAuditorDelegate(&document) | 117 , m_xssAuditorDelegate(&document) |
| 118 , m_weakFactory(this) | 118 , m_weakFactory(this) |
| 119 , m_preloader(HTMLResourcePreloader::create(document)) | 119 , m_preloader(HTMLResourcePreloader::create(document)) |
| 120 , m_parsedChunkQueue(ParsedChunkQueue::create()) | 120 , m_tokenizedChunkQueue(TokenizedChunkQueue::create()) |
| 121 , m_evaluator(DocumentWriteEvaluator::create(document)) | 121 , m_evaluator(DocumentWriteEvaluator::create(document)) |
| 122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing) | 122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing) |
| 123 , m_endWasDelayed(false) | 123 , m_endWasDelayed(false) |
| 124 , m_haveBackgroundParser(false) | 124 , m_haveBackgroundParser(false) |
| 125 , m_tasksWereSuspended(false) | 125 , m_tasksWereSuspended(false) |
| 126 , m_pumpSessionNestingLevel(0) | 126 , m_pumpSessionNestingLevel(0) |
| 127 , m_pumpSpeculationsSessionNestingLevel(0) | 127 , m_pumpSpeculationsSessionNestingLevel(0) |
| 128 , m_isParsingAtLineNumber(false) | 128 , m_isParsingAtLineNumber(false) |
| 129 , m_triedLoadingLinkHeaders(false) | 129 , m_triedLoadingLinkHeaders(false) |
| 130 { | 130 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 145 visitor->trace(m_parserScheduler); | 145 visitor->trace(m_parserScheduler); |
| 146 visitor->trace(m_xssAuditorDelegate); | 146 visitor->trace(m_xssAuditorDelegate); |
| 147 visitor->trace(m_scriptRunner); | 147 visitor->trace(m_scriptRunner); |
| 148 visitor->trace(m_preloader); | 148 visitor->trace(m_preloader); |
| 149 ScriptableDocumentParser::trace(visitor); | 149 ScriptableDocumentParser::trace(visitor); |
| 150 HTMLScriptRunnerHost::trace(visitor); | 150 HTMLScriptRunnerHost::trace(visitor); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void HTMLDocumentParser::detach() | 153 void HTMLDocumentParser::detach() |
| 154 { | 154 { |
| 155 if (!isParsingFragment() && m_parsedChunkQueue.get() && m_parsedChunkQueue->
peakPendingChunkCount()) { | 155 if (!isParsingFragment() && m_tokenizedChunkQueue.get() && m_tokenizedChunkQ
ueue->peakPendingChunkCount()) { |
| 156 DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingChunkHistogram, ("P
arser.PeakPendingChunkCount", 1, 1000, 50)); | 156 DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingChunkHistogram, ("P
arser.PeakPendingChunkCount", 1, 1000, 50)); |
| 157 peakPendingChunkHistogram.count(m_parsedChunkQueue->peakPendingChunkCoun
t()); | 157 peakPendingChunkHistogram.count(m_tokenizedChunkQueue->peakPendingChunkC
ount()); |
| 158 DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingTokenHistogram, ("P
arser.PeakPendingTokenCount", 1, 100000, 50)); | 158 DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingTokenHistogram, ("P
arser.PeakPendingTokenCount", 1, 100000, 50)); |
| 159 peakPendingTokenHistogram.count(m_parsedChunkQueue->peakPendingTokenCoun
t()); | 159 peakPendingTokenHistogram.count(m_tokenizedChunkQueue->peakPendingTokenC
ount()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 if (m_haveBackgroundParser) | 162 if (m_haveBackgroundParser) |
| 163 stopBackgroundParser(); | 163 stopBackgroundParser(); |
| 164 DocumentParser::detach(); | 164 DocumentParser::detach(); |
| 165 if (m_scriptRunner) | 165 if (m_scriptRunner) |
| 166 m_scriptRunner->detach(); | 166 m_scriptRunner->detach(); |
| 167 m_treeBuilder->detach(); | 167 m_treeBuilder->detach(); |
| 168 // FIXME: It seems wrong that we would have a preload scanner here. | 168 // FIXME: It seems wrong that we would have a preload scanner here. |
| 169 // Yet during fast/dom/HTMLScriptElement/script-load-events.html we do. | 169 // Yet during fast/dom/HTMLScriptElement/script-load-events.html we do. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // should happen is that assigning window.location causes the | 278 // should happen is that assigning window.location causes the |
| 279 // parser to stop parsing cleanly. The problem is we're not | 279 // parser to stop parsing cleanly. The problem is we're not |
| 280 // perpared to do that at every point where we run JavaScript. | 280 // perpared to do that at every point where we run JavaScript. |
| 281 if (!isParsingFragment() | 281 if (!isParsingFragment() |
| 282 && document()->frame() && document()->frame()->navigationScheduler().loc
ationChangePending()) | 282 && document()->frame() && document()->frame()->navigationScheduler().loc
ationChangePending()) |
| 283 return false; | 283 return false; |
| 284 | 284 |
| 285 return true; | 285 return true; |
| 286 } | 286 } |
| 287 | 287 |
| 288 void HTMLDocumentParser::notifyPendingParsedChunks() | 288 void HTMLDocumentParser::notifyPendingTokenizedChunks() |
| 289 { | 289 { |
| 290 TRACE_EVENT0("blink", "HTMLDocumentParser::notifyPendingParsedChunks"); | 290 TRACE_EVENT0("blink", "HTMLDocumentParser::notifyPendingTokenizedChunks"); |
| 291 ASSERT(m_parsedChunkQueue); | 291 DCHECK(m_tokenizedChunkQueue); |
| 292 | 292 |
| 293 Vector<std::unique_ptr<ParsedChunk>> pendingChunks; | 293 Vector<std::unique_ptr<TokenizedChunk>> pendingChunks; |
| 294 m_parsedChunkQueue->takeAll(pendingChunks); | 294 m_tokenizedChunkQueue->takeAll(pendingChunks); |
| 295 | 295 |
| 296 if (!isParsing()) | 296 if (!isParsing()) |
| 297 return; | 297 return; |
| 298 | 298 |
| 299 // ApplicationCache needs to be initialized before issuing preloads. | 299 // ApplicationCache needs to be initialized before issuing preloads. |
| 300 // We suspend preload until HTMLHTMLElement is inserted and | 300 // We suspend preload until HTMLHTMLElement is inserted and |
| 301 // ApplicationCache is initialized. Note: link rel preloads don't follow | 301 // ApplicationCache is initialized. Note: link rel preloads don't follow |
| 302 // this policy per the spec. These directives should initiate a fetch as | 302 // this policy per the spec. These directives should initiate a fetch as |
| 303 // fast as possible. | 303 // fast as possible. |
| 304 if (!m_triedLoadingLinkHeaders && document()->loader() && !pendingChunks.isE
mpty()) { | 304 if (!m_triedLoadingLinkHeaders && document()->loader() && !pendingChunks.isE
mpty()) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 else | 355 else |
| 356 m_parserScheduler->scheduleForResume(); | 356 m_parserScheduler->scheduleForResume(); |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) | 360 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) |
| 361 { | 361 { |
| 362 document()->setEncodingData(data); | 362 document()->setEncodingData(data); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void HTMLDocumentParser::validateSpeculations(std::unique_ptr<ParsedChunk> chunk
) | 365 void HTMLDocumentParser::validateSpeculations(std::unique_ptr<TokenizedChunk> ch
unk) |
| 366 { | 366 { |
| 367 ASSERT(chunk); | 367 ASSERT(chunk); |
| 368 if (isWaitingForScripts()) { | 368 if (isWaitingForScripts()) { |
| 369 // We're waiting on a network script, just save the chunk, we'll get | 369 // We're waiting on a network script, just save the chunk, we'll get |
| 370 // a second validateSpeculations call after the script completes. | 370 // a second validateSpeculations call after the script completes. |
| 371 // This call should have been made immediately after runScriptsForPaused
TreeBuilder | 371 // This call should have been made immediately after runScriptsForPaused
TreeBuilder |
| 372 // which may have started a network load and left us waiting. | 372 // which may have started a network load and left us waiting. |
| 373 ASSERT(!m_lastChunkBeforeScript); | 373 ASSERT(!m_lastChunkBeforeScript); |
| 374 m_lastChunkBeforeScript = std::move(chunk); | 374 m_lastChunkBeforeScript = std::move(chunk); |
| 375 return; | 375 return; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 394 && tokenizer->getState() == HTMLTokenizer::DataState | 394 && tokenizer->getState() == HTMLTokenizer::DataState |
| 395 && m_input.current().isEmpty() | 395 && m_input.current().isEmpty() |
| 396 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB
uilder.get())) { | 396 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB
uilder.get())) { |
| 397 ASSERT(token->isUninitialized()); | 397 ASSERT(token->isUninitialized()); |
| 398 return; | 398 return; |
| 399 } | 399 } |
| 400 | 400 |
| 401 discardSpeculationsAndResumeFrom(std::move(chunk), std::move(token), std::mo
ve(tokenizer)); | 401 discardSpeculationsAndResumeFrom(std::move(chunk), std::move(token), std::mo
ve(tokenizer)); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(std::unique_ptr<Parsed
Chunk> lastChunkBeforeScript, std::unique_ptr<HTMLToken> token, std::unique_ptr<
HTMLTokenizer> tokenizer) | 404 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(std::unique_ptr<Tokeni
zedChunk> lastChunkBeforeScript, std::unique_ptr<HTMLToken> token, std::unique_p
tr<HTMLTokenizer> tokenizer) |
| 405 { | 405 { |
| 406 m_weakFactory.revokeAll(); | 406 m_weakFactory.revokeAll(); |
| 407 | 407 |
| 408 size_t discardedTokenCount = 0; | 408 size_t discardedTokenCount = 0; |
| 409 for (const auto& speculation : m_speculations) { | 409 for (const auto& speculation : m_speculations) { |
| 410 discardedTokenCount += speculation->tokens->size(); | 410 discardedTokenCount += speculation->tokens->size(); |
| 411 } | 411 } |
| 412 DEFINE_STATIC_LOCAL(CustomCountHistogram, discardedTokenCountHistogram, ("Pa
rser.DiscardedTokenCount", 1, 100000, 50)); | 412 DEFINE_STATIC_LOCAL(CustomCountHistogram, discardedTokenCountHistogram, ("Pa
rser.DiscardedTokenCount", 1, 100000, 50)); |
| 413 discardedTokenCountHistogram.count(discardedTokenCount); | 413 discardedTokenCountHistogram.count(discardedTokenCount); |
| 414 | 414 |
| 415 m_speculations.clear(); | 415 m_speculations.clear(); |
| 416 | 416 |
| 417 std::unique_ptr<BackgroundHTMLParser::Checkpoint> checkpoint = wrapUnique(ne
w BackgroundHTMLParser::Checkpoint); | 417 std::unique_ptr<BackgroundHTMLParser::Checkpoint> checkpoint = wrapUnique(ne
w BackgroundHTMLParser::Checkpoint); |
| 418 checkpoint->parser = m_weakFactory.createWeakPtr(); | 418 checkpoint->parser = m_weakFactory.createWeakPtr(); |
| 419 checkpoint->token = std::move(token); | 419 checkpoint->token = std::move(token); |
| 420 checkpoint->tokenizer = std::move(tokenizer); | 420 checkpoint->tokenizer = std::move(tokenizer); |
| 421 checkpoint->treeBuilderState = HTMLTreeBuilderSimulator::stateFor(m_treeBuil
der.get()); | 421 checkpoint->treeBuilderState = HTMLTreeBuilderSimulator::stateFor(m_treeBuil
der.get()); |
| 422 checkpoint->inputCheckpoint = lastChunkBeforeScript->inputCheckpoint; | 422 checkpoint->inputCheckpoint = lastChunkBeforeScript->inputCheckpoint; |
| 423 checkpoint->preloadScannerCheckpoint = lastChunkBeforeScript->preloadScanner
Checkpoint; | 423 checkpoint->preloadScannerCheckpoint = lastChunkBeforeScript->preloadScanner
Checkpoint; |
| 424 checkpoint->unparsedInput = m_input.current().toString().isolatedCopy(); | 424 checkpoint->unparsedInput = m_input.current().toString().isolatedCopy(); |
| 425 m_input.current().clear(); // FIXME: This should be passed in instead of cle
ared. | 425 m_input.current().clear(); // FIXME: This should be passed in instead of cle
ared. |
| 426 | 426 |
| 427 ASSERT(checkpoint->unparsedInput.isSafeToSendToAnotherThread()); | 427 ASSERT(checkpoint->unparsedInput.isSafeToSendToAnotherThread()); |
| 428 postTaskToLookaheadParser(Asynchronous, &BackgroundHTMLParser::resumeFrom, m
_backgroundParser, passed(std::move(checkpoint))); | 428 postTaskToLookaheadParser(Asynchronous, &BackgroundHTMLParser::resumeFrom, m
_backgroundParser, passed(std::move(checkpoint))); |
| 429 } | 429 } |
| 430 | 430 |
| 431 size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(std::unique_pt
r<ParsedChunk> popChunk) | 431 size_t HTMLDocumentParser::processTokenizedChunkFromBackgroundParser(std::unique
_ptr<TokenizedChunk> popChunk) |
| 432 { | 432 { |
| 433 TRACE_EVENT_WITH_FLOW0("blink,loading", "HTMLDocumentParser::processParsedCh
unkFromBackgroundParser", popChunk.get(), TRACE_EVENT_FLAG_FLOW_IN); | 433 TRACE_EVENT_WITH_FLOW0("blink,loading", "HTMLDocumentParser::processTokenize
dChunkFromBackgroundParser", popChunk.get(), TRACE_EVENT_FLAG_FLOW_IN); |
| 434 AutoReset<bool> hasLineNumber(&m_isParsingAtLineNumber, true); | 434 AutoReset<bool> hasLineNumber(&m_isParsingAtLineNumber, true); |
| 435 | 435 |
| 436 ASSERT_WITH_SECURITY_IMPLICATION(m_pumpSpeculationsSessionNestingLevel == 1)
; | 436 ASSERT_WITH_SECURITY_IMPLICATION(m_pumpSpeculationsSessionNestingLevel == 1)
; |
| 437 ASSERT_WITH_SECURITY_IMPLICATION(!inPumpSession()); | 437 ASSERT_WITH_SECURITY_IMPLICATION(!inPumpSession()); |
| 438 ASSERT(!isParsingFragment()); | 438 ASSERT(!isParsingFragment()); |
| 439 ASSERT(!isWaitingForScripts()); | 439 ASSERT(!isWaitingForScripts()); |
| 440 ASSERT(!isStopped()); | 440 ASSERT(!isStopped()); |
| 441 ASSERT(shouldUseThreading()); | 441 ASSERT(shouldUseThreading()); |
| 442 ASSERT(!m_tokenizer); | 442 ASSERT(!m_tokenizer); |
| 443 ASSERT(!m_token); | 443 ASSERT(!m_token); |
| 444 ASSERT(!m_lastChunkBeforeScript); | 444 ASSERT(!m_lastChunkBeforeScript); |
| 445 | 445 |
| 446 std::unique_ptr<ParsedChunk> chunk(std::move(popChunk)); | 446 std::unique_ptr<TokenizedChunk> chunk(std::move(popChunk)); |
| 447 std::unique_ptr<CompactHTMLTokenStream> tokens = std::move(chunk->tokens); | 447 std::unique_ptr<CompactHTMLTokenStream> tokens = std::move(chunk->tokens); |
| 448 size_t elementTokenCount = 0; | 448 size_t elementTokenCount = 0; |
| 449 | 449 |
| 450 postTaskToLookaheadParser(Asynchronous, &BackgroundHTMLParser::startedChunkW
ithCheckpoint, m_backgroundParser, chunk->inputCheckpoint); | 450 postTaskToLookaheadParser(Asynchronous, &BackgroundHTMLParser::startedChunkW
ithCheckpoint, m_backgroundParser, chunk->inputCheckpoint); |
| 451 | 451 |
| 452 for (const auto& xssInfo : chunk->xssInfos) { | 452 for (const auto& xssInfo : chunk->xssInfos) { |
| 453 m_textPosition = xssInfo->m_textPosition; | 453 m_textPosition = xssInfo->m_textPosition; |
| 454 m_xssAuditorDelegate.didBlockScript(*xssInfo); | 454 m_xssAuditorDelegate.didBlockScript(*xssInfo); |
| 455 if (isStopped()) | 455 if (isStopped()) |
| 456 break; | 456 break; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 m_parserScheduler->scheduleForResume(); | 535 m_parserScheduler->scheduleForResume(); |
| 536 return; | 536 return; |
| 537 } | 537 } |
| 538 | 538 |
| 539 // FIXME: Pass in current input length. | 539 // FIXME: Pass in current input length. |
| 540 TRACE_EVENT_BEGIN1("devtools.timeline", "ParseHTML", "beginData", InspectorP
arseHtmlEvent::beginData(document(), lineNumber().zeroBasedInt())); | 540 TRACE_EVENT_BEGIN1("devtools.timeline", "ParseHTML", "beginData", InspectorP
arseHtmlEvent::beginData(document(), lineNumber().zeroBasedInt())); |
| 541 | 541 |
| 542 SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel); | 542 SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel); |
| 543 while (!m_speculations.isEmpty()) { | 543 while (!m_speculations.isEmpty()) { |
| 544 ASSERT(!isScheduledForResume()); | 544 ASSERT(!isScheduledForResume()); |
| 545 size_t elementTokenCount = processParsedChunkFromBackgroundParser(m_spec
ulations.takeFirst()); | 545 size_t elementTokenCount = processTokenizedChunkFromBackgroundParser(m_s
peculations.takeFirst()); |
| 546 session.addedElementTokens(elementTokenCount); | 546 session.addedElementTokens(elementTokenCount); |
| 547 | 547 |
| 548 // Always check isParsing first as m_document may be null. | 548 // Always check isParsing first as m_document may be null. |
| 549 // Surprisingly, isScheduledForResume() may be set here as a result of | 549 // Surprisingly, isScheduledForResume() may be set here as a result of |
| 550 // processParsedChunkFromBackgroundParser running arbitrary javascript | 550 // processTokenizedChunkFromBackgroundParser running arbitrary javascrip
t |
| 551 // which invokes nested event loops. (e.g. inspector breakpoints) | 551 // which invokes nested event loops. (e.g. inspector breakpoints) |
| 552 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) | 552 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) |
| 553 break; | 553 break; |
| 554 | 554 |
| 555 if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session
, m_speculations.first()->startingScript)) | 555 if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session
, m_speculations.first()->startingScript)) |
| 556 break; | 556 break; |
| 557 } | 557 } |
| 558 | 558 |
| 559 TRACE_EVENT_END1("devtools.timeline", "ParseHTML", "endData", InspectorParse
HtmlEvent::endData(lineNumber().zeroBasedInt() - 1)); | 559 TRACE_EVENT_END1("devtools.timeline", "ParseHTML", "endData", InspectorParse
HtmlEvent::endData(lineNumber().zeroBasedInt() - 1)); |
| 560 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 560 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr
oundHTMLParser>::createUnbound(); | 728 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr
oundHTMLParser>::createUnbound(); |
| 729 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); | 729 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); |
| 730 | 730 |
| 731 std::unique_ptr<BackgroundHTMLParser::Configuration> config = wrapUnique(new
BackgroundHTMLParser::Configuration); | 731 std::unique_ptr<BackgroundHTMLParser::Configuration> config = wrapUnique(new
BackgroundHTMLParser::Configuration); |
| 732 config->options = m_options; | 732 config->options = m_options; |
| 733 config->parser = m_weakFactory.createWeakPtr(); | 733 config->parser = m_weakFactory.createWeakPtr(); |
| 734 config->xssAuditor = wrapUnique(new XSSAuditor); | 734 config->xssAuditor = wrapUnique(new XSSAuditor); |
| 735 config->xssAuditor->init(document(), &m_xssAuditorDelegate); | 735 config->xssAuditor->init(document(), &m_xssAuditorDelegate); |
| 736 | 736 |
| 737 config->decoder = takeDecoder(); | 737 config->decoder = takeDecoder(); |
| 738 config->parsedChunkQueue = m_parsedChunkQueue.get(); | 738 config->tokenizedChunkQueue = m_tokenizedChunkQueue.get(); |
| 739 if (document()->settings()) { | 739 if (document()->settings()) { |
| 740 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) | 740 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) |
| 741 config->outstandingTokenLimit = document()->settings()->backgroundHt
mlParserOutstandingTokenLimit(); | 741 config->outstandingTokenLimit = document()->settings()->backgroundHt
mlParserOutstandingTokenLimit(); |
| 742 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) | 742 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) |
| 743 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa
rserPendingTokenLimit(); | 743 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa
rserPendingTokenLimit(); |
| 744 } | 744 } |
| 745 | 745 |
| 746 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 746 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
| 747 postTaskToLookaheadParser( | 747 postTaskToLookaheadParser( |
| 748 Synchronous, | 748 Synchronous, |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); | 1155 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); |
| 1156 return; | 1156 return; |
| 1157 case Asynchronous: | 1157 case Asynchronous: |
| 1158 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); | 1158 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); |
| 1159 return; | 1159 return; |
| 1160 } | 1160 } |
| 1161 NOTREACHED(); | 1161 NOTREACHED(); |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 } // namespace blink | 1164 } // namespace blink |
| OLD | NEW |