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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceTiming.cpp

Issue 2393013002: reflow comments in core/{clipboard,streams,testing,timing} (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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 | « third_party/WebKit/Source/core/timing/PerformanceTest.cpp ('k') | no next file » | 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return 0; 119 return 0;
120 120
121 return monotonicTimeToIntegerMilliseconds(timing->fetchStart()); 121 return monotonicTimeToIntegerMilliseconds(timing->fetchStart());
122 } 122 }
123 123
124 unsigned long long PerformanceTiming::domainLookupStart() const { 124 unsigned long long PerformanceTiming::domainLookupStart() const {
125 ResourceLoadTiming* timing = resourceLoadTiming(); 125 ResourceLoadTiming* timing = resourceLoadTiming();
126 if (!timing) 126 if (!timing)
127 return fetchStart(); 127 return fetchStart();
128 128
129 // This will be zero when a DNS request is not performed. 129 // This will be zero when a DNS request is not performed. Rather than
130 // Rather than exposing a special value that indicates no DNS, we "backfill" w ith fetchStart. 130 // exposing a special value that indicates no DNS, we "backfill" with
131 // fetchStart.
131 double dnsStart = timing->dnsStart(); 132 double dnsStart = timing->dnsStart();
132 if (dnsStart == 0.0) 133 if (dnsStart == 0.0)
133 return fetchStart(); 134 return fetchStart();
134 135
135 return monotonicTimeToIntegerMilliseconds(dnsStart); 136 return monotonicTimeToIntegerMilliseconds(dnsStart);
136 } 137 }
137 138
138 unsigned long long PerformanceTiming::domainLookupEnd() const { 139 unsigned long long PerformanceTiming::domainLookupEnd() const {
139 ResourceLoadTiming* timing = resourceLoadTiming(); 140 ResourceLoadTiming* timing = resourceLoadTiming();
140 if (!timing) 141 if (!timing)
141 return domainLookupStart(); 142 return domainLookupStart();
142 143
143 // This will be zero when a DNS request is not performed. 144 // This will be zero when a DNS request is not performed. Rather than
144 // Rather than exposing a special value that indicates no DNS, we "backfill" w ith domainLookupStart. 145 // exposing a special value that indicates no DNS, we "backfill" with
146 // domainLookupStart.
145 double dnsEnd = timing->dnsEnd(); 147 double dnsEnd = timing->dnsEnd();
146 if (dnsEnd == 0.0) 148 if (dnsEnd == 0.0)
147 return domainLookupStart(); 149 return domainLookupStart();
148 150
149 return monotonicTimeToIntegerMilliseconds(dnsEnd); 151 return monotonicTimeToIntegerMilliseconds(dnsEnd);
150 } 152 }
151 153
152 unsigned long long PerformanceTiming::connectStart() const { 154 unsigned long long PerformanceTiming::connectStart() const {
153 DocumentLoader* loader = documentLoader(); 155 DocumentLoader* loader = documentLoader();
154 if (!loader) 156 if (!loader)
155 return domainLookupEnd(); 157 return domainLookupEnd();
156 158
157 ResourceLoadTiming* timing = loader->response().resourceLoadTiming(); 159 ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
158 if (!timing) 160 if (!timing)
159 return domainLookupEnd(); 161 return domainLookupEnd();
160 162
161 // connectStart will be zero when a network request is not made. 163 // connectStart will be zero when a network request is not made. Rather than
162 // Rather than exposing a special value that indicates no new connection, we " backfill" with domainLookupEnd. 164 // exposing a special value that indicates no new connection, we "backfill"
165 // with domainLookupEnd.
163 double connectStart = timing->connectStart(); 166 double connectStart = timing->connectStart();
164 if (connectStart == 0.0 || loader->response().connectionReused()) 167 if (connectStart == 0.0 || loader->response().connectionReused())
165 return domainLookupEnd(); 168 return domainLookupEnd();
166 169
167 // ResourceLoadTiming's connect phase includes DNS, however Navigation Timing' s 170 // ResourceLoadTiming's connect phase includes DNS, however Navigation
168 // connect phase should not. So if there is DNS time, trim it from the start. 171 // Timing's connect phase should not. So if there is DNS time, trim it from
172 // the start.
169 if (timing->dnsEnd() > 0.0 && timing->dnsEnd() > connectStart) 173 if (timing->dnsEnd() > 0.0 && timing->dnsEnd() > connectStart)
170 connectStart = timing->dnsEnd(); 174 connectStart = timing->dnsEnd();
171 175
172 return monotonicTimeToIntegerMilliseconds(connectStart); 176 return monotonicTimeToIntegerMilliseconds(connectStart);
173 } 177 }
174 178
175 unsigned long long PerformanceTiming::connectEnd() const { 179 unsigned long long PerformanceTiming::connectEnd() const {
176 DocumentLoader* loader = documentLoader(); 180 DocumentLoader* loader = documentLoader();
177 if (!loader) 181 if (!loader)
178 return connectStart(); 182 return connectStart();
179 183
180 ResourceLoadTiming* timing = loader->response().resourceLoadTiming(); 184 ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
181 if (!timing) 185 if (!timing)
182 return connectStart(); 186 return connectStart();
183 187
184 // connectEnd will be zero when a network request is not made. 188 // connectEnd will be zero when a network request is not made. Rather than
185 // Rather than exposing a special value that indicates no new connection, we " backfill" with connectStart. 189 // exposing a special value that indicates no new connection, we "backfill"
190 // with connectStart.
186 double connectEnd = timing->connectEnd(); 191 double connectEnd = timing->connectEnd();
187 if (connectEnd == 0.0 || loader->response().connectionReused()) 192 if (connectEnd == 0.0 || loader->response().connectionReused())
188 return connectStart(); 193 return connectStart();
189 194
190 return monotonicTimeToIntegerMilliseconds(connectEnd); 195 return monotonicTimeToIntegerMilliseconds(connectEnd);
191 } 196 }
192 197
193 unsigned long long PerformanceTiming::secureConnectionStart() const { 198 unsigned long long PerformanceTiming::secureConnectionStart() const {
194 DocumentLoader* loader = documentLoader(); 199 DocumentLoader* loader = documentLoader();
195 if (!loader) 200 if (!loader)
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 504
500 return timing->pseudoWallTimeToMonotonicTime( 505 return timing->pseudoWallTimeToMonotonicTime(
501 toDoubleSeconds(integerMilliseconds)); 506 toDoubleSeconds(integerMilliseconds));
502 } 507 }
503 508
504 DEFINE_TRACE(PerformanceTiming) { 509 DEFINE_TRACE(PerformanceTiming) {
505 DOMWindowProperty::trace(visitor); 510 DOMWindowProperty::trace(visitor);
506 } 511 }
507 512
508 } // namespace blink 513 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698