double PerformanceResourceTiming::workerReady() const
{
    if (!m_timing || m_timing->workerReady() == 0.0)
        return 0.0;

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_timing->workerReady());
}
double PerformanceResourceTiming::redirectEnd() const
{
    if (!m_lastRedirectEndTime || !m_allowRedirectDetails)
        return 0.0;

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_lastRedirectEndTime);
}
double PerformanceResourceTiming::responseEnd() const
{
    if (!m_finishTime)
        return responseStart();

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_finishTime);
}
double PerformanceResourceTiming::requestStart() const
{
    if (!m_allowTimingDetails)
        return 0.0;

    if (!m_timing)
        return connectEnd();

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_timing->sendStart());
}
double PerformanceResourceTiming::domainLookupEnd() const
{
    if (!m_allowTimingDetails)
        return 0.0;

    if (!m_timing || m_timing->dnsEnd() == 0.0)
        return domainLookupStart();

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_timing->dnsEnd());
}
double PerformanceResourceTiming::secureConnectionStart() const
{
    if (!m_allowTimingDetails)
        return 0.0;

    if (!m_timing || m_timing->sslStart() == 0.0) // Secure connection not negotiated.
        return 0.0;

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_timing->sslStart());
}
double PerformanceResourceTiming::responseStart() const
{
    if (!m_allowTimingDetails)
        return 0.0;

    if (!m_timing)
        return requestStart();

    // FIXME: This number isn't exactly correct. See the notes in PerformanceTiming::responseStart().
    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_timing->receiveHeadersEnd());
}
double PerformanceResourceTiming::connectEnd() const
{
    if (!m_allowTimingDetails)
        return 0.0;

    // connectStart will be zero when a network request is not made.
    if (!m_timing || m_timing->connectEnd() == 0.0 || m_didReuseConnection)
        return connectStart();

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_timing->connectEnd());
}
PerformanceResourceTiming::PerformanceResourceTiming(const ResourceTimingInfo& info, double timeOrigin, double startTime, double lastRedirectEndTime, bool allowTimingDetails, bool allowRedirectDetails)
    : PerformanceEntry(info.initialRequest().url().getString(), "resource", monotonicTimeToDOMHighResTimeStamp(timeOrigin, startTime), monotonicTimeToDOMHighResTimeStamp(timeOrigin, info.loadFinishTime()))
    , m_initiatorType(info.initiatorType())
    , m_timeOrigin(timeOrigin)
    , m_timing(info.finalResponse().resourceLoadTiming())
    , m_lastRedirectEndTime(lastRedirectEndTime)
    , m_finishTime(info.loadFinishTime())
    , m_didReuseConnection(info.finalResponse().connectionReused())
    , m_allowTimingDetails(allowTimingDetails)
    , m_allowRedirectDetails(allowRedirectDetails)
{
}
double PerformanceResourceTiming::fetchStart() const
{
    if (m_lastRedirectEndTime) {
        // FIXME: ASSERT(m_timing) should be in constructor once timeticks of
        // AppCache is exposed from chrome network stack, crbug/251100
        ASSERT(m_timing);
        return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_timing->requestTime());
    }

    if (double workerReadyTime = workerReady())
        return workerReadyTime;

    return PerformanceEntry::startTime();
}
double PerformanceResourceTiming::connectStart() const
{
    if (!m_allowTimingDetails)
        return 0.0;

    // connectStart will be zero when a network request is not made.
    if (!m_timing || m_timing->connectStart() == 0.0 || m_didReuseConnection)
        return domainLookupEnd();

    // connectStart includes any DNS time, so we may need to trim that off.
    double connectStart = m_timing->connectStart();
    if (m_timing->dnsEnd() > 0.0)
        connectStart = m_timing->dnsEnd();

    return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, connectStart);
}
예제 #12
0
DOMHighResTimeStamp PerformanceBase::now() const {
  return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime());
}
예제 #13
0
double PerformanceBase::monotonicTimeToDOMHighResTimeStampInMillis(
    DOMHighResTimeStamp monotonicTime) const {
  return monotonicTimeToDOMHighResTimeStamp(monotonicTime) * 1000;
}