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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (!pseudoWallTime) | 95 if (!pseudoWallTime) |
96 return 0.0; | 96 return 0.0; |
97 return m_referenceMonotonicTime + pseudoWallTime - m_referenceWallTime; | 97 return m_referenceMonotonicTime + pseudoWallTime - m_referenceWallTime; |
98 } | 98 } |
99 | 99 |
100 void DocumentLoadTiming::markNavigationStart() | 100 void DocumentLoadTiming::markNavigationStart() |
101 { | 101 { |
102 // Allow the embedder to override navigationStart before we record it if | 102 // Allow the embedder to override navigationStart before we record it if |
103 // they have a more accurate timestamp. | 103 // they have a more accurate timestamp. |
104 if (m_navigationStart) { | 104 if (m_navigationStart) { |
105 ASSERT(m_referenceMonotonicTime && m_referenceWallTime); | 105 DCHECK(m_referenceMonotonicTime); |
| 106 DCHECK(m_referenceWallTime); |
106 return; | 107 return; |
107 } | 108 } |
108 ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTi
me); | 109 DCHECK(!m_navigationStart); |
| 110 DCHECK(!m_referenceMonotonicTime); |
| 111 DCHECK(!m_referenceWallTime); |
109 ensureReferenceTimesSet(); | 112 ensureReferenceTimesSet(); |
110 m_navigationStart = m_referenceMonotonicTime; | 113 m_navigationStart = m_referenceMonotonicTime; |
111 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n
avigationStart, "frame", frame()); | 114 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n
avigationStart, "frame", frame()); |
112 notifyDocumentTimingChanged(); | 115 notifyDocumentTimingChanged(); |
113 } | 116 } |
114 | 117 |
115 void DocumentLoadTiming::setNavigationStart(double navigationStart) | 118 void DocumentLoadTiming::setNavigationStart(double navigationStart) |
116 { | 119 { |
117 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent | 120 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent |
118 // navigationStart. We must set these to the current time if they haven't | 121 // navigationStart. We must set these to the current time if they haven't |
119 // been set yet in order to have a valid reference time in both units. | 122 // been set yet in order to have a valid reference time in both units. |
120 ensureReferenceTimesSet(); | 123 ensureReferenceTimesSet(); |
121 m_navigationStart = navigationStart; | 124 m_navigationStart = navigationStart; |
122 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n
avigationStart, "frame", frame()); | 125 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n
avigationStart, "frame", frame()); |
123 | 126 |
124 // The reference times are adjusted based on the embedder's navigationStart. | 127 // The reference times are adjusted based on the embedder's navigationStart. |
125 ASSERT(m_referenceMonotonicTime && m_referenceWallTime); | 128 DCHECK(m_referenceMonotonicTime); |
| 129 DCHECK(m_referenceWallTime); |
126 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); | 130 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); |
127 m_referenceMonotonicTime = navigationStart; | 131 m_referenceMonotonicTime = navigationStart; |
128 notifyDocumentTimingChanged(); | 132 notifyDocumentTimingChanged(); |
129 } | 133 } |
130 | 134 |
131 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red
irectedUrl) | 135 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red
irectedUrl) |
132 { | 136 { |
133 m_redirectCount++; | 137 m_redirectCount++; |
134 if (!m_redirectStart) { | 138 if (!m_redirectStart) { |
135 setRedirectStart(m_fetchStart); | 139 setRedirectStart(m_fetchStart); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 208 } |
205 | 209 |
206 void DocumentLoadTiming::markRedirectEnd() | 210 void DocumentLoadTiming::markRedirectEnd() |
207 { | 211 { |
208 m_redirectEnd = monotonicallyIncreasingTime(); | 212 m_redirectEnd = monotonicallyIncreasingTime(); |
209 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", m_redir
ectEnd, "frame", frame()); | 213 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", m_redir
ectEnd, "frame", frame()); |
210 notifyDocumentTimingChanged(); | 214 notifyDocumentTimingChanged(); |
211 } | 215 } |
212 | 216 |
213 } // namespace blink | 217 } // namespace blink |
OLD | NEW |