Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp |
| diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp |
| index d2552b059a2b45e29c628e209ebc31b5128cd2c4..383de2591b4551e05bf93bb41ece86ed0446b585 100644 |
| --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp |
| +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp |
| @@ -315,12 +315,14 @@ void HTMLDocumentParser::notifyPendingParsedChunks() |
| ASSERT(m_queuedPreloads.isEmpty()); |
| ASSERT(m_queuedDocumentWriteScripts.isEmpty()); |
| for (auto& chunk : pendingChunks) { |
| + m_preloader->takeAndPreload(chunk->preloads); |
|
kouhei (in TOK)
2016/07/13 01:01:28
Makes sense. Can we have a comment re: why we need
Charlie Harrison
2016/07/13 03:13:45
Done.
|
| + } |
| + for (auto& chunk : pendingChunks) { |
| for (auto& index : chunk->likelyDocumentWriteScriptIndices) { |
| const CompactHTMLToken& token = chunk->tokens->at(index); |
| ASSERT(token.type() == HTMLToken::TokenType::Character); |
| evaluateAndPreloadScriptForDocumentWrite(token.data()); |
| } |
| - m_preloader->takeAndPreload(chunk->preloads); |
| } |
| } |
| @@ -1068,13 +1070,14 @@ void HTMLDocumentParser::documentElementAvailable() |
| { |
| TRACE_EVENT0("blink,loader", "HTMLDocumentParser::documentElementAvailable"); |
| DCHECK(document()->documentElement()); |
| + if (!m_queuedPreloads.isEmpty()) |
| + m_preloader->takeAndPreload(m_queuedPreloads); |
| + |
| for (const String& scriptSource : m_queuedDocumentWriteScripts) { |
| evaluateAndPreloadScriptForDocumentWrite(scriptSource); |
| } |
| m_queuedDocumentWriteScripts.clear(); |
| - if (!m_queuedPreloads.isEmpty()) |
| - m_preloader->takeAndPreload(m_queuedPreloads); |
| } |
| std::unique_ptr<HTMLPreloadScanner> HTMLDocumentParser::createPreloadScanner() |