| Index: Source/core/page/PerformanceResourceTiming.cpp
|
| diff --git a/Source/core/page/PerformanceResourceTiming.cpp b/Source/core/page/PerformanceResourceTiming.cpp
|
| index b93eba37bb5eb4885f4858cdf20f23c9708b2987..304e798eb248bf364fc08cc42ead7656aff1cf20 100644
|
| --- a/Source/core/page/PerformanceResourceTiming.cpp
|
| +++ b/Source/core/page/PerformanceResourceTiming.cpp
|
| @@ -121,10 +121,18 @@ double PerformanceResourceTiming::domainLookupStart() const
|
| if (!m_shouldReportDetails)
|
| return 0.0;
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + if (!m_timing || m_timing->dnsStart == 0.0)
|
| +#else
|
| if (!m_timing || m_timing->dnsStart < 0)
|
| +#endif
|
| return fetchStart();
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->dnsStart);
|
| +#else
|
| return resourceTimeToDocumentMilliseconds(m_timing->dnsStart);
|
| +#endif
|
| }
|
|
|
| double PerformanceResourceTiming::domainLookupEnd() const
|
| @@ -132,10 +140,18 @@ double PerformanceResourceTiming::domainLookupEnd() const
|
| if (!m_shouldReportDetails)
|
| return 0.0;
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + if (!m_timing || m_timing->dnsEnd == 0.0)
|
| +#else
|
| if (!m_timing || m_timing->dnsEnd < 0)
|
| +#endif
|
| return domainLookupStart();
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->dnsEnd);
|
| +#else
|
| return resourceTimeToDocumentMilliseconds(m_timing->dnsEnd);
|
| +#endif
|
| }
|
|
|
| double PerformanceResourceTiming::connectStart() const
|
| @@ -143,6 +159,16 @@ double PerformanceResourceTiming::connectStart() const
|
| if (!m_shouldReportDetails)
|
| return 0.0;
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + // 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;
|
| +#else
|
| // connectStart will be -1 when a network request is not made.
|
| if (!m_timing || m_timing->connectStart < 0 || m_didReuseConnection)
|
| return domainLookupEnd();
|
| @@ -151,8 +177,13 @@ double PerformanceResourceTiming::connectStart() const
|
| int connectStart = m_timing->connectStart;
|
| if (m_timing->dnsEnd >= 0)
|
| connectStart = m_timing->dnsEnd;
|
| +#endif
|
|
|
| - return resourceTimeToDocumentMilliseconds(connectStart);
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), connectStart);
|
| +#else
|
| + return resourceTimeToDocumentMilliseconds(m_timing->connectStart);
|
| +#endif
|
| }
|
|
|
| double PerformanceResourceTiming::connectEnd() const
|
| @@ -160,11 +191,20 @@ double PerformanceResourceTiming::connectEnd() const
|
| if (!m_shouldReportDetails)
|
| return 0.0;
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + // connectStart will be zero when a network request is not made.
|
| + if (!m_timing || m_timing->connectEnd == 0.0 || m_didReuseConnection)
|
| +#else
|
| // connectStart will be -1 when a network request is not made.
|
| if (!m_timing || m_timing->connectEnd < 0 || m_didReuseConnection)
|
| +#endif
|
| return connectStart();
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->connectEnd);
|
| +#else
|
| return resourceTimeToDocumentMilliseconds(m_timing->connectEnd);
|
| +#endif
|
| }
|
|
|
| double PerformanceResourceTiming::secureConnectionStart() const
|
| @@ -172,10 +212,18 @@ double PerformanceResourceTiming::secureConnectionStart() const
|
| if (!m_shouldReportDetails)
|
| return 0.0;
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + if (!m_timing || m_timing->sslStart == 0.0) // Secure connection not negotiated.
|
| +#else
|
| if (!m_timing || m_timing->sslStart < 0) // Secure connection not negotiated.
|
| +#endif
|
| return 0.0;
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->sslStart);
|
| +#else
|
| return resourceTimeToDocumentMilliseconds(m_timing->sslStart);
|
| +#endif
|
| }
|
|
|
| double PerformanceResourceTiming::requestStart() const
|
| @@ -186,7 +234,11 @@ double PerformanceResourceTiming::requestStart() const
|
| if (!m_timing)
|
| return connectEnd();
|
|
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->sendStart);
|
| +#else
|
| return resourceTimeToDocumentMilliseconds(m_timing->sendStart);
|
| +#endif
|
| }
|
|
|
| double PerformanceResourceTiming::responseStart() const
|
| @@ -197,7 +249,11 @@ double PerformanceResourceTiming::responseStart() const
|
| if (!m_timing)
|
| return requestStart();
|
| // FIXME: This number isn't exactly correct. See the notes in PerformanceTiming::responseStart().
|
| +#ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| + return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->receiveHeadersEnd);
|
| +#else
|
| return resourceTimeToDocumentMilliseconds(m_timing->receiveHeadersEnd);
|
| +#endif
|
| }
|
|
|
| double PerformanceResourceTiming::responseEnd() const
|
| @@ -208,10 +264,12 @@ double PerformanceResourceTiming::responseEnd() const
|
| return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_finishTime);
|
| }
|
|
|
| +#ifndef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
|
| double PerformanceResourceTiming::resourceTimeToDocumentMilliseconds(int deltaMilliseconds) const
|
| {
|
| ASSERT(deltaMilliseconds >= 0);
|
| return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->requestTime) + deltaMilliseconds;
|
| }
|
| +#endif
|
|
|
| } // namespace WebCore
|
|
|