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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 double DocumentLoadTiming::pseudoWallTimeToMonotonicTime(double pseudoWallTime)
const | 81 double DocumentLoadTiming::pseudoWallTimeToMonotonicTime(double pseudoWallTime)
const |
82 { | 82 { |
83 if (!pseudoWallTime) | 83 if (!pseudoWallTime) |
84 return 0.0; | 84 return 0.0; |
85 return m_referenceMonotonicTime + pseudoWallTime - m_referenceWallTime; | 85 return m_referenceMonotonicTime + pseudoWallTime - m_referenceWallTime; |
86 } | 86 } |
87 | 87 |
88 void DocumentLoadTiming::markNavigationStart() | 88 void DocumentLoadTiming::markNavigationStart() |
89 { | 89 { |
90 // Allow the embedder to override navigationStart before we record it if | |
91 // they have a more accurate timestamp. | |
92 if (m_navigationStart) { | |
93 ASSERT(m_referenceMonotonicTime && m_referenceWallTime); | |
94 return; | |
95 } | |
96 TRACE_EVENT_MARK("blink.user_timing", "navigationStart"); | 90 TRACE_EVENT_MARK("blink.user_timing", "navigationStart"); |
97 ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTi
me); | 91 ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTi
me); |
98 | 92 |
99 m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime()
; | 93 m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime()
; |
100 m_referenceWallTime = currentTime(); | 94 m_referenceWallTime = currentTime(); |
101 notifyDocumentTimingChanged(); | 95 notifyDocumentTimingChanged(); |
102 } | 96 } |
103 | 97 |
104 void DocumentLoadTiming::setNavigationStart(double navigationStart) | 98 void DocumentLoadTiming::setNavigationStart(double navigationStart) |
105 { | 99 { |
106 TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "navigationStart", navi
gationStart); | 100 TRACE_EVENT_MARK_WITH_TIMESTAMP("blink.user_timing", "navigationStart", navi
gationStart); |
| 101 ASSERT(m_referenceMonotonicTime && m_referenceWallTime); |
107 m_navigationStart = navigationStart; | 102 m_navigationStart = navigationStart; |
108 | 103 |
109 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent | 104 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent |
110 // navigationStart. When the embedder sets navigationStart (because the | 105 // navigationStart. When the embedder sets navigationStart (because the |
111 // navigation started earlied on the browser side), we need to adjust these | 106 // navigation started earlied on the browser side), we need to adjust these |
112 // as well. | 107 // as well. |
113 if (!m_referenceWallTime) | 108 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); |
114 m_referenceWallTime = currentTime(); | |
115 else | |
116 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); | |
117 m_referenceMonotonicTime = navigationStart; | 109 m_referenceMonotonicTime = navigationStart; |
118 notifyDocumentTimingChanged(); | 110 notifyDocumentTimingChanged(); |
119 } | 111 } |
120 | 112 |
121 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red
irectedUrl) | 113 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red
irectedUrl) |
122 { | 114 { |
123 m_redirectCount++; | 115 m_redirectCount++; |
124 if (!m_redirectStart) { | 116 if (!m_redirectStart) { |
125 setRedirectStart(m_fetchStart); | 117 setRedirectStart(m_fetchStart); |
126 } | 118 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 174 } |
183 | 175 |
184 void DocumentLoadTiming::markRedirectEnd() | 176 void DocumentLoadTiming::markRedirectEnd() |
185 { | 177 { |
186 TRACE_EVENT_MARK("blink.user_timing", "redirectEnd"); | 178 TRACE_EVENT_MARK("blink.user_timing", "redirectEnd"); |
187 m_redirectEnd = monotonicallyIncreasingTime(); | 179 m_redirectEnd = monotonicallyIncreasingTime(); |
188 notifyDocumentTimingChanged(); | 180 notifyDocumentTimingChanged(); |
189 } | 181 } |
190 | 182 |
191 } // namespace blink | 183 } // namespace blink |
OLD | NEW |