unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relativeMilliseconds) const { ASSERT(relativeMilliseconds >= 0); ResourceLoadTiming* resourceTiming = resourceLoadTiming(); ASSERT(resourceTiming); return monotonicTimeToIntegerMilliseconds(resourceTiming->convertResourceLoadTimeToMonotonicTime(relativeMilliseconds)); }
unsigned long long PerformanceTiming::requestStart() const { ResourceLoadTiming* timing = resourceLoadTiming(); if (!timing || timing->sendStart() == 0.0) return connectEnd(); return monotonicTimeToIntegerMilliseconds(timing->sendStart()); }
unsigned long long PerformanceTiming::requestStart() const { ResourceLoadTiming* timing = resourceLoadTiming(); if (!timing) return connectEnd(); ASSERT(timing->sendStart >= 0); return resourceLoadTimeRelativeToAbsolute(timing->sendStart); }
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()); }
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::domainLookupEnd() const { ResourceLoadTiming* timing = resourceLoadTiming(); if (!timing) return domainLookupStart(); // This will be -1 when a DNS request is not performed. // Rather than exposing a special value that indicates no DNS, we "backfill" with domainLookupStart. int dnsEnd = timing->dnsEnd; if (dnsEnd < 0) return domainLookupStart(); return resourceLoadTimeRelativeToAbsolute(dnsEnd); }
unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relativeSeconds) const { ASSERT(relativeSeconds >= 0); ResourceLoadTiming* resourceTiming = resourceLoadTiming(); ASSERT(resourceTiming); DocumentLoadTiming* documentTiming = documentLoadTiming(); ASSERT(documentTiming); // The ResourceLoadTiming API's requestTime is the base time to which all // other marks are relative. So to get an absolute time, we must add it to // the relative marks. // // Since ResourceLoadTimings came from the network platform layer, we must // check them for skew because they may be from another thread/process. double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd); return toIntegerMilliseconds(baseTime) + relativeSeconds; }