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

Side by Side Diff: Source/core/page/PerformanceResourceTiming.cpp

Issue 15265004: Fix ResourceLoadTiming resolution lose issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 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
« no previous file with comments | « Source/core/page/PerformanceResourceTiming.h ('k') | Source/core/page/PerformanceTiming.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 { 113 {
114 // FIXME: This should be different depending on redirects. 114 // FIXME: This should be different depending on redirects.
115 return (startTime()); 115 return (startTime());
116 } 116 }
117 117
118 double PerformanceResourceTiming::domainLookupStart() const 118 double PerformanceResourceTiming::domainLookupStart() const
119 { 119 {
120 if (!m_shouldReportDetails) 120 if (!m_shouldReportDetails)
121 return 0.0; 121 return 0.0;
122 122
123 if (!m_timing || m_timing->dnsStart < 0) 123 if (!m_timing || m_timing->dnsStart == 0.0)
eustas 2013/05/21 09:43:38 Doesn't both checks do the same?
Pan 2013/05/21 12:28:01 not really, sometimes it's null ptr when glue won'
124 return fetchStart(); 124 return fetchStart();
125 125
126 return resourceTimeToDocumentMilliseconds(m_timing->dnsStart); 126 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->dnsStart);
127 } 127 }
128 128
129 double PerformanceResourceTiming::domainLookupEnd() const 129 double PerformanceResourceTiming::domainLookupEnd() const
130 { 130 {
131 if (!m_shouldReportDetails) 131 if (!m_shouldReportDetails)
132 return 0.0; 132 return 0.0;
133 133
134 if (!m_timing || m_timing->dnsEnd < 0) 134 if (!m_timing || m_timing->dnsEnd == 0.0)
135 return domainLookupStart(); 135 return domainLookupStart();
136 136
137 return resourceTimeToDocumentMilliseconds(m_timing->dnsEnd); 137 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->dnsEnd);
138 } 138 }
139 139
140 double PerformanceResourceTiming::connectStart() const 140 double PerformanceResourceTiming::connectStart() const
141 { 141 {
142 if (!m_shouldReportDetails) 142 if (!m_shouldReportDetails)
143 return 0.0; 143 return 0.0;
144 144
145 // connectStart will be -1 when a network request is not made. 145 // connectStart will be zero when a network request is not made.
146 if (!m_timing || m_timing->connectStart < 0 || m_didReuseConnection) 146 if (!m_timing || m_timing->connectStart == 0.0 || m_didReuseConnection)
147 return domainLookupEnd(); 147 return domainLookupEnd();
148 148
149 // connectStart includes any DNS time, so we may need to trim that off. 149 // connectStart includes any DNS time, so we may need to trim that off.
150 int connectStart = m_timing->connectStart; 150 int connectStart = m_timing->connectStart;
151 if (m_timing->dnsEnd >= 0) 151 if (m_timing->dnsEnd >= 0)
152 connectStart = m_timing->dnsEnd; 152 connectStart = m_timing->dnsEnd;
153 153
154 return resourceTimeToDocumentMilliseconds(connectStart); 154 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), conne ctStart);
155 } 155 }
156 156
157 double PerformanceResourceTiming::connectEnd() const 157 double PerformanceResourceTiming::connectEnd() const
158 { 158 {
159 if (!m_shouldReportDetails) 159 if (!m_shouldReportDetails)
160 return 0.0; 160 return 0.0;
161 161
162 // connectStart will be -1 when a network request is not made. 162 // connectStart will be zero when a network request is not made.
163 if (!m_timing || m_timing->connectEnd < 0 || m_didReuseConnection) 163 if (!m_timing || m_timing->connectEnd == 0.0 || m_didReuseConnection)
164 return connectStart(); 164 return connectStart();
165 165
166 return resourceTimeToDocumentMilliseconds(m_timing->connectEnd); 166 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->connectEnd);
167 } 167 }
168 168
169 double PerformanceResourceTiming::secureConnectionStart() const 169 double PerformanceResourceTiming::secureConnectionStart() const
170 { 170 {
171 if (!m_shouldReportDetails) 171 if (!m_shouldReportDetails)
172 return 0.0; 172 return 0.0;
173 173
174 if (!m_timing || m_timing->sslStart < 0) // Secure connection not negotiated . 174 if (!m_timing || m_timing->sslStart == 0.0) // Secure connection not negotia ted.
175 return 0.0; 175 return 0.0;
176 176
177 return resourceTimeToDocumentMilliseconds(m_timing->sslStart); 177 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->sslStart);
178 } 178 }
179 179
180 double PerformanceResourceTiming::requestStart() const 180 double PerformanceResourceTiming::requestStart() const
181 { 181 {
182 if (!m_shouldReportDetails) 182 if (!m_shouldReportDetails)
183 return 0.0; 183 return 0.0;
184 184
185 if (!m_timing) 185 if (!m_timing)
186 return connectEnd(); 186 return connectEnd();
187 187
188 return resourceTimeToDocumentMilliseconds(m_timing->sendStart); 188 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->sendStart);
189 } 189 }
190 190
191 double PerformanceResourceTiming::responseStart() const 191 double PerformanceResourceTiming::responseStart() const
192 { 192 {
193 if (!m_shouldReportDetails) 193 if (!m_shouldReportDetails)
194 return 0.0; 194 return 0.0;
195 195
196 if (!m_timing) 196 if (!m_timing)
197 return requestStart(); 197 return requestStart();
198 // FIXME: This number isn't exactly correct. See the notes in PerformanceTim ing::responseStart(). 198 // FIXME: This number isn't exactly correct. See the notes in PerformanceTim ing::responseStart().
199 return resourceTimeToDocumentMilliseconds(m_timing->receiveHeadersEnd); 199 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->receiveHeadersEnd);
200 } 200 }
201 201
202 double PerformanceResourceTiming::responseEnd() const 202 double PerformanceResourceTiming::responseEnd() const
203 { 203 {
204 if (!m_finishTime) 204 if (!m_finishTime)
205 return responseStart(); 205 return responseStart();
206 206
207 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_fin ishTime); 207 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_fin ishTime);
208 } 208 }
209 209
210 double PerformanceResourceTiming::resourceTimeToDocumentMilliseconds(int deltaMi lliseconds) const
211 {
212 ASSERT(deltaMilliseconds >= 0);
213 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_tim ing->requestTime) + deltaMilliseconds;
214 }
215
216 } // namespace WebCore 210 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/PerformanceResourceTiming.h ('k') | Source/core/page/PerformanceTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698