Chromium Code Reviews| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 visitor->trace(m_parserScheduler); | 149 visitor->trace(m_parserScheduler); |
| 150 visitor->trace(m_xssAuditorDelegate); | 150 visitor->trace(m_xssAuditorDelegate); |
| 151 visitor->trace(m_scriptRunner); | 151 visitor->trace(m_scriptRunner); |
| 152 visitor->trace(m_preloader); | 152 visitor->trace(m_preloader); |
| 153 ScriptableDocumentParser::trace(visitor); | 153 ScriptableDocumentParser::trace(visitor); |
| 154 HTMLScriptRunnerHost::trace(visitor); | 154 HTMLScriptRunnerHost::trace(visitor); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void HTMLDocumentParser::detach() | 157 void HTMLDocumentParser::detach() |
| 158 { | 158 { |
| 159 if (!isParsingFragment() && m_parsedChunkQueue.get() && m_parsedChunkQueue-> peakPendingChunkCount()) { | |
| 160 DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingChunkHistogram, ("P arser.PeakPendingChunkCount", 1, 1000, 50)); | |
| 161 peakPendingChunkHistogram.count(m_parsedChunkQueue->peakPendingChunkCoun t()); | |
| 162 DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingTokenHistogram, ("P arser.PeakPendingTokenCount", 1, 100000, 50)); | |
| 163 peakPendingTokenHistogram.count(m_parsedChunkQueue->peakPendingTokenCoun t()); | |
| 164 } | |
| 165 | |
| 159 if (m_haveBackgroundParser) | 166 if (m_haveBackgroundParser) |
| 160 stopBackgroundParser(); | 167 stopBackgroundParser(); |
| 161 DocumentParser::detach(); | 168 DocumentParser::detach(); |
| 162 if (m_scriptRunner) | 169 if (m_scriptRunner) |
| 163 m_scriptRunner->detach(); | 170 m_scriptRunner->detach(); |
| 164 m_treeBuilder->detach(); | 171 m_treeBuilder->detach(); |
| 165 // FIXME: It seems wrong that we would have a preload scanner here. | 172 // FIXME: It seems wrong that we would have a preload scanner here. |
| 166 // Yet during fast/dom/HTMLScriptElement/script-load-events.html we do. | 173 // Yet during fast/dom/HTMLScriptElement/script-load-events.html we do. |
| 167 m_preloadScanner.reset(); | 174 m_preloadScanner.reset(); |
| 168 m_insertionPreloadScanner.reset(); | 175 m_insertionPreloadScanner.reset(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB uilder.get())) { | 382 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB uilder.get())) { |
| 376 ASSERT(token->isUninitialized()); | 383 ASSERT(token->isUninitialized()); |
| 377 return; | 384 return; |
| 378 } | 385 } |
| 379 | 386 |
| 380 discardSpeculationsAndResumeFrom(std::move(chunk), std::move(token), std::mo ve(tokenizer)); | 387 discardSpeculationsAndResumeFrom(std::move(chunk), std::move(token), std::mo ve(tokenizer)); |
| 381 } | 388 } |
| 382 | 389 |
| 383 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk > lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer> tokenizer) | 390 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk > lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer> tokenizer) |
| 384 { | 391 { |
| 392 TRACE_EVENT0("blink,loading", "HTMLDocumentParser::discardSpeculationsAndRes umeFrom"); | |
|
kouhei (in TOK)
2016/06/17 11:20:57
caseq: Would you review this TRACE_EVENT?
| |
| 385 m_weakFactory.revokeAll(); | 393 m_weakFactory.revokeAll(); |
| 394 | |
| 395 size_t discardedTokenCount = 0; | |
| 396 for (const auto& speculation : m_speculations) { | |
| 397 discardedTokenCount += speculation->tokens->size(); | |
| 398 } | |
| 399 DEFINE_STATIC_LOCAL(CustomCountHistogram, discardedTokenCountHistogram, ("Pa rser.DiscardedTokenCount", 1, 100000, 50)); | |
| 400 discardedTokenCountHistogram.count(discardedTokenCount); | |
| 401 | |
| 386 m_speculations.clear(); | 402 m_speculations.clear(); |
| 387 | 403 |
| 388 OwnPtr<BackgroundHTMLParser::Checkpoint> checkpoint = adoptPtr(new Backgroun dHTMLParser::Checkpoint); | 404 OwnPtr<BackgroundHTMLParser::Checkpoint> checkpoint = adoptPtr(new Backgroun dHTMLParser::Checkpoint); |
| 389 checkpoint->parser = m_weakFactory.createWeakPtr(); | 405 checkpoint->parser = m_weakFactory.createWeakPtr(); |
| 390 checkpoint->token = std::move(token); | 406 checkpoint->token = std::move(token); |
| 391 checkpoint->tokenizer = std::move(tokenizer); | 407 checkpoint->tokenizer = std::move(tokenizer); |
| 392 checkpoint->treeBuilderState = HTMLTreeBuilderSimulator::stateFor(m_treeBuil der.get()); | 408 checkpoint->treeBuilderState = HTMLTreeBuilderSimulator::stateFor(m_treeBuil der.get()); |
| 393 checkpoint->inputCheckpoint = lastChunkBeforeScript->inputCheckpoint; | 409 checkpoint->inputCheckpoint = lastChunkBeforeScript->inputCheckpoint; |
| 394 checkpoint->preloadScannerCheckpoint = lastChunkBeforeScript->preloadScanner Checkpoint; | 410 checkpoint->preloadScannerCheckpoint = lastChunkBeforeScript->preloadScanner Checkpoint; |
| 395 checkpoint->unparsedInput = m_input.current().toString().isolatedCopy(); | 411 checkpoint->unparsedInput = m_input.current().toString().isolatedCopy(); |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1109 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); | 1125 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); |
| 1110 successHistogram.count(duration); | 1126 successHistogram.count(duration); |
| 1111 } else { | 1127 } else { |
| 1112 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); | 1128 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); |
| 1113 failureHistogram.count(duration); | 1129 failureHistogram.count(duration); |
| 1114 } | 1130 } |
| 1115 | 1131 |
| 1116 } | 1132 } |
| 1117 | 1133 |
| 1118 } // namespace blink | 1134 } // namespace blink |
| OLD | NEW |