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); }
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); }