Beispiel #1
0
ScriptValue PerformanceTiming::toJSONForBinding(
    ScriptState* scriptState) const {
  V8ObjectBuilder result(scriptState);
  result.addNumber("navigationStart", navigationStart());
  result.addNumber("unloadEventStart", unloadEventStart());
  result.addNumber("unloadEventEnd", unloadEventEnd());
  result.addNumber("redirectStart", redirectStart());
  result.addNumber("redirectEnd", redirectEnd());
  result.addNumber("fetchStart", fetchStart());
  result.addNumber("domainLookupStart", domainLookupStart());
  result.addNumber("domainLookupEnd", domainLookupEnd());
  result.addNumber("connectStart", connectStart());
  result.addNumber("connectEnd", connectEnd());
  result.addNumber("secureConnectionStart", secureConnectionStart());
  result.addNumber("requestStart", requestStart());
  result.addNumber("responseStart", responseStart());
  result.addNumber("responseEnd", responseEnd());
  result.addNumber("domLoading", domLoading());
  result.addNumber("domInteractive", domInteractive());
  result.addNumber("domContentLoadedEventStart", domContentLoadedEventStart());
  result.addNumber("domContentLoadedEventEnd", domContentLoadedEventEnd());
  result.addNumber("domComplete", domComplete());
  result.addNumber("loadEventStart", loadEventStart());
  result.addNumber("loadEventEnd", loadEventEnd());
  return result.scriptValue();
}
Beispiel #2
0
unsigned long long PerformanceTiming::connectStart() const
{
    DocumentLoader* loader = documentLoader();
    if (!loader)
        return domainLookupEnd();

    const ResourceLoadTiming& timing = loader->response().resourceLoadTiming();
    
    // connectStart will be -1 when a network request is not made.
    // Rather than exposing a special value that indicates no new connection, we "backfill" with domainLookupEnd.
    int connectStart = timing.connectStart;
    if (connectStart < 0)
        return domainLookupEnd();

    // ResourceLoadTiming's connect phase includes DNS, however Navigation Timing's
    // connect phase should not. So if there is DNS time, trim it from the start.
    if (timing.domainLookupEnd >= 0 && timing.domainLookupEnd > connectStart)
        connectStart = timing.domainLookupEnd;

    return resourceLoadTimeRelativeToAbsolute(connectStart);
}
unsigned long long PerformanceTiming::connectStart() const
{
    DocumentLoader* loader = documentLoader();
    if (!loader)
        return domainLookupEnd();

    ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
    if (!timing)
        return domainLookupEnd();

    // connectStart will be zero when a network request is not made.
    // Rather than exposing a special value that indicates no new connection, we "backfill" with domainLookupEnd.
    double connectStart = timing->connectStart;
    if (connectStart == 0.0 || loader->response().connectionReused())
        return domainLookupEnd();

    // ResourceLoadTiming's connect phase includes DNS, however Navigation Timing's
    // connect phase should not. So if there is DNS time, trim it from the start.
    if (timing->dnsEnd > 0.0 && timing->dnsEnd > connectStart)
        connectStart = timing->dnsEnd;

    return monotonicTimeToIntegerMilliseconds(connectStart);
}
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);
}
double PerformanceResourceTiming::connectStart() const
{
    if (!m_shouldReportDetails)
        return 0.0;

    // connectStart will be -1 when a network request is not made.
    if (m_timing.connectStart < 0)
        return domainLookupEnd();

    // connectStart includes any DNS time, so we may need to trim that off.
    int connectStart = m_timing.connectStart;
    if (m_timing.domainLookupEnd >= 0)
        connectStart = m_timing.domainLookupEnd;

    return resourceTimeToDocumentMilliseconds(connectStart);
}
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 monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), connectStart);
}
void PerformanceResourceTiming::buildJSONValue(V8ObjectBuilder& builder) const
{
    PerformanceEntry::buildJSONValue(builder);
    builder.addString("initiatorType", initiatorType());
    builder.addNumber("workerStart", workerStart());
    builder.addNumber("redirectStart", redirectStart());
    builder.addNumber("redirectEnd", redirectEnd());
    builder.addNumber("fetchStart", fetchStart());
    builder.addNumber("domainLookupStart", domainLookupStart());
    builder.addNumber("domainLookupEnd", domainLookupEnd());
    builder.addNumber("connectStart", connectStart());
    builder.addNumber("connectEnd", connectEnd());
    builder.addNumber("secureConnectionStart", secureConnectionStart());
    builder.addNumber("requestStart", requestStart());
    builder.addNumber("responseStart", responseStart());
    builder.addNumber("responseEnd", responseEnd());
}