Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoadTiming.cpp

Issue 2341333003: Use chromium trace_event implementation in blink (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (m_navigationStart) { 104 if (m_navigationStart) {
105 DCHECK(m_referenceMonotonicTime); 105 DCHECK(m_referenceMonotonicTime);
106 DCHECK(m_referenceWallTime); 106 DCHECK(m_referenceWallTime);
107 return; 107 return;
108 } 108 }
109 DCHECK(!m_navigationStart); 109 DCHECK(!m_navigationStart);
110 DCHECK(!m_referenceMonotonicTime); 110 DCHECK(!m_referenceMonotonicTime);
111 DCHECK(!m_referenceWallTime); 111 DCHECK(!m_referenceWallTime);
112 ensureReferenceTimesSet(); 112 ensureReferenceTimesSet();
113 m_navigationStart = m_referenceMonotonicTime; 113 m_navigationStart = m_referenceMonotonicTime;
114 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n avigationStart, "frame", frame()); 114 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", Tra ceEvent::toTraceTimestamp(m_navigationStart), "frame", frame());
115 notifyDocumentTimingChanged(); 115 notifyDocumentTimingChanged();
116 } 116 }
117 117
118 void DocumentLoadTiming::setNavigationStart(double navigationStart) 118 void DocumentLoadTiming::setNavigationStart(double navigationStart)
119 { 119 {
120 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent 120 // |m_referenceMonotonicTime| and |m_referenceWallTime| represent
121 // 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
122 // 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.
123 ensureReferenceTimesSet(); 123 ensureReferenceTimesSet();
124 m_navigationStart = navigationStart; 124 m_navigationStart = navigationStart;
125 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", m_n avigationStart, "frame", frame()); 125 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "navigationStart", Tra ceEvent::toTraceTimestamp(m_navigationStart), "frame", frame());
126 126
127 // The reference times are adjusted based on the embedder's navigationStart. 127 // The reference times are adjusted based on the embedder's navigationStart.
128 DCHECK(m_referenceMonotonicTime); 128 DCHECK(m_referenceMonotonicTime);
129 DCHECK(m_referenceWallTime); 129 DCHECK(m_referenceWallTime);
130 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart); 130 m_referenceWallTime = monotonicTimeToPseudoWallTime(navigationStart);
131 m_referenceMonotonicTime = navigationStart; 131 m_referenceMonotonicTime = navigationStart;
132 notifyDocumentTimingChanged(); 132 notifyDocumentTimingChanged();
133 } 133 }
134 134
135 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red irectedUrl) 135 void DocumentLoadTiming::addRedirect(const KURL& redirectingUrl, const KURL& red irectedUrl)
136 { 136 {
137 m_redirectCount++; 137 m_redirectCount++;
138 if (!m_redirectStart) { 138 if (!m_redirectStart) {
139 setRedirectStart(m_fetchStart); 139 setRedirectStart(m_fetchStart);
140 } 140 }
141 markRedirectEnd(); 141 markRedirectEnd();
142 markFetchStart(); 142 markFetchStart();
143 143
144 // Check if the redirected url is allowed to access the redirecting url's ti ming information. 144 // Check if the redirected url is allowed to access the redirecting url's ti ming information.
145 RefPtr<SecurityOrigin> redirectedSecurityOrigin = SecurityOrigin::create(red irectedUrl); 145 RefPtr<SecurityOrigin> redirectedSecurityOrigin = SecurityOrigin::create(red irectedUrl);
146 m_hasCrossOriginRedirect |= !redirectedSecurityOrigin->canRequest(redirectin gUrl); 146 m_hasCrossOriginRedirect |= !redirectedSecurityOrigin->canRequest(redirectin gUrl);
147 } 147 }
148 148
149 void DocumentLoadTiming::setRedirectStart(double redirectStart) 149 void DocumentLoadTiming::setRedirectStart(double redirectStart)
150 { 150 {
151 m_redirectStart = redirectStart; 151 m_redirectStart = redirectStart;
152 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectStart", m_red irectStart, "frame", frame()); 152 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectStart", Trace Event::toTraceTimestamp(m_redirectStart), "frame", frame());
153 notifyDocumentTimingChanged(); 153 notifyDocumentTimingChanged();
154 } 154 }
155 155
156 void DocumentLoadTiming::setRedirectEnd(double redirectEnd) 156 void DocumentLoadTiming::setRedirectEnd(double redirectEnd)
157 { 157 {
158 m_redirectEnd = redirectEnd; 158 m_redirectEnd = redirectEnd;
159 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", m_redir ectEnd, "frame", frame()); 159 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", TraceEv ent::toTraceTimestamp(m_redirectEnd), "frame", frame());
160 notifyDocumentTimingChanged(); 160 notifyDocumentTimingChanged();
161 } 161 }
162 162
163 void DocumentLoadTiming::markUnloadEventStart() 163 void DocumentLoadTiming::markUnloadEventStart()
164 { 164 {
165 m_unloadEventStart = monotonicallyIncreasingTime(); 165 m_unloadEventStart = monotonicallyIncreasingTime();
166 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "unloadEventStart", m_ unloadEventStart, "frame", frame()); 166 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "unloadEventStart", Tr aceEvent::toTraceTimestamp(m_unloadEventStart), "frame", frame());
167 notifyDocumentTimingChanged(); 167 notifyDocumentTimingChanged();
168 } 168 }
169 169
170 void DocumentLoadTiming::markUnloadEventEnd() 170 void DocumentLoadTiming::markUnloadEventEnd()
171 { 171 {
172 m_unloadEventEnd = monotonicallyIncreasingTime(); 172 m_unloadEventEnd = monotonicallyIncreasingTime();
173 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "unloadEventEnd", m_un loadEventEnd, "frame", frame()); 173 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "unloadEventEnd", Trac eEvent::toTraceTimestamp(m_unloadEventEnd), "frame", frame());
174 notifyDocumentTimingChanged(); 174 notifyDocumentTimingChanged();
175 } 175 }
176 176
177 void DocumentLoadTiming::markFetchStart() 177 void DocumentLoadTiming::markFetchStart()
178 { 178 {
179 setFetchStart(monotonicallyIncreasingTime()); 179 setFetchStart(monotonicallyIncreasingTime());
180 } 180 }
181 181
182 void DocumentLoadTiming::setFetchStart(double fetchStart) 182 void DocumentLoadTiming::setFetchStart(double fetchStart)
183 { 183 {
184 m_fetchStart = fetchStart; 184 m_fetchStart = fetchStart;
185 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "fetchStart", m_fetchS tart, "frame", frame()); 185 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "fetchStart", TraceEve nt::toTraceTimestamp(m_fetchStart), "frame", frame());
186 notifyDocumentTimingChanged(); 186 notifyDocumentTimingChanged();
187 } 187 }
188 188
189 void DocumentLoadTiming::setResponseEnd(double responseEnd) 189 void DocumentLoadTiming::setResponseEnd(double responseEnd)
190 { 190 {
191 m_responseEnd = responseEnd; 191 m_responseEnd = responseEnd;
192 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "responseEnd", m_respo nseEnd, "frame", frame()); 192 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "responseEnd", TraceEv ent::toTraceTimestamp(m_responseEnd), "frame", frame());
193 notifyDocumentTimingChanged(); 193 notifyDocumentTimingChanged();
194 } 194 }
195 195
196 void DocumentLoadTiming::markLoadEventStart() 196 void DocumentLoadTiming::markLoadEventStart()
197 { 197 {
198 m_loadEventStart = monotonicallyIncreasingTime(); 198 m_loadEventStart = monotonicallyIncreasingTime();
199 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "loadEventStart", m_lo adEventStart, "frame", frame()); 199 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "loadEventStart", Trac eEvent::toTraceTimestamp(m_loadEventStart), "frame", frame());
200 notifyDocumentTimingChanged(); 200 notifyDocumentTimingChanged();
201 } 201 }
202 202
203 void DocumentLoadTiming::markLoadEventEnd() 203 void DocumentLoadTiming::markLoadEventEnd()
204 { 204 {
205 m_loadEventEnd = monotonicallyIncreasingTime(); 205 m_loadEventEnd = monotonicallyIncreasingTime();
206 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "loadEventEnd", m_load EventEnd, "frame", frame()); 206 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "loadEventEnd", TraceE vent::toTraceTimestamp(m_loadEventEnd), "frame", frame());
207 notifyDocumentTimingChanged(); 207 notifyDocumentTimingChanged();
208 } 208 }
209 209
210 void DocumentLoadTiming::markRedirectEnd() 210 void DocumentLoadTiming::markRedirectEnd()
211 { 211 {
212 m_redirectEnd = monotonicallyIncreasingTime(); 212 m_redirectEnd = monotonicallyIncreasingTime();
213 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", m_redir ectEnd, "frame", frame()); 213 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", TraceEv ent::toTraceTimestamp(m_redirectEnd), "frame", frame());
214 notifyDocumentTimingChanged(); 214 notifyDocumentTimingChanged();
215 } 215 }
216 216
217 } // namespace blink 217 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698