Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1175)

Unified Diff: Source/core/page/PerformanceResourceTiming.cpp

Issue 15265004: Fix ResourceLoadTiming resolution lose issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add inline help function to satisfy inspector Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/PerformanceResourceTiming.h ('k') | Source/core/page/PerformanceTiming.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/page/PerformanceResourceTiming.h ('k') | Source/core/page/PerformanceTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698