OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 int sslStart = timing->sslStart; | 206 int sslStart = timing->sslStart; |
207 if (sslStart < 0) | 207 if (sslStart < 0) |
208 return 0; | 208 return 0; |
209 | 209 |
210 return resourceLoadTimeRelativeToAbsolute(sslStart); | 210 return resourceLoadTimeRelativeToAbsolute(sslStart); |
211 } | 211 } |
212 | 212 |
213 unsigned long long PerformanceTiming::requestStart() const | 213 unsigned long long PerformanceTiming::requestStart() const |
214 { | 214 { |
215 ResourceLoadTiming* timing = resourceLoadTiming(); | 215 ResourceLoadTiming* timing = resourceLoadTiming(); |
216 if (!timing) | 216 if (!timing || timing->sendStart < 0) |
217 return connectEnd(); | 217 return connectEnd(); |
218 | 218 |
219 ASSERT(timing->sendStart >= 0); | 219 ASSERT(timing->sendStart >= 0); |
220 return resourceLoadTimeRelativeToAbsolute(timing->sendStart); | 220 return resourceLoadTimeRelativeToAbsolute(timing->sendStart); |
221 } | 221 } |
222 | 222 |
223 unsigned long long PerformanceTiming::responseStart() const | 223 unsigned long long PerformanceTiming::responseStart() const |
224 { | 224 { |
225 ResourceLoadTiming* timing = resourceLoadTiming(); | 225 ResourceLoadTiming* timing = resourceLoadTiming(); |
226 if (!timing) | 226 if (!timing || timing->receiveHeadersEnd < 0) |
227 return requestStart(); | 227 return requestStart(); |
228 | 228 |
229 // FIXME: Response start needs to be the time of the first received byte. | 229 // FIXME: Response start needs to be the time of the first received byte. |
230 // However, the ResourceLoadTiming API currently only supports the time | 230 // However, the ResourceLoadTiming API currently only supports the time |
231 // the last header byte was received. For many responses with reasonable | 231 // the last header byte was received. For many responses with reasonable |
232 // sized cookies, the HTTP headers fit into a single packet so this time | 232 // sized cookies, the HTTP headers fit into a single packet so this time |
233 // is basically equivalent. But for some responses, particularly those with | 233 // is basically equivalent. But for some responses, particularly those with |
234 // headers larger than a single packet, this time will be too late. | 234 // headers larger than a single packet, this time will be too late. |
235 ASSERT(timing->receiveHeadersEnd >= 0); | 235 ASSERT(timing->receiveHeadersEnd >= 0); |
236 return resourceLoadTimeRelativeToAbsolute(timing->receiveHeadersEnd); | 236 return resourceLoadTimeRelativeToAbsolute(timing->receiveHeadersEnd); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double
monotonicSeconds) const | 357 unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double
monotonicSeconds) const |
358 { | 358 { |
359 ASSERT(monotonicSeconds >= 0); | 359 ASSERT(monotonicSeconds >= 0); |
360 const DocumentLoadTiming* timing = documentLoadTiming(); | 360 const DocumentLoadTiming* timing = documentLoadTiming(); |
361 ASSERT(timing); | 361 ASSERT(timing); |
362 return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonic
Seconds)); | 362 return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonic
Seconds)); |
363 } | 363 } |
364 | 364 |
365 } // namespace WebCore | 365 } // namespace WebCore |
OLD | NEW |