| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 , m_unloadEventStart(0.0) | 37 , m_unloadEventStart(0.0) |
| 38 , m_unloadEventEnd(0.0) | 38 , m_unloadEventEnd(0.0) |
| 39 , m_fetchStart(0.0) | 39 , m_fetchStart(0.0) |
| 40 , m_responseEnd(0.0) | 40 , m_responseEnd(0.0) |
| 41 , m_loadEventStart(0.0) | 41 , m_loadEventStart(0.0) |
| 42 , m_loadEventEnd(0.0) | 42 , m_loadEventEnd(0.0) |
| 43 , m_hasSameOriginAsPreviousDocument(false) | 43 , m_hasSameOriginAsPreviousDocument(false) |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 double DocumentLoadTiming::monotonicTimeToZeroBasedDocumentTime(double monotonic
Time) const | |
| 48 { | |
| 49 if (!monotonicTime) | |
| 50 return 0.0; | |
| 51 return monotonicTime - m_referenceMonotonicTime; | |
| 52 } | |
| 53 | |
| 54 double DocumentLoadTiming::monotonicTimeToPseudoWallTime(double monotonicTime) c
onst | 47 double DocumentLoadTiming::monotonicTimeToPseudoWallTime(double monotonicTime) c
onst |
| 55 { | 48 { |
| 56 if (!monotonicTime) | 49 if (!monotonicTime) |
| 57 return 0.0; | 50 return 0.0; |
| 58 return m_referenceWallTime + monotonicTime - m_referenceMonotonicTime; | 51 return m_referenceWallTime + monotonicTime - m_referenceMonotonicTime; |
| 59 } | 52 } |
| 60 | 53 |
| 61 void DocumentLoadTiming::markNavigationStart() | 54 void DocumentLoadTiming::markNavigationStart() |
| 62 { | 55 { |
| 63 ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTi
me); | 56 ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTi
me); |
| 64 | 57 |
| 65 m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime()
; | 58 m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime()
; |
| 66 m_referenceWallTime = currentTime(); | 59 m_referenceWallTime = currentTime(); |
| 67 } | 60 } |
| 68 | 61 |
| 69 void DocumentLoadTiming::setNavigationStart(double navigationStart) | 62 void DocumentLoadTiming::setNavigationStart(double navigationStart) |
| 70 { | 63 { |
| 71 ASSERT(m_referenceMonotonicTime && m_referenceWallTime); | 64 ASSERT(m_referenceMonotonicTime && m_referenceWallTime); |
| 72 m_navigationStart = navigationStart; | 65 m_navigationStart = navigationStart; |
| 73 | 66 |
| 74 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent | 67 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent |
| 75 // navigationStart. When the embedder sets navigationStart (because the | 68 // navigationStart. When the embedder sets navigationStart (because the |
| 76 // navigation started earlied on the browser side), we need to adjust these | 69 // navigation started earlied on the browser side), we need to adjust these |
| 77 // as well. | 70 // as well. |
| 78 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); | 71 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); |
| 79 m_referenceMonotonicTime = navigationStart; | 72 m_referenceMonotonicTime = navigationStart; |
| 80 } | 73 } |
| 81 | 74 |
| 82 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |