Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp

Issue 2078723002: Add HTML parser UMA for rewinds and chunk queue statistics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove trace event Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 aa007910512d3a0bd953112c939a71c091ab4275..23aa6427f502a717d87f9bbb4569a6116ea9cc4d 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -158,6 +158,13 @@ DEFINE_TRACE(HTMLDocumentParser)
void HTMLDocumentParser::detach()
{
+ if (!isParsingFragment() && m_parsedChunkQueue.get() && m_parsedChunkQueue->peakPendingChunkCount()) {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingChunkHistogram, ("Parser.PeakPendingChunkCount", 1, 1000, 50));
+ peakPendingChunkHistogram.count(m_parsedChunkQueue->peakPendingChunkCount());
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, peakPendingTokenHistogram, ("Parser.PeakPendingTokenCount", 1, 100000, 50));
+ peakPendingTokenHistogram.count(m_parsedChunkQueue->peakPendingTokenCount());
+ }
+
if (m_haveBackgroundParser)
stopBackgroundParser();
DocumentParser::detach();
@@ -385,6 +392,14 @@ void HTMLDocumentParser::validateSpeculations(std::unique_ptr<ParsedChunk> chunk
void HTMLDocumentParser::discardSpeculationsAndResumeFrom(std::unique_ptr<ParsedChunk> lastChunkBeforeScript, std::unique_ptr<HTMLToken> token, std::unique_ptr<HTMLTokenizer> tokenizer)
{
m_weakFactory.revokeAll();
+
+ size_t discardedTokenCount = 0;
+ for (const auto& speculation : m_speculations) {
+ discardedTokenCount += speculation->tokens->size();
+ }
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, discardedTokenCountHistogram, ("Parser.DiscardedTokenCount", 1, 100000, 50));
+ discardedTokenCountHistogram.count(discardedTokenCount);
+
m_speculations.clear();
std::unique_ptr<BackgroundHTMLParser::Checkpoint> checkpoint = wrapUnique(new BackgroundHTMLParser::Checkpoint);

Powered by Google App Engine
This is Rietveld 408576698