| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 break; | 447 break; |
| 448 } | 448 } |
| 449 | 449 |
| 450 m_textPosition = it->textPosition(); | 450 m_textPosition = it->textPosition(); |
| 451 | 451 |
| 452 constructTreeFromCompactHTMLToken(*it); | 452 constructTreeFromCompactHTMLToken(*it); |
| 453 | 453 |
| 454 if (isStopped()) | 454 if (isStopped()) |
| 455 break; | 455 break; |
| 456 | 456 |
| 457 pumpPreloadQueue(); | |
| 458 | |
| 459 if (!m_triedLoadingLinkHeaders && document()->loader()) { | 457 if (!m_triedLoadingLinkHeaders && document()->loader()) { |
| 460 String linkHeader = document()->loader()->response().httpHeaderField
(HTTPNames::Link); | 458 String linkHeader = document()->loader()->response().httpHeaderField
(HTTPNames::Link); |
| 461 if (!linkHeader.isEmpty()) { | 459 if (!linkHeader.isEmpty()) { |
| 462 ASSERT(chunk); | 460 ASSERT(chunk); |
| 463 LinkLoader::loadLinksFromHeader(linkHeader, document()->loader()
->response().url(), | 461 LinkLoader::loadLinksFromHeader(linkHeader, document()->loader()
->response().url(), |
| 464 document(), NetworkHintsInterfaceImpl(), LinkLoader::OnlyLoa
dResources, &(chunk->viewport)); | 462 document(), NetworkHintsInterfaceImpl(), LinkLoader::OnlyLoa
dResources, &(chunk->viewport)); |
| 465 m_triedLoadingLinkHeaders = true; | 463 m_triedLoadingLinkHeaders = true; |
| 466 } | 464 } |
| 467 } | 465 } |
| 468 | 466 |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 | 1046 |
| 1049 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1047 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1050 { | 1048 { |
| 1051 ASSERT(decoder); | 1049 ASSERT(decoder); |
| 1052 DecodedDataDocumentParser::setDecoder(std::move(decoder)); | 1050 DecodedDataDocumentParser::setDecoder(std::move(decoder)); |
| 1053 | 1051 |
| 1054 if (m_haveBackgroundParser) | 1052 if (m_haveBackgroundParser) |
| 1055 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, m_backgroundParser, passed(takeDecoder()))); | 1053 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, m_backgroundParser, passed(takeDecoder()))); |
| 1056 } | 1054 } |
| 1057 | 1055 |
| 1058 void HTMLDocumentParser::pumpPreloadQueue() | 1056 void HTMLDocumentParser::documentElementAvailable() |
| 1059 { | 1057 { |
| 1060 if (!document()->documentElement()) | 1058 TRACE_EVENT0("blink,loader", "HTMLDocumentParser::documentElementAvailable")
; |
| 1061 return; | 1059 DCHECK(document()->documentElement()); |
| 1062 | |
| 1063 for (const String& scriptSource : m_queuedDocumentWriteScripts) { | 1060 for (const String& scriptSource : m_queuedDocumentWriteScripts) { |
| 1064 evaluateAndPreloadScriptForDocumentWrite(scriptSource); | 1061 evaluateAndPreloadScriptForDocumentWrite(scriptSource); |
| 1065 } | 1062 } |
| 1066 | 1063 |
| 1067 m_queuedDocumentWriteScripts.clear(); | 1064 m_queuedDocumentWriteScripts.clear(); |
| 1068 if (!m_queuedPreloads.isEmpty()) | 1065 if (!m_queuedPreloads.isEmpty()) |
| 1069 m_preloader->takeAndPreload(m_queuedPreloads); | 1066 m_preloader->takeAndPreload(m_queuedPreloads); |
| 1070 } | 1067 } |
| 1071 | 1068 |
| 1072 PassOwnPtr<HTMLPreloadScanner> HTMLDocumentParser::createPreloadScanner() | 1069 PassOwnPtr<HTMLPreloadScanner> HTMLDocumentParser::createPreloadScanner() |
| (...skipping 39 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)); | 1109 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); |
| 1113 successHistogram.count(duration); | 1110 successHistogram.count(duration); |
| 1114 } else { | 1111 } else { |
| 1115 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); | 1112 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); |
| 1116 failureHistogram.count(duration); | 1113 failureHistogram.count(duration); |
| 1117 } | 1114 } |
| 1118 | 1115 |
| 1119 } | 1116 } |
| 1120 | 1117 |
| 1121 } // namespace blink | 1118 } // namespace blink |
| OLD | NEW |