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 21 matching lines...) Expand all Loading... |
32 #include "config.h" | 32 #include "config.h" |
33 #include "core/timing/PerformanceResourceTiming.h" | 33 #include "core/timing/PerformanceResourceTiming.h" |
34 | 34 |
35 #include "core/timing/PerformanceBase.h" | 35 #include "core/timing/PerformanceBase.h" |
36 #include "platform/network/ResourceRequest.h" | 36 #include "platform/network/ResourceRequest.h" |
37 #include "platform/network/ResourceResponse.h" | 37 #include "platform/network/ResourceResponse.h" |
38 #include "platform/network/ResourceTimingInfo.h" | 38 #include "platform/network/ResourceTimingInfo.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
| 42 // TODO(majidvp): Should return DOMHighResTimeStamp type instead |
42 static double monotonicTimeToDOMHighResTimeStamp(double timeOrigin, double secon
ds) | 43 static double monotonicTimeToDOMHighResTimeStamp(double timeOrigin, double secon
ds) |
43 { | 44 { |
44 ASSERT(seconds >= 0.0); | 45 ASSERT(seconds >= 0.0); |
45 if (!seconds || !timeOrigin) | 46 if (!seconds || !timeOrigin) |
46 return 0.0; | 47 return 0.0; |
47 return PerformanceBase::clampTimeResolution(seconds - timeOrigin) * 1000.0; | 48 return PerformanceBase::clampTimeResolution(seconds - timeOrigin) * 1000.0; |
48 } | 49 } |
49 | 50 |
50 PerformanceResourceTiming::PerformanceResourceTiming(const ResourceTimingInfo& i
nfo, double timeOrigin, double startTime, double lastRedirectEndTime, bool allow
TimingDetails, bool allowRedirectDetails) | 51 PerformanceResourceTiming::PerformanceResourceTiming(const ResourceTimingInfo& i
nfo, double timeOrigin, double startTime, double lastRedirectEndTime, bool allow
TimingDetails, bool allowRedirectDetails) |
51 : PerformanceEntry(info.initialRequest().url().string(), "resource", monoton
icTimeToDOMHighResTimeStamp(timeOrigin, startTime), monotonicTimeToDOMHighResTim
eStamp(timeOrigin, info.loadFinishTime())) | 52 : PerformanceEntry(info.initialRequest().url().string(), "resource", monoton
icTimeToDOMHighResTimeStamp(timeOrigin, startTime), monotonicTimeToDOMHighResTim
eStamp(timeOrigin, info.loadFinishTime())) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 207 |
207 double PerformanceResourceTiming::responseEnd() const | 208 double PerformanceResourceTiming::responseEnd() const |
208 { | 209 { |
209 if (!m_finishTime) | 210 if (!m_finishTime) |
210 return responseStart(); | 211 return responseStart(); |
211 | 212 |
212 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_finishTime); | 213 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_finishTime); |
213 } | 214 } |
214 | 215 |
215 } // namespace blink | 216 } // namespace blink |
OLD | NEW |