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

Unified Diff: Source/core/dom/DocumentTiming.cpp

Issue 1288973002: Observing DocumentTiming and sending data to RenderFrameImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Document logic moved to DocumentTiming Created 5 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
Index: Source/core/dom/DocumentTiming.cpp
diff --git a/Source/core/dom/DocumentTiming.cpp b/Source/core/dom/DocumentTiming.cpp
index 33356c277d1648357bf2eb5f3fcf51e8fab1b28a..8359b9cc801e8ec15b002b38a4a36980cc715173 100644
--- a/Source/core/dom/DocumentTiming.cpp
+++ b/Source/core/dom/DocumentTiming.cpp
@@ -5,54 +5,69 @@
#include "config.h"
#include "core/dom/DocumentTiming.h"
+#include "core/dom/Document.h"
+#include "core/loader/DocumentLoader.h"
#include "platform/TraceEvent.h"
namespace blink {
-DocumentTiming::DocumentTiming()
+DocumentTiming::DocumentTiming(WeakPtrWillBeRawPtr<Document> document)
: m_domLoading(0.0)
, m_domInteractive(0.0)
, m_domContentLoadedEventStart(0.0)
, m_domContentLoadedEventEnd(0.0)
, m_domComplete(0.0)
, m_firstLayout(0.0)
+ , m_document(document)
{
}
+void DocumentTiming::notifyDocumentTimingChanged()
+{
+ if (m_document && m_document->loader())
+ m_document->loader()->didChangePerformanceTiming();
+}
+
void DocumentTiming::markDomLoading()
{
m_domLoading = monotonicallyIncreasingTime();
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "domLoading", m_domLoading);
+ notifyDocumentTimingChanged();
}
void DocumentTiming::markDomInteractive()
{
m_domInteractive = monotonicallyIncreasingTime();
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "domInteractive", m_domInteractive);
+ notifyDocumentTimingChanged();
}
void DocumentTiming::markDomContentLoadedEventStart()
{
m_domContentLoadedEventStart = monotonicallyIncreasingTime();
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "domContentLoadedEventStart", m_domContentLoadedEventStart);
+ notifyDocumentTimingChanged();
}
void DocumentTiming::markDomContentLoadedEventEnd()
{
m_domContentLoadedEventEnd = monotonicallyIncreasingTime();
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "domContentLoadedEventEnd", m_domContentLoadedEventEnd);
+ notifyDocumentTimingChanged();
}
void DocumentTiming::markDomComplete()
{
m_domComplete = monotonicallyIncreasingTime();
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "domComplete", m_domComplete);
+ notifyDocumentTimingChanged();
}
void DocumentTiming::markFirstLayout()
{
m_firstLayout = monotonicallyIncreasingTime();
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "firstLayout", m_firstLayout);
+ notifyDocumentTimingChanged();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698