예제 #1
0
unsigned long long PerformanceTiming::unloadEventEnd() const {
  DocumentLoadTiming* timing = documentLoadTiming();
  if (!timing)
    return 0;

  if (timing->hasCrossOriginRedirect() ||
      !timing->hasSameOriginAsPreviousDocument())
    return 0;

  return monotonicTimeToIntegerMilliseconds(timing->unloadEventEnd());
}
예제 #2
0
unsigned long long PerformanceTiming::redirectEnd() const
{
    DocumentLoadTiming* timing = documentLoadTiming();
    if (!timing)
        return 0;

    if (timing->hasCrossOriginRedirect())
        return 0;

    return monotonicTimeToIntegerMilliseconds(timing->redirectEnd());
}
예제 #3
0
unsigned long long PerformanceTiming::responseStart() const {
  ResourceLoadTiming* timing = resourceLoadTiming();
  if (!timing || timing->receiveHeadersEnd() == 0.0)
    return requestStart();

  // FIXME: Response start needs to be the time of the first received byte.
  // However, the ResourceLoadTiming API currently only supports the time
  // the last header byte was received. For many responses with reasonable
  // sized cookies, the HTTP headers fit into a single packet so this time
  // is basically equivalent. But for some responses, particularly those with
  // headers larger than a single packet, this time will be too late.
  return monotonicTimeToIntegerMilliseconds(timing->receiveHeadersEnd());
}
예제 #4
0
unsigned long long PerformanceTiming::domainLookupEnd() const {
  ResourceLoadTiming* timing = resourceLoadTiming();
  if (!timing)
    return domainLookupStart();

  // This will be zero when a DNS request is not performed.  Rather than
  // exposing a special value that indicates no DNS, we "backfill" with
  // domainLookupStart.
  double dnsEnd = timing->dnsEnd();
  if (dnsEnd == 0.0)
    return domainLookupStart();

  return monotonicTimeToIntegerMilliseconds(dnsEnd);
}
예제 #5
0
unsigned long long PerformanceTiming::secureConnectionStart() const {
  DocumentLoader* loader = documentLoader();
  if (!loader)
    return 0;

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

  double sslStart = timing->sslStart();
  if (sslStart == 0.0)
    return 0;

  return monotonicTimeToIntegerMilliseconds(sslStart);
}
예제 #6
0
unsigned long long PerformanceTiming::connectEnd() const {
  DocumentLoader* loader = documentLoader();
  if (!loader)
    return connectStart();

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

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

  return monotonicTimeToIntegerMilliseconds(connectEnd);
}
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);
}