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 && m_referenceWallTime); |
106 return; | 106 return; |
107 } | 107 } |
108 ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTi me); | 108 DCHECK(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTi me); |
yhirano
2016/09/12 04:33:12
How about having three DCHECKs?
hiroshige
2016/09/13 08:43:19
Done.
| |
109 ensureReferenceTimesSet(); | 109 ensureReferenceTimesSet(); |
110 m_navigationStart = m_referenceMonotonicTime; | 110 m_navigationStart = m_referenceMonotonicTime; |
111 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n avigationStart, "frame", frame()); | 111 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n avigationStart, "frame", frame()); |
112 notifyDocumentTimingChanged(); | 112 notifyDocumentTimingChanged(); |
113 } | 113 } |
114 | 114 |
115 void DocumentLoadTiming::setNavigationStart(double navigationStart) | 115 void DocumentLoadTiming::setNavigationStart(double navigationStart) |
116 { | 116 { |
117 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent | 117 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent |
118 // navigationStart. We must set these to the current time if they haven't | 118 // 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. | 119 // been set yet in order to have a valid reference time in both units. |
120 ensureReferenceTimesSet(); | 120 ensureReferenceTimesSet(); |
121 m_navigationStart = navigationStart; | 121 m_navigationStart = navigationStart; |
122 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n avigationStart, "frame", frame()); | 122 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n avigationStart, "frame", frame()); |
123 | 123 |
124 // The reference times are adjusted based on the embedder's navigationStart. | 124 // The reference times are adjusted based on the embedder's navigationStart. |
125 ASSERT(m_referenceMonotonicTime && m_referenceWallTime); | 125 DCHECK(m_referenceMonotonicTime && m_referenceWallTime); |
126 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); | 126 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); |
127 m_referenceMonotonicTime = navigationStart; | 127 m_referenceMonotonicTime = navigationStart; |
128 notifyDocumentTimingChanged(); | 128 notifyDocumentTimingChanged(); |
129 } | 129 } |
130 | 130 |
131 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red irectedUrl) | 131 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red irectedUrl) |
132 { | 132 { |
133 m_redirectCount++; | 133 m_redirectCount++; |
134 if (!m_redirectStart) { | 134 if (!m_redirectStart) { |
135 setRedirectStart(m_fetchStart); | 135 setRedirectStart(m_fetchStart); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 } | 204 } |
205 | 205 |
206 void DocumentLoadTiming::markRedirectEnd() | 206 void DocumentLoadTiming::markRedirectEnd() |
207 { | 207 { |
208 m_redirectEnd = monotonicallyIncreasingTime(); | 208 m_redirectEnd = monotonicallyIncreasingTime(); |
209 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", m_redir ectEnd, "frame", frame()); | 209 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", m_redir ectEnd, "frame", frame()); |
210 notifyDocumentTimingChanged(); | 210 notifyDocumentTimingChanged(); |
211 } | 211 } |
212 | 212 |
213 } // namespace blink | 213 } // namespace blink |
OLD | NEW |