| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 301 // ApplicationCache is initialized. |
| 302 if (!document()->documentElement()) { | 302 if (!document()->documentElement()) { |
| 303 for (auto& chunk : pendingChunks) { | 303 for (auto& chunk : pendingChunks) { |
| 304 for (auto& request : chunk->preloads) | 304 for (auto& request : chunk->preloads) |
| 305 m_queuedPreloads.append(request.release()); | 305 m_queuedPreloads.append(std::move(request)); |
| 306 for (auto& index : chunk->likelyDocumentWriteScriptIndices) { | 306 for (auto& index : chunk->likelyDocumentWriteScriptIndices) { |
| 307 const CompactHTMLToken& token = chunk->tokens->at(index); | 307 const CompactHTMLToken& token = chunk->tokens->at(index); |
| 308 ASSERT(token.type() == HTMLToken::TokenType::Character); | 308 ASSERT(token.type() == HTMLToken::TokenType::Character); |
| 309 m_queuedDocumentWriteScripts.append(token.data()); | 309 m_queuedDocumentWriteScripts.append(token.data()); |
| 310 } | 310 } |
| 311 } | 311 } |
| 312 } else { | 312 } else { |
| 313 // We can safely assume that there are no queued preloads request after | 313 // We can safely assume that there are no queued preloads request after |
| 314 // the document element is available, as we empty the queue immediately | 314 // the document element is available, as we empty the queue immediately |
| 315 // after the document element is created in pumpPendingSpeculations(). | 315 // after the document element is created in pumpPendingSpeculations(). |
| 316 ASSERT(m_queuedPreloads.isEmpty()); | 316 ASSERT(m_queuedPreloads.isEmpty()); |
| 317 ASSERT(m_queuedDocumentWriteScripts.isEmpty()); | 317 ASSERT(m_queuedDocumentWriteScripts.isEmpty()); |
| 318 for (auto& chunk : pendingChunks) { | 318 for (auto& chunk : pendingChunks) { |
| 319 for (auto& index : chunk->likelyDocumentWriteScriptIndices) { | 319 for (auto& index : chunk->likelyDocumentWriteScriptIndices) { |
| 320 const CompactHTMLToken& token = chunk->tokens->at(index); | 320 const CompactHTMLToken& token = chunk->tokens->at(index); |
| 321 ASSERT(token.type() == HTMLToken::TokenType::Character); | 321 ASSERT(token.type() == HTMLToken::TokenType::Character); |
| 322 evaluateAndPreloadScriptForDocumentWrite(token.data()); | 322 evaluateAndPreloadScriptForDocumentWrite(token.data()); |
| 323 } | 323 } |
| 324 m_preloader->takeAndPreload(chunk->preloads); | 324 m_preloader->takeAndPreload(chunk->preloads); |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 for (auto& chunk : pendingChunks) | 328 for (auto& chunk : pendingChunks) |
| 329 m_speculations.append(chunk.release()); | 329 m_speculations.append(std::move(chunk)); |
| 330 | 330 |
| 331 if (!isWaitingForScripts() && !isScheduledForResume()) { | 331 if (!isWaitingForScripts() && !isScheduledForResume()) { |
| 332 if (m_tasksWereSuspended) | 332 if (m_tasksWereSuspended) |
| 333 m_parserScheduler->forceResumeAfterYield(); | 333 m_parserScheduler->forceResumeAfterYield(); |
| 334 else | 334 else |
| 335 m_parserScheduler->scheduleForResume(); | 335 m_parserScheduler->scheduleForResume(); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) | 339 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) |
| 340 { | 340 { |
| 341 document()->setEncodingData(data); | 341 document()->setEncodingData(data); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) | 344 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) |
| 345 { | 345 { |
| 346 ASSERT(chunk); | 346 ASSERT(chunk); |
| 347 if (isWaitingForScripts()) { | 347 if (isWaitingForScripts()) { |
| 348 // We're waiting on a network script, just save the chunk, we'll get | 348 // We're waiting on a network script, just save the chunk, we'll get |
| 349 // a second validateSpeculations call after the script completes. | 349 // a second validateSpeculations call after the script completes. |
| 350 // This call should have been made immediately after runScriptsForPaused
TreeBuilder | 350 // This call should have been made immediately after runScriptsForPaused
TreeBuilder |
| 351 // which may have started a network load and left us waiting. | 351 // which may have started a network load and left us waiting. |
| 352 ASSERT(!m_lastChunkBeforeScript); | 352 ASSERT(!m_lastChunkBeforeScript); |
| 353 m_lastChunkBeforeScript = std::move(chunk); | 353 m_lastChunkBeforeScript = std::move(chunk); |
| 354 return; | 354 return; |
| 355 } | 355 } |
| 356 | 356 |
| 357 ASSERT(!m_lastChunkBeforeScript); | 357 ASSERT(!m_lastChunkBeforeScript); |
| 358 OwnPtr<HTMLTokenizer> tokenizer = m_tokenizer.release(); | 358 OwnPtr<HTMLTokenizer> tokenizer = std::move(m_tokenizer); |
| 359 OwnPtr<HTMLToken> token = m_token.release(); | 359 OwnPtr<HTMLToken> token = std::move(m_token); |
| 360 | 360 |
| 361 if (!tokenizer) { | 361 if (!tokenizer) { |
| 362 // There must not have been any changes to the HTMLTokenizer state on | 362 // There must not have been any changes to the HTMLTokenizer state on |
| 363 // the main thread, which means the speculation buffer is correct. | 363 // the main thread, which means the speculation buffer is correct. |
| 364 return; | 364 return; |
| 365 } | 365 } |
| 366 | 366 |
| 367 // Currently we're only smart enough to reuse the speculation buffer if the
tokenizer | 367 // Currently we're only smart enough to reuse the speculation buffer if the
tokenizer |
| 368 // both starts and ends in the DataState. That state is simplest because the
HTMLToken | 368 // both starts and ends in the DataState. That state is simplest because the
HTMLToken |
| 369 // is always in the Uninitialized state. We should consider whether we can r
euse the | 369 // is always in the Uninitialized state. We should consider whether we can r
euse the |
| 370 // speculation buffer in other states, but we'd likely need to do something
more | 370 // speculation buffer in other states, but we'd likely need to do something
more |
| 371 // sophisticated with the HTMLToken. | 371 // sophisticated with the HTMLToken. |
| 372 if (chunk->tokenizerState == HTMLTokenizer::DataState | 372 if (chunk->tokenizerState == HTMLTokenizer::DataState |
| 373 && tokenizer->getState() == HTMLTokenizer::DataState | 373 && tokenizer->getState() == HTMLTokenizer::DataState |
| 374 && m_input.current().isEmpty() | 374 && m_input.current().isEmpty() |
| 375 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB
uilder.get())) { | 375 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB
uilder.get())) { |
| 376 ASSERT(token->isUninitialized()); | 376 ASSERT(token->isUninitialized()); |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 | 379 |
| 380 discardSpeculationsAndResumeFrom(std::move(chunk), token.release(), tokenize
r.release()); | 380 discardSpeculationsAndResumeFrom(std::move(chunk), std::move(token), std::mo
ve(tokenizer)); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk
> lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer>
tokenizer) | 383 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk
> lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer>
tokenizer) |
| 384 { | 384 { |
| 385 m_weakFactory.revokeAll(); | 385 m_weakFactory.revokeAll(); |
| 386 m_speculations.clear(); | 386 m_speculations.clear(); |
| 387 | 387 |
| 388 OwnPtr<BackgroundHTMLParser::Checkpoint> checkpoint = adoptPtr(new Backgroun
dHTMLParser::Checkpoint); | 388 OwnPtr<BackgroundHTMLParser::Checkpoint> checkpoint = adoptPtr(new Backgroun
dHTMLParser::Checkpoint); |
| 389 checkpoint->parser = m_weakFactory.createWeakPtr(); | 389 checkpoint->parser = m_weakFactory.createWeakPtr(); |
| 390 checkpoint->token = std::move(token); | 390 checkpoint->token = std::move(token); |
| 391 checkpoint->tokenizer = std::move(tokenizer); | 391 checkpoint->tokenizer = std::move(tokenizer); |
| 392 checkpoint->treeBuilderState = HTMLTreeBuilderSimulator::stateFor(m_treeBuil
der.get()); | 392 checkpoint->treeBuilderState = HTMLTreeBuilderSimulator::stateFor(m_treeBuil
der.get()); |
| 393 checkpoint->inputCheckpoint = lastChunkBeforeScript->inputCheckpoint; | 393 checkpoint->inputCheckpoint = lastChunkBeforeScript->inputCheckpoint; |
| 394 checkpoint->preloadScannerCheckpoint = lastChunkBeforeScript->preloadScanner
Checkpoint; | 394 checkpoint->preloadScannerCheckpoint = lastChunkBeforeScript->preloadScanner
Checkpoint; |
| 395 checkpoint->unparsedInput = m_input.current().toString().isolatedCopy(); | 395 checkpoint->unparsedInput = m_input.current().toString().isolatedCopy(); |
| 396 m_input.current().clear(); // FIXME: This should be passed in instead of cle
ared. | 396 m_input.current().clear(); // FIXME: This should be passed in instead of cle
ared. |
| 397 | 397 |
| 398 ASSERT(checkpoint->unparsedInput.isSafeToSendToAnotherThread()); | 398 ASSERT(checkpoint->unparsedInput.isSafeToSendToAnotherThread()); |
| 399 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::r
esumeFrom, AllowCrossThreadAccess(m_backgroundParser), passed(checkpoint.release
()))); | 399 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::r
esumeFrom, AllowCrossThreadAccess(m_backgroundParser), passed(std::move(checkpoi
nt)))); |
| 400 } | 400 } |
| 401 | 401 |
| 402 size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Par
sedChunk> popChunk) | 402 size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Par
sedChunk> popChunk) |
| 403 { | 403 { |
| 404 TRACE_EVENT_WITH_FLOW0("blink,loading", "HTMLDocumentParser::processParsedCh
unkFromBackgroundParser", popChunk.get(), TRACE_EVENT_FLAG_FLOW_IN); | 404 TRACE_EVENT_WITH_FLOW0("blink,loading", "HTMLDocumentParser::processParsedCh
unkFromBackgroundParser", popChunk.get(), TRACE_EVENT_FLAG_FLOW_IN); |
| 405 TemporaryChange<bool> hasLineNumber(m_isParsingAtLineNumber, true); | 405 TemporaryChange<bool> hasLineNumber(m_isParsingAtLineNumber, true); |
| 406 | 406 |
| 407 ASSERT_WITH_SECURITY_IMPLICATION(m_pumpSpeculationsSessionNestingLevel == 1)
; | 407 ASSERT_WITH_SECURITY_IMPLICATION(m_pumpSpeculationsSessionNestingLevel == 1)
; |
| 408 ASSERT_WITH_SECURITY_IMPLICATION(!inPumpSession()); | 408 ASSERT_WITH_SECURITY_IMPLICATION(!inPumpSession()); |
| 409 ASSERT(!isParsingFragment()); | 409 ASSERT(!isParsingFragment()); |
| 410 ASSERT(!isWaitingForScripts()); | 410 ASSERT(!isWaitingForScripts()); |
| 411 ASSERT(!isStopped()); | 411 ASSERT(!isStopped()); |
| 412 ASSERT(shouldUseThreading()); | 412 ASSERT(shouldUseThreading()); |
| 413 ASSERT(!m_tokenizer); | 413 ASSERT(!m_tokenizer); |
| 414 ASSERT(!m_token); | 414 ASSERT(!m_token); |
| 415 ASSERT(!m_lastChunkBeforeScript); | 415 ASSERT(!m_lastChunkBeforeScript); |
| 416 | 416 |
| 417 OwnPtr<ParsedChunk> chunk(std::move(popChunk)); | 417 OwnPtr<ParsedChunk> chunk(std::move(popChunk)); |
| 418 OwnPtr<CompactHTMLTokenStream> tokens = chunk->tokens.release(); | 418 OwnPtr<CompactHTMLTokenStream> tokens = std::move(chunk->tokens); |
| 419 size_t elementTokenCount = 0; | 419 size_t elementTokenCount = 0; |
| 420 | 420 |
| 421 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s
tartedChunkWithCheckpoint, AllowCrossThreadAccess(m_backgroundParser), chunk->in
putCheckpoint)); | 421 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::s
tartedChunkWithCheckpoint, AllowCrossThreadAccess(m_backgroundParser), chunk->in
putCheckpoint)); |
| 422 | 422 |
| 423 for (const auto& xssInfo : chunk->xssInfos) { | 423 for (const auto& xssInfo : chunk->xssInfos) { |
| 424 m_textPosition = xssInfo->m_textPosition; | 424 m_textPosition = xssInfo->m_textPosition; |
| 425 m_xssAuditorDelegate.didBlockScript(*xssInfo); | 425 m_xssAuditorDelegate.didBlockScript(*xssInfo); |
| 426 if (isStopped()) | 426 if (isStopped()) |
| 427 break; | 427 break; |
| 428 } | 428 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 ASSERT(chunk); | 462 ASSERT(chunk); |
| 463 LinkLoader::loadLinksFromHeader(linkHeader, document()->loader()
->response().url(), | 463 LinkLoader::loadLinksFromHeader(linkHeader, document()->loader()
->response().url(), |
| 464 document(), NetworkHintsInterfaceImpl(), LinkLoader::OnlyLoa
dResources, &(chunk->viewport)); | 464 document(), NetworkHintsInterfaceImpl(), LinkLoader::OnlyLoa
dResources, &(chunk->viewport)); |
| 465 m_triedLoadingLinkHeaders = true; | 465 m_triedLoadingLinkHeaders = true; |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 if (isWaitingForScripts()) { | 469 if (isWaitingForScripts()) { |
| 470 ASSERT(it + 1 == tokens->end()); // The </script> is assumed to be t
he last token of this bunch. | 470 ASSERT(it + 1 == tokens->end()); // The </script> is assumed to be t
he last token of this bunch. |
| 471 runScriptsForPausedTreeBuilder(); | 471 runScriptsForPausedTreeBuilder(); |
| 472 validateSpeculations(chunk.release()); | 472 validateSpeculations(std::move(chunk)); |
| 473 break; | 473 break; |
| 474 } | 474 } |
| 475 | 475 |
| 476 if (it->type() == HTMLToken::EndOfFile) { | 476 if (it->type() == HTMLToken::EndOfFile) { |
| 477 ASSERT(it + 1 == tokens->end()); // The EOF is assumed to be the las
t token of this bunch. | 477 ASSERT(it + 1 == tokens->end()); // The EOF is assumed to be the las
t token of this bunch. |
| 478 ASSERT(m_speculations.isEmpty()); // There should never be any chunk
s after the EOF. | 478 ASSERT(m_speculations.isEmpty()); // There should never be any chunk
s after the EOF. |
| 479 prepareToStopParsing(); | 479 prepareToStopParsing(); |
| 480 break; | 480 break; |
| 481 } | 481 } |
| 482 | 482 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 m_parserScheduler->scheduleForResume(); | 518 m_parserScheduler->scheduleForResume(); |
| 519 return; | 519 return; |
| 520 } | 520 } |
| 521 | 521 |
| 522 // FIXME: Pass in current input length. | 522 // FIXME: Pass in current input length. |
| 523 TRACE_EVENT_BEGIN1("devtools.timeline", "ParseHTML", "beginData", InspectorP
arseHtmlEvent::beginData(document(), lineNumber().zeroBasedInt())); | 523 TRACE_EVENT_BEGIN1("devtools.timeline", "ParseHTML", "beginData", InspectorP
arseHtmlEvent::beginData(document(), lineNumber().zeroBasedInt())); |
| 524 | 524 |
| 525 SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel); | 525 SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel); |
| 526 while (!m_speculations.isEmpty()) { | 526 while (!m_speculations.isEmpty()) { |
| 527 ASSERT(!isScheduledForResume()); | 527 ASSERT(!isScheduledForResume()); |
| 528 size_t elementTokenCount = processParsedChunkFromBackgroundParser(m_spec
ulations.takeFirst().release()); | 528 size_t elementTokenCount = processParsedChunkFromBackgroundParser(m_spec
ulations.takeFirst()); |
| 529 session.addedElementTokens(elementTokenCount); | 529 session.addedElementTokens(elementTokenCount); |
| 530 | 530 |
| 531 // Always check isParsing first as m_document may be null. | 531 // Always check isParsing first as m_document may be null. |
| 532 // Surprisingly, isScheduledForResume() may be set here as a result of | 532 // Surprisingly, isScheduledForResume() may be set here as a result of |
| 533 // processParsedChunkFromBackgroundParser running arbitrary javascript | 533 // processParsedChunkFromBackgroundParser running arbitrary javascript |
| 534 // which invokes nested event loops. (e.g. inspector breakpoints) | 534 // which invokes nested event loops. (e.g. inspector breakpoints) |
| 535 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) | 535 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) |
| 536 break; | 536 break; |
| 537 | 537 |
| 538 if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session
, m_speculations.first()->startingScript)) | 538 if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session
, m_speculations.first()->startingScript)) |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) | 723 if (document()->settings()->backgroundHtmlParserOutstandingTokenLimit()) |
| 724 config->outstandingTokenLimit = document()->settings()->backgroundHt
mlParserOutstandingTokenLimit(); | 724 config->outstandingTokenLimit = document()->settings()->backgroundHt
mlParserOutstandingTokenLimit(); |
| 725 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) | 725 if (document()->settings()->backgroundHtmlParserPendingTokenLimit()) |
| 726 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa
rserPendingTokenLimit(); | 726 config->pendingTokenLimit = document()->settings()->backgroundHtmlPa
rserPendingTokenLimit(); |
| 727 } | 727 } |
| 728 | 728 |
| 729 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 729 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
| 730 HTMLParserThread::shared()->postTask(threadSafeBind( | 730 HTMLParserThread::shared()->postTask(threadSafeBind( |
| 731 &BackgroundHTMLParser::start, | 731 &BackgroundHTMLParser::start, |
| 732 reference.release(), | 732 reference.release(), |
| 733 passed(config.release()), | 733 passed(std::move(config)), |
| 734 document()->url(), | 734 document()->url(), |
| 735 passed(CachedDocumentParameters::create(document())), | 735 passed(CachedDocumentParameters::create(document())), |
| 736 MediaValuesCached::MediaValuesCachedData(*document()), | 736 MediaValuesCached::MediaValuesCachedData(*document()), |
| 737 passed(adoptPtr(m_loadingTaskRunner->clone())))); | 737 passed(adoptPtr(m_loadingTaskRunner->clone())))); |
| 738 } | 738 } |
| 739 | 739 |
| 740 void HTMLDocumentParser::stopBackgroundParser() | 740 void HTMLDocumentParser::stopBackgroundParser() |
| 741 { | 741 { |
| 742 ASSERT(shouldUseThreading()); | 742 ASSERT(shouldUseThreading()); |
| 743 ASSERT(m_haveBackgroundParser); | 743 ASSERT(m_haveBackgroundParser); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 // If either object has a blocking script, the parser should be paused. | 920 // If either object has a blocking script, the parser should be paused. |
| 921 return treeBuilderHasBlockingScript || scriptRunnerHasBlockingScript; | 921 return treeBuilderHasBlockingScript || scriptRunnerHasBlockingScript; |
| 922 } | 922 } |
| 923 | 923 |
| 924 void HTMLDocumentParser::resumeParsingAfterScriptExecution() | 924 void HTMLDocumentParser::resumeParsingAfterScriptExecution() |
| 925 { | 925 { |
| 926 ASSERT(!isExecutingScript()); | 926 ASSERT(!isExecutingScript()); |
| 927 ASSERT(!isWaitingForScripts()); | 927 ASSERT(!isWaitingForScripts()); |
| 928 | 928 |
| 929 if (m_haveBackgroundParser) { | 929 if (m_haveBackgroundParser) { |
| 930 validateSpeculations(m_lastChunkBeforeScript.release()); | 930 validateSpeculations(std::move(m_lastChunkBeforeScript)); |
| 931 ASSERT(!m_lastChunkBeforeScript); | 931 ASSERT(!m_lastChunkBeforeScript); |
| 932 pumpPendingSpeculations(); | 932 pumpPendingSpeculations(); |
| 933 return; | 933 return; |
| 934 } | 934 } |
| 935 | 935 |
| 936 m_insertionPreloadScanner.clear(); | 936 m_insertionPreloadScanner.clear(); |
| 937 pumpTokenizerIfPossible(); | 937 pumpTokenizerIfPossible(); |
| 938 endIfDelayed(); | 938 endIfDelayed(); |
| 939 } | 939 } |
| 940 | 940 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 return; | 1009 return; |
| 1010 | 1010 |
| 1011 if (shouldUseThreading()) { | 1011 if (shouldUseThreading()) { |
| 1012 if (!m_haveBackgroundParser) | 1012 if (!m_haveBackgroundParser) |
| 1013 startBackgroundParser(); | 1013 startBackgroundParser(); |
| 1014 | 1014 |
| 1015 OwnPtr<Vector<char>> buffer = adoptPtr(new Vector<char>(length)); | 1015 OwnPtr<Vector<char>> buffer = adoptPtr(new Vector<char>(length)); |
| 1016 memcpy(buffer->data(), data, length); | 1016 memcpy(buffer->data(), data, length); |
| 1017 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "HTMLDocumentPars
er::appendBytes", "size", (unsigned)length); | 1017 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "HTMLDocumentPars
er::appendBytes", "size", (unsigned)length); |
| 1018 | 1018 |
| 1019 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::appendRawBytesFromMainThread, AllowCrossThreadAccess(m_backgroundParser), pas
sed(buffer.release()))); | 1019 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::appendRawBytesFromMainThread, AllowCrossThreadAccess(m_backgroundParser), pas
sed(std::move(buffer)))); |
| 1020 return; | 1020 return; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 DecodedDataDocumentParser::appendBytes(data, length); | 1023 DecodedDataDocumentParser::appendBytes(data, length); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void HTMLDocumentParser::flush() | 1026 void HTMLDocumentParser::flush() |
| 1027 { | 1027 { |
| 1028 // If we've got no decoder, we never received any data. | 1028 // If we've got no decoder, we never received any data. |
| 1029 if (isDetached() || needsDecoder()) | 1029 if (isDetached() || needsDecoder()) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); | 1112 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); |
| 1113 successHistogram.count(duration); | 1113 successHistogram.count(duration); |
| 1114 } else { | 1114 } else { |
| 1115 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); | 1115 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); |
| 1116 failureHistogram.count(duration); | 1116 failureHistogram.count(duration); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 } // namespace blink | 1121 } // namespace blink |
| OLD | NEW |