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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/page/PerformanceResourceTiming.h ('k') | Source/core/page/PerformanceTiming.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 { 114 {
115 // FIXME: This should be different depending on redirects. 115 // FIXME: This should be different depending on redirects.
116 return (startTime()); 116 return (startTime());
117 } 117 }
118 118
119 double PerformanceResourceTiming::domainLookupStart() const 119 double PerformanceResourceTiming::domainLookupStart() const
120 { 120 {
121 if (!m_shouldReportDetails) 121 if (!m_shouldReportDetails)
122 return 0.0; 122 return 0.0;
123 123
124 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
125 if (!m_timing || m_timing->dnsStart == 0.0)
126 #else
124 if (!m_timing || m_timing->dnsStart < 0) 127 if (!m_timing || m_timing->dnsStart < 0)
128 #endif
125 return fetchStart(); 129 return fetchStart();
126 130
131 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
132 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->dnsStart);
133 #else
127 return resourceTimeToDocumentMilliseconds(m_timing->dnsStart); 134 return resourceTimeToDocumentMilliseconds(m_timing->dnsStart);
135 #endif
128 } 136 }
129 137
130 double PerformanceResourceTiming::domainLookupEnd() const 138 double PerformanceResourceTiming::domainLookupEnd() const
131 { 139 {
132 if (!m_shouldReportDetails) 140 if (!m_shouldReportDetails)
133 return 0.0; 141 return 0.0;
134 142
143 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
144 if (!m_timing || m_timing->dnsEnd == 0.0)
145 #else
135 if (!m_timing || m_timing->dnsEnd < 0) 146 if (!m_timing || m_timing->dnsEnd < 0)
147 #endif
136 return domainLookupStart(); 148 return domainLookupStart();
137 149
150 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
151 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->dnsEnd);
152 #else
138 return resourceTimeToDocumentMilliseconds(m_timing->dnsEnd); 153 return resourceTimeToDocumentMilliseconds(m_timing->dnsEnd);
154 #endif
139 } 155 }
140 156
141 double PerformanceResourceTiming::connectStart() const 157 double PerformanceResourceTiming::connectStart() const
142 { 158 {
143 if (!m_shouldReportDetails) 159 if (!m_shouldReportDetails)
144 return 0.0; 160 return 0.0;
145 161
162 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
163 // connectStart will be zero when a network request is not made.
164 if (!m_timing || m_timing->connectStart == 0.0 || m_didReuseConnection)
165 return domainLookupEnd();
166
167 // connectStart includes any DNS time, so we may need to trim that off.
168 double connectStart = m_timing->connectStart;
169 if (m_timing->dnsEnd > 0.0)
170 connectStart = m_timing->dnsEnd;
171 #else
146 // connectStart will be -1 when a network request is not made. 172 // connectStart will be -1 when a network request is not made.
147 if (!m_timing || m_timing->connectStart < 0 || m_didReuseConnection) 173 if (!m_timing || m_timing->connectStart < 0 || m_didReuseConnection)
148 return domainLookupEnd(); 174 return domainLookupEnd();
149 175
150 // connectStart includes any DNS time, so we may need to trim that off. 176 // connectStart includes any DNS time, so we may need to trim that off.
151 int connectStart = m_timing->connectStart; 177 int connectStart = m_timing->connectStart;
152 if (m_timing->dnsEnd >= 0) 178 if (m_timing->dnsEnd >= 0)
153 connectStart = m_timing->dnsEnd; 179 connectStart = m_timing->dnsEnd;
180 #endif
154 181
155 return resourceTimeToDocumentMilliseconds(connectStart); 182 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
183 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), conne ctStart);
184 #else
185 return resourceTimeToDocumentMilliseconds(m_timing->connectStart);
186 #endif
156 } 187 }
157 188
158 double PerformanceResourceTiming::connectEnd() const 189 double PerformanceResourceTiming::connectEnd() const
159 { 190 {
160 if (!m_shouldReportDetails) 191 if (!m_shouldReportDetails)
161 return 0.0; 192 return 0.0;
162 193
194 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
195 // connectStart will be zero when a network request is not made.
196 if (!m_timing || m_timing->connectEnd == 0.0 || m_didReuseConnection)
197 #else
163 // connectStart will be -1 when a network request is not made. 198 // connectStart will be -1 when a network request is not made.
164 if (!m_timing || m_timing->connectEnd < 0 || m_didReuseConnection) 199 if (!m_timing || m_timing->connectEnd < 0 || m_didReuseConnection)
200 #endif
165 return connectStart(); 201 return connectStart();
166 202
203 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
204 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->connectEnd);
205 #else
167 return resourceTimeToDocumentMilliseconds(m_timing->connectEnd); 206 return resourceTimeToDocumentMilliseconds(m_timing->connectEnd);
207 #endif
168 } 208 }
169 209
170 double PerformanceResourceTiming::secureConnectionStart() const 210 double PerformanceResourceTiming::secureConnectionStart() const
171 { 211 {
172 if (!m_shouldReportDetails) 212 if (!m_shouldReportDetails)
173 return 0.0; 213 return 0.0;
174 214
215 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
216 if (!m_timing || m_timing->sslStart == 0.0) // Secure connection not negotia ted.
217 #else
175 if (!m_timing || m_timing->sslStart < 0) // Secure connection not negotiated . 218 if (!m_timing || m_timing->sslStart < 0) // Secure connection not negotiated .
219 #endif
176 return 0.0; 220 return 0.0;
177 221
222 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
223 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->sslStart);
224 #else
178 return resourceTimeToDocumentMilliseconds(m_timing->sslStart); 225 return resourceTimeToDocumentMilliseconds(m_timing->sslStart);
226 #endif
179 } 227 }
180 228
181 double PerformanceResourceTiming::requestStart() const 229 double PerformanceResourceTiming::requestStart() const
182 { 230 {
183 if (!m_shouldReportDetails) 231 if (!m_shouldReportDetails)
184 return 0.0; 232 return 0.0;
185 233
186 if (!m_timing) 234 if (!m_timing)
187 return connectEnd(); 235 return connectEnd();
188 236
237 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
238 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->sendStart);
239 #else
189 return resourceTimeToDocumentMilliseconds(m_timing->sendStart); 240 return resourceTimeToDocumentMilliseconds(m_timing->sendStart);
241 #endif
190 } 242 }
191 243
192 double PerformanceResourceTiming::responseStart() const 244 double PerformanceResourceTiming::responseStart() const
193 { 245 {
194 if (!m_shouldReportDetails) 246 if (!m_shouldReportDetails)
195 return 0.0; 247 return 0.0;
196 248
197 if (!m_timing) 249 if (!m_timing)
198 return requestStart(); 250 return requestStart();
199 // FIXME: This number isn't exactly correct. See the notes in PerformanceTim ing::responseStart(). 251 // FIXME: This number isn't exactly correct. See the notes in PerformanceTim ing::responseStart().
252 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
253 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->receiveHeadersEnd);
254 #else
200 return resourceTimeToDocumentMilliseconds(m_timing->receiveHeadersEnd); 255 return resourceTimeToDocumentMilliseconds(m_timing->receiveHeadersEnd);
256 #endif
201 } 257 }
202 258
203 double PerformanceResourceTiming::responseEnd() const 259 double PerformanceResourceTiming::responseEnd() const
204 { 260 {
205 if (!m_finishTime) 261 if (!m_finishTime)
206 return responseStart(); 262 return responseStart();
207 263
208 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_fin ishTime); 264 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_fin ishTime);
209 } 265 }
210 266
267 #ifndef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING
211 double PerformanceResourceTiming::resourceTimeToDocumentMilliseconds(int deltaMi lliseconds) const 268 double PerformanceResourceTiming::resourceTimeToDocumentMilliseconds(int deltaMi lliseconds) const
212 { 269 {
213 ASSERT(deltaMilliseconds >= 0); 270 ASSERT(deltaMilliseconds >= 0);
214 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->requestTime) + deltaMilliseconds; 271 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->requestTime) + deltaMilliseconds;
215 } 272 }
273 #endif
216 274
217 } // namespace WebCore 275 } // namespace WebCore
OLDNEW
« 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