OLD | NEW |
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 Loading... |
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) | 124 if (!m_timing || m_timing->dnsStart == 0.0) |
126 #else | |
127 if (!m_timing || m_timing->dnsStart < 0) | |
128 #endif | |
129 return fetchStart(); | 125 return fetchStart(); |
130 | 126 |
131 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
132 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->dnsStart); | 127 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->dnsStart); |
133 #else | |
134 return resourceTimeToDocumentMilliseconds(m_timing->dnsStart); | |
135 #endif | |
136 } | 128 } |
137 | 129 |
138 double PerformanceResourceTiming::domainLookupEnd() const | 130 double PerformanceResourceTiming::domainLookupEnd() const |
139 { | 131 { |
140 if (!m_shouldReportDetails) | 132 if (!m_shouldReportDetails) |
141 return 0.0; | 133 return 0.0; |
142 | 134 |
143 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
144 if (!m_timing || m_timing->dnsEnd == 0.0) | 135 if (!m_timing || m_timing->dnsEnd == 0.0) |
145 #else | |
146 if (!m_timing || m_timing->dnsEnd < 0) | |
147 #endif | |
148 return domainLookupStart(); | 136 return domainLookupStart(); |
149 | 137 |
150 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
151 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->dnsEnd); | 138 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->dnsEnd); |
152 #else | |
153 return resourceTimeToDocumentMilliseconds(m_timing->dnsEnd); | |
154 #endif | |
155 } | 139 } |
156 | 140 |
157 double PerformanceResourceTiming::connectStart() const | 141 double PerformanceResourceTiming::connectStart() const |
158 { | 142 { |
159 if (!m_shouldReportDetails) | 143 if (!m_shouldReportDetails) |
160 return 0.0; | 144 return 0.0; |
161 | 145 |
162 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
163 // connectStart will be zero when a network request is not made. | 146 // connectStart will be zero when a network request is not made. |
164 if (!m_timing || m_timing->connectStart == 0.0 || m_didReuseConnection) | 147 if (!m_timing || m_timing->connectStart == 0.0 || m_didReuseConnection) |
165 return domainLookupEnd(); | 148 return domainLookupEnd(); |
166 | 149 |
167 // connectStart includes any DNS time, so we may need to trim that off. | 150 // connectStart includes any DNS time, so we may need to trim that off. |
168 double connectStart = m_timing->connectStart; | 151 double connectStart = m_timing->connectStart; |
169 if (m_timing->dnsEnd > 0.0) | 152 if (m_timing->dnsEnd > 0.0) |
170 connectStart = m_timing->dnsEnd; | 153 connectStart = m_timing->dnsEnd; |
171 #else | |
172 // connectStart will be -1 when a network request is not made. | |
173 if (!m_timing || m_timing->connectStart < 0 || m_didReuseConnection) | |
174 return domainLookupEnd(); | |
175 | 154 |
176 // connectStart includes any DNS time, so we may need to trim that off. | |
177 int connectStart = m_timing->connectStart; | |
178 if (m_timing->dnsEnd >= 0) | |
179 connectStart = m_timing->dnsEnd; | |
180 #endif | |
181 | |
182 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
183 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), conne
ctStart); | 155 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), conne
ctStart); |
184 #else | |
185 return resourceTimeToDocumentMilliseconds(m_timing->connectStart); | |
186 #endif | |
187 } | 156 } |
188 | 157 |
189 double PerformanceResourceTiming::connectEnd() const | 158 double PerformanceResourceTiming::connectEnd() const |
190 { | 159 { |
191 if (!m_shouldReportDetails) | 160 if (!m_shouldReportDetails) |
192 return 0.0; | 161 return 0.0; |
193 | 162 |
194 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
195 // connectStart will be zero when a network request is not made. | 163 // connectStart will be zero when a network request is not made. |
196 if (!m_timing || m_timing->connectEnd == 0.0 || m_didReuseConnection) | 164 if (!m_timing || m_timing->connectEnd == 0.0 || m_didReuseConnection) |
197 #else | |
198 // connectStart will be -1 when a network request is not made. | |
199 if (!m_timing || m_timing->connectEnd < 0 || m_didReuseConnection) | |
200 #endif | |
201 return connectStart(); | 165 return connectStart(); |
202 | 166 |
203 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
204 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->connectEnd); | 167 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->connectEnd); |
205 #else | |
206 return resourceTimeToDocumentMilliseconds(m_timing->connectEnd); | |
207 #endif | |
208 } | 168 } |
209 | 169 |
210 double PerformanceResourceTiming::secureConnectionStart() const | 170 double PerformanceResourceTiming::secureConnectionStart() const |
211 { | 171 { |
212 if (!m_shouldReportDetails) | 172 if (!m_shouldReportDetails) |
213 return 0.0; | 173 return 0.0; |
214 | 174 |
215 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
216 if (!m_timing || m_timing->sslStart == 0.0) // Secure connection not negotia
ted. | 175 if (!m_timing || m_timing->sslStart == 0.0) // Secure connection not negotia
ted. |
217 #else | |
218 if (!m_timing || m_timing->sslStart < 0) // Secure connection not negotiated
. | |
219 #endif | |
220 return 0.0; | 176 return 0.0; |
221 | 177 |
222 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
223 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->sslStart); | 178 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->sslStart); |
224 #else | |
225 return resourceTimeToDocumentMilliseconds(m_timing->sslStart); | |
226 #endif | |
227 } | 179 } |
228 | 180 |
229 double PerformanceResourceTiming::requestStart() const | 181 double PerformanceResourceTiming::requestStart() const |
230 { | 182 { |
231 if (!m_shouldReportDetails) | 183 if (!m_shouldReportDetails) |
232 return 0.0; | 184 return 0.0; |
233 | 185 |
234 if (!m_timing) | 186 if (!m_timing) |
235 return connectEnd(); | 187 return connectEnd(); |
236 | 188 |
237 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
238 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->sendStart); | 189 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->sendStart); |
239 #else | |
240 return resourceTimeToDocumentMilliseconds(m_timing->sendStart); | |
241 #endif | |
242 } | 190 } |
243 | 191 |
244 double PerformanceResourceTiming::responseStart() const | 192 double PerformanceResourceTiming::responseStart() const |
245 { | 193 { |
246 if (!m_shouldReportDetails) | 194 if (!m_shouldReportDetails) |
247 return 0.0; | 195 return 0.0; |
248 | 196 |
249 if (!m_timing) | 197 if (!m_timing) |
250 return requestStart(); | 198 return requestStart(); |
| 199 |
251 // FIXME: This number isn't exactly correct. See the notes in PerformanceTim
ing::responseStart(). | 200 // 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); | 201 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->receiveHeadersEnd); |
254 #else | |
255 return resourceTimeToDocumentMilliseconds(m_timing->receiveHeadersEnd); | |
256 #endif | |
257 } | 202 } |
258 | 203 |
259 double PerformanceResourceTiming::responseEnd() const | 204 double PerformanceResourceTiming::responseEnd() const |
260 { | 205 { |
261 if (!m_finishTime) | 206 if (!m_finishTime) |
262 return responseStart(); | 207 return responseStart(); |
263 | 208 |
264 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_fin
ishTime); | 209 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_fin
ishTime); |
265 } | 210 } |
266 | 211 |
267 #ifndef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
268 double PerformanceResourceTiming::resourceTimeToDocumentMilliseconds(int deltaMi
lliseconds) const | |
269 { | |
270 ASSERT(deltaMilliseconds >= 0); | |
271 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim
ing->requestTime) + deltaMilliseconds; | |
272 } | |
273 #endif | |
274 | |
275 } // namespace WebCore | 212 } // namespace WebCore |
OLD | NEW |