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

Unified Diff: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.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: 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/BackgroundHTMLParser.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
index d2e5924f5214a552e001bb7cab419b8e1ed9ae40..9dadd381c111a0c8a2486653fded57b7ab002e5e 100644
--- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -29,10 +29,12 @@
#include "core/html/parser/HTMLDocumentParser.h"
#include "core/html/parser/TextResourceDecoder.h"
#include "core/html/parser/XSSAuditor.h"
+#include "platform/Histogram.h"
#include "platform/ThreadSafeFunctional.h"
#include "platform/TraceEvent.h"
#include "public/platform/Platform.h"
#include "public/platform/WebTaskRunner.h"
+#include "wtf/CurrentTime.h"
#include "wtf/text/TextPosition.h"
namespace blink {
@@ -286,9 +288,10 @@ void BackgroundHTMLParser::sendTokensToMainThread()
checkThatPreloadsAreSafeToSendToAnotherThread(m_pendingPreloads);
checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos);
#endif
-
+ double chunkStartTime = monotonicallyIncreasingTimeMS();
OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentParser::ParsedChunk);
TRACE_EVENT_WITH_FLOW0("blink,loading", "BackgroundHTMLParser::sendTokensToMainThread", chunk.get(), TRACE_EVENT_FLAG_FLOW_OUT);
+
chunk->preloads.swap(m_pendingPreloads);
if (m_viewportDescription.set)
chunk->viewport = m_viewportDescription;
@@ -303,6 +306,10 @@ void BackgroundHTMLParser::sendTokensToMainThread()
m_startingScript = false;
bool isEmpty = m_parsedChunkQueue->enqueue(std::move(chunk));
+
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, chunkEnqueueTime, ("Parser.ChunkEnqueueTime", 1, 10000, 50));
+ chunkEnqueueTime.count(monotonicallyIncreasingTimeMS() - chunkStartTime);
+
if (isEmpty) {
m_loadingTaskRunner->postTask(
BLINK_FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698