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

Unified Diff: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Issue 2235733004: Track parse time blocked on script in xml documents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
index 7525edd62e16fbe3035566342107cef8a1cda067..aea42d3f11ea30db1395894dddab9ddc66dbbd1d 100644
--- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -36,6 +36,7 @@
#include "core/dom/Comment.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentFragment.h"
+#include "core/dom/DocumentParserTiming.h"
#include "core/dom/DocumentType.h"
#include "core/dom/ProcessingInstruction.h"
#include "core/dom/ScriptLoader.h"
@@ -399,6 +400,7 @@ void XMLDocumentParser::detach()
if (m_pendingScript) {
m_pendingScript->removeClient(this);
m_pendingScript = nullptr;
+ m_parserBlockingPendingScriptLoadStartTime = 0.0;
}
clearCurrentNodeStack();
ScriptableDocumentParser::detach();
@@ -462,6 +464,8 @@ void XMLDocumentParser::notifyFinished(Resource* unusedResource)
ScriptSourceCode sourceCode(m_pendingScript.get());
bool errorOccurred = m_pendingScript->errorOccurred();
bool wasCanceled = m_pendingScript->wasCanceled();
+ double scriptParserBlockingTime = m_parserBlockingPendingScriptLoadStartTime;
+ m_parserBlockingPendingScriptLoadStartTime = 0.0;
m_pendingScript->removeClient(this);
m_pendingScript = nullptr;
@@ -475,6 +479,10 @@ void XMLDocumentParser::notifyFinished(Resource* unusedResource)
if (errorOccurred) {
scriptLoader->dispatchErrorEvent();
} else if (!wasCanceled) {
+ if (scriptParserBlockingTime > 0.0) {
+ DocumentParserTiming::from(*document()).recordParserBlockedOnScriptLoadDuration(monotonicallyIncreasingTime() - scriptParserBlockingTime, scriptLoader->wasCreatedDuringDocumentWrite());
kouhei (in TOK) 2016/08/12 01:13:29 Can we record this to separate UMA? XMLDocumentPar
+ }
+
if (!scriptLoader->executeScript(sourceCode))
scriptLoader->dispatchErrorEvent();
else
@@ -777,6 +785,7 @@ XMLDocumentParser::XMLDocumentParser(Document& document, FrameView* frameView)
, m_finishCalled(false)
, m_xmlErrors(&document)
, m_scriptStartPosition(TextPosition::belowRangePosition())
+ , m_parserBlockingPendingScriptLoadStartTime(0.0)
, m_parsingFragment(false)
{
// This is XML being used as a document resource.
@@ -1093,6 +1102,8 @@ void XMLDocumentParser::endElementNs()
}
} else if (scriptLoader->willBeParserExecuted()) {
m_pendingScript = scriptLoader->resource();
+ DCHECK_EQ(m_parserBlockingPendingScriptLoadStartTime, 0.0);
+ m_parserBlockingPendingScriptLoadStartTime = monotonicallyIncreasingTime();
m_scriptElement = element;
m_pendingScript->addClient(this);
// m_pendingScript will be 0 if script was already loaded and
« no previous file with comments | « third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698