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

Side by Side Diff: Source/devtools/front_end/network/RequestTimingView.js

Issue 515583005: Add ServiceWorker timing information on the popup panel in DevTools's Network tab (1/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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) 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 return undefined; 131 return undefined;
132 } 132 }
133 133
134 var timing = request.timing; 134 var timing = request.timing;
135 var blocking = firstPositive([timing.dnsStart, timing.connectStart, timing.s endStart]); 135 var blocking = firstPositive([timing.dnsStart, timing.connectStart, timing.s endStart]);
136 var endTime = firstPositive([request.endTime, request.responseReceivedTime, timing.requestTime]); 136 var endTime = firstPositive([request.endTime, request.responseReceivedTime, timing.requestTime]);
137 var total = (endTime - timing.requestTime) * 1000; 137 var total = (endTime - timing.requestTime) * 1000;
138 const chartWidth = 200; 138 const chartWidth = 200;
139 var scale = chartWidth / total; 139 var scale = chartWidth / total;
140 var createCommunicationTimingTable = function() {
141 if (blocking > 0)
142 addRow(WebInspector.UIString("Stalled"), "blocking", 0, blocking);
140 143
141 if (blocking > 0) 144 if (timing.proxyStart !== -1)
142 addRow(WebInspector.UIString("Stalled"), "blocking", 0, blocking); 145 addRow(WebInspector.UIString("Proxy negotiation"), "proxy", timing.p roxyStart, timing.proxyEnd);
143 146
144 if (timing.proxyStart !== -1) 147 if (timing.dnsStart !== -1)
145 addRow(WebInspector.UIString("Proxy negotiation"), "proxy", timing.proxy Start, timing.proxyEnd); 148 addRow(WebInspector.UIString("DNS Lookup"), "dns", timing.dnsStart, timing.dnsEnd);
146 149
147 if (timing.dnsStart !== -1) 150 if (timing.connectStart !== -1)
148 addRow(WebInspector.UIString("DNS Lookup"), "dns", timing.dnsStart, timi ng.dnsEnd); 151 addRow(WebInspector.UIString("Initial connection"), "connecting", ti ming.connectStart, timing.connectEnd);
149 152
150 if (timing.connectStart !== -1) 153 if (timing.sslStart !== -1)
151 addRow(WebInspector.UIString("Initial connection"), "connecting", timing .connectStart, timing.connectEnd); 154 addRow(WebInspector.UIString("SSL"), "ssl", timing.sslStart, timing. sslEnd);
152 155
153 if (timing.sslStart !== -1) 156 addRow(WebInspector.UIString("Request sent"), "sending", timing.sendStar t, timing.sendEnd);
154 addRow(WebInspector.UIString("SSL"), "ssl", timing.sslStart, timing.sslE nd); 157 addRow(WebInspector.UIString("Waiting (TTFB)"), "waiting", timing.sendEn d, timing.receiveHeadersEnd);
155 158
156 addRow(WebInspector.UIString("Request sent"), "sending", timing.sendStart, t iming.sendEnd); 159 if (request.endTime !== -1)
157 addRow(WebInspector.UIString("Waiting (TTFB)"), "waiting", timing.sendEnd, t iming.receiveHeadersEnd); 160 addRow(WebInspector.UIString("Content Download"), "receiving", (requ est.responseReceivedTime - timing.requestTime) * 1000, total);
158 161
159 if (request.endTime !== -1) 162 if (!request.finished) {
160 addRow(WebInspector.UIString("Content Download"), "receiving", (request. responseReceivedTime - timing.requestTime) * 1000, total); 163 var cell = tableElement.createChild("tr").createChild("td", "caution ");
164 cell.colSpan = 2;
165 cell.createTextChild(WebInspector.UIString("CAUTION: request is not finished yet!"));
166 }
167 };
168 var createServiceWorkerTimingTable = function() {
169 addRow(WebInspector.UIString("Stalled"), "blocking", 0, timing.fetchStar t);
161 170
162 if (!request.finished) { 171 addRow(WebInspector.UIString("Request to ServiceWorker"), "connecting", timing.fetchStart, timing.fetchEnd);
163 var cell = tableElement.createChild("tr").createChild("td", "caution"); 172 addRow(WebInspector.UIString("Launching ServiceWorker"), "ssl", timing.f etchStart, timing.launchServiceWorker);
164 cell.colSpan = 2; 173 addRow(WebInspector.UIString("Waiting (TTFB)"), "waiting", timing.fetchE nd, timing.receiveHeadersEnd);
165 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini shed yet!")); 174
166 } 175 if (request.endTime !== -1)
176 addRow(WebInspector.UIString("Content Download"), "receiving", (requ est.responseReceivedTime - timing.requestTime) * 1000, total);
177
178 if (!request.finished) {
179 var cell = tableElement.createChild("tr").createChild("td", "caution ");
180 cell.colSpan = 2;
181 cell.createTextChild(WebInspector.UIString("CAUTION: request is not finished yet!"));
182 }
183 };
184
185 if (request.fetchedViaServiceWorker)
186 createServiceWorkerTimingTable();
eustas 2014/08/28 06:23:30 Please inline create###TimingTable()
shimazu 2014/08/28 07:11:19 Sure, but I think this is more readable and extens
eustas 2014/08/28 07:32:01 We have no strict rules, but ve do not use var-fun
pfeldman 2014/08/28 07:35:04 We do have a strict rule to not use anonymous func
shimazu 2014/08/29 02:00:46 Done.
187 else
188 createCommunicationTimingTable();
167 189
168 return tableElement; 190 return tableElement;
169 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698