This source file includes following definitions.
- m_hasSameOriginAsPreviousDocument
- monotonicTimeToZeroBasedDocumentTime
- monotonicTimeToPseudoWallTime
- markNavigationStart
- setNavigationStart
- addRedirect
#include "config.h"
#include "core/loader/DocumentLoadTiming.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "wtf/RefPtr.h"
namespace WebCore {
DocumentLoadTiming::DocumentLoadTiming()
: m_referenceMonotonicTime(0.0)
, m_referenceWallTime(0.0)
, m_navigationStart(0.0)
, m_unloadEventStart(0.0)
, m_unloadEventEnd(0.0)
, m_redirectStart(0.0)
, m_redirectEnd(0.0)
, m_redirectCount(0)
, m_fetchStart(0.0)
, m_responseEnd(0.0)
, m_loadEventStart(0.0)
, m_loadEventEnd(0.0)
, m_hasCrossOriginRedirect(false)
, m_hasSameOriginAsPreviousDocument(false)
{
}
double DocumentLoadTiming::monotonicTimeToZeroBasedDocumentTime(double monotonicTime) const
{
if (!monotonicTime)
return 0.0;
return monotonicTime - m_referenceMonotonicTime;
}
double DocumentLoadTiming::monotonicTimeToPseudoWallTime(double monotonicTime) const
{
if (!monotonicTime)
return 0.0;
return m_referenceWallTime + monotonicTime - m_referenceMonotonicTime;
}
void DocumentLoadTiming::markNavigationStart()
{
ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTime);
m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime();
m_referenceWallTime = currentTime();
}
void DocumentLoadTiming::setNavigationStart(double navigationStart)
{
ASSERT(m_referenceMonotonicTime && m_referenceWallTime);
m_navigationStart = navigationStart;
}
void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& redirectedUrl)
{
m_redirectCount++;
if (!m_redirectStart)
m_redirectStart = m_fetchStart;
m_redirectEnd = m_fetchStart = monotonicallyIncreasingTime();
RefPtr<SecurityOrigin> redirectedSecurityOrigin = SecurityOrigin::create(redirectedUrl);
m_hasCrossOriginRedirect = !redirectedSecurityOrigin->canRequest(redirectingUrl);
}
}