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

Unified Diff: Source/core/loader/DocumentLoadTiming.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/loader/DocumentLoadTiming.cpp
diff --git a/Source/core/loader/DocumentLoadTiming.cpp b/Source/core/loader/DocumentLoadTiming.cpp
index 9d2a2de40788f3d1bcb60ebb41480deac17983c1..16621b8d38e2859f1f9831dae9628557c82b324b 100644
--- a/Source/core/loader/DocumentLoadTiming.cpp
+++ b/Source/core/loader/DocumentLoadTiming.cpp
@@ -26,13 +26,14 @@
#include "config.h"
#include "core/loader/DocumentLoadTiming.h"
+#include "core/loader/DocumentLoader.h"
#include "platform/TraceEvent.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "wtf/RefPtr.h"
namespace blink {
-DocumentLoadTiming::DocumentLoadTiming()
+DocumentLoadTiming::DocumentLoadTiming(WeakPtrWillBeRawPtr<DocumentLoader> documentLoader)
: m_referenceMonotonicTime(0.0)
, m_referenceWallTime(0.0)
, m_navigationStart(0.0)
@@ -47,9 +48,16 @@ DocumentLoadTiming::DocumentLoadTiming()
, m_loadEventEnd(0.0)
, m_hasCrossOriginRedirect(false)
, m_hasSameOriginAsPreviousDocument(false)
+ , m_documentLoader(documentLoader)
{
}
+void DocumentLoadTiming::notifyDocumentTimingChanged()
+{
+ if (m_documentLoader)
+ m_documentLoader->didChangePerformanceTiming();
+}
+
double DocumentLoadTiming::monotonicTimeToZeroBasedDocumentTime(double monotonicTime) const
{
if (!monotonicTime)
@@ -78,6 +86,7 @@ void DocumentLoadTiming::markNavigationStart()
m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime();
m_referenceWallTime = currentTime();
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::setNavigationStart(double navigationStart)
@@ -92,6 +101,7 @@ void DocumentLoadTiming::setNavigationStart(double navigationStart)
// as well.
m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart);
m_referenceMonotonicTime = navigationStart;
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& redirectedUrl)
@@ -112,48 +122,56 @@ void DocumentLoadTiming::markUnloadEventStart()
{
TRACE_EVENT_MARK("blink.user_timing", "unloadEventStart");
m_unloadEventStart = monotonicallyIncreasingTime();
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::markUnloadEventEnd()
{
TRACE_EVENT_MARK("blink.user_timing", "unloadEventEnd");
m_unloadEventEnd = monotonicallyIncreasingTime();
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::markFetchStart()
{
TRACE_EVENT_MARK("blink.user_timing", "fetchStart");
m_fetchStart = monotonicallyIncreasingTime();
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::setResponseEnd(double responseEnd)
{
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "responseEnd", responseEnd);
m_responseEnd = responseEnd;
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::markLoadEventStart()
{
TRACE_EVENT_MARK("blink.user_timing", "loadEventStart");
m_loadEventStart = monotonicallyIncreasingTime();
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::markLoadEventEnd()
{
TRACE_EVENT_MARK("blink.user_timing", "loadEventEnd");
m_loadEventEnd = monotonicallyIncreasingTime();
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::setRedirectStart(double redirectStart)
{
TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "redirectStart", redirectStart);
m_redirectStart = m_fetchStart;
+ notifyDocumentTimingChanged();
}
void DocumentLoadTiming::markRedirectEnd()
{
TRACE_EVENT_MARK("blink.user_timing", "redirectEnd");
m_redirectEnd = monotonicallyIncreasingTime();
+ notifyDocumentTimingChanged();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698