Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 */ | 124 */ |
| 125 function firstPositive(numbers) | 125 function firstPositive(numbers) |
| 126 { | 126 { |
| 127 for (var i = 0; i < numbers.length; ++i) { | 127 for (var i = 0; i < numbers.length; ++i) { |
| 128 if (numbers[i] > 0) | 128 if (numbers[i] > 0) |
| 129 return numbers[i]; | 129 return numbers[i]; |
| 130 } | 130 } |
| 131 return undefined; | 131 return undefined; |
| 132 } | 132 } |
| 133 | 133 |
| 134 function createCommunicationTimingTable() | |
| 135 { | |
| 136 if (blocking > 0) | |
| 137 addRow(WebInspector.UIString("Stalled"), "blocking", 0, blocking); | |
| 138 | |
| 139 if (timing.proxyStart !== -1) | |
| 140 addRow(WebInspector.UIString("Proxy negotiation"), "proxy", timing.p roxyStart, timing.proxyEnd); | |
| 141 | |
| 142 if (timing.dnsStart !== -1) | |
| 143 addRow(WebInspector.UIString("DNS Lookup"), "dns", timing.dnsStart, timing.dnsEnd); | |
| 144 | |
| 145 if (timing.connectStart !== -1) | |
| 146 addRow(WebInspector.UIString("Initial connection"), "connecting", ti ming.connectStart, timing.connectEnd); | |
| 147 | |
| 148 if (timing.sslStart !== -1) | |
| 149 addRow(WebInspector.UIString("SSL"), "ssl", timing.sslStart, timing. sslEnd); | |
| 150 | |
| 151 addRow(WebInspector.UIString("Request sent"), "sending", timing.sendStar t, timing.sendEnd); | |
| 152 addRow(WebInspector.UIString("Waiting (TTFB)"), "waiting", timing.sendEn d, timing.receiveHeadersEnd); | |
| 153 | |
| 154 if (request.endTime !== -1) | |
| 155 addRow(WebInspector.UIString("Content Download"), "receiving", (requ est.responseReceivedTime - timing.requestTime) * 1000, total); | |
| 156 | |
| 157 if (!request.finished) { | |
| 158 var cell = tableElement.createChild("tr").createChild("td", "caution "); | |
| 159 cell.colSpan = 2; | |
| 160 cell.createTextChild(WebInspector.UIString("CAUTION: request is not finished yet!")); | |
| 161 } | |
| 162 } | |
| 163 | |
| 164 function createServiceWorkerTimingTable() | |
| 165 { | |
| 166 addRow(WebInspector.UIString("Stalled"), "blocking", 0, timing.serviceWo rkerFetchStart); | |
| 167 | |
| 168 addRow(WebInspector.UIString("Request to ServiceWorker"), "connecting", timing.serviceWorkerFetchStart, timing.serviceWorkerFetchEnd); | |
| 169 addRow(WebInspector.UIString("Launching ServiceWorker"), "ssl", timing.s erviceWorkerFetchStart, timing.serviceWorkerFetchReady); | |
|
horo
2014/08/29 04:33:22
- I think "Launching" is not appropriate. "Waiting
shimazu
2014/08/29 07:28:40
Done.
I think "ServiceWorker Perparation" is much
horo
2014/08/29 08:09:56
Sounds good.
| |
| 170 addRow(WebInspector.UIString("Waiting (TTFB)"), "waiting", timing.servic eWorkerFetchEnd, timing.receiveHeadersEnd); | |
| 171 | |
| 172 if (request.endTime !== -1) | |
| 173 addRow(WebInspector.UIString("Content Download"), "receiving", (requ est.responseReceivedTime - timing.requestTime) * 1000, total); | |
| 174 | |
| 175 if (!request.finished) { | |
| 176 var cell = tableElement.createChild("tr").createChild("td", "caution "); | |
| 177 cell.colSpan = 2; | |
| 178 cell.createTextChild(WebInspector.UIString("CAUTION: request is not finished yet!")); | |
| 179 } | |
| 180 } | |
| 181 | |
| 134 var timing = request.timing; | 182 var timing = request.timing; |
| 135 var blocking = firstPositive([timing.dnsStart, timing.connectStart, timing.s endStart]); | 183 var blocking = firstPositive([timing.dnsStart, timing.connectStart, timing.s endStart]); |
| 136 var endTime = firstPositive([request.endTime, request.responseReceivedTime, timing.requestTime]); | 184 var endTime = firstPositive([request.endTime, request.responseReceivedTime, timing.requestTime]); |
| 137 var total = (endTime - timing.requestTime) * 1000; | 185 var total = (endTime - timing.requestTime) * 1000; |
| 138 const chartWidth = 200; | 186 const chartWidth = 200; |
| 139 var scale = chartWidth / total; | 187 var scale = chartWidth / total; |
| 140 | 188 |
| 141 if (blocking > 0) | 189 if (request.fetchedViaServiceWorker) |
| 142 addRow(WebInspector.UIString("Stalled"), "blocking", 0, blocking); | 190 createServiceWorkerTimingTable(); |
| 143 | 191 else |
| 144 if (timing.proxyStart !== -1) | 192 createCommunicationTimingTable(); |
| 145 addRow(WebInspector.UIString("Proxy negotiation"), "proxy", timing.proxy Start, timing.proxyEnd); | |
| 146 | |
| 147 if (timing.dnsStart !== -1) | |
| 148 addRow(WebInspector.UIString("DNS Lookup"), "dns", timing.dnsStart, timi ng.dnsEnd); | |
| 149 | |
| 150 if (timing.connectStart !== -1) | |
| 151 addRow(WebInspector.UIString("Initial connection"), "connecting", timing .connectStart, timing.connectEnd); | |
| 152 | |
| 153 if (timing.sslStart !== -1) | |
| 154 addRow(WebInspector.UIString("SSL"), "ssl", timing.sslStart, timing.sslE nd); | |
| 155 | |
| 156 addRow(WebInspector.UIString("Request sent"), "sending", timing.sendStart, t iming.sendEnd); | |
| 157 addRow(WebInspector.UIString("Waiting (TTFB)"), "waiting", timing.sendEnd, t iming.receiveHeadersEnd); | |
| 158 | |
| 159 if (request.endTime !== -1) | |
| 160 addRow(WebInspector.UIString("Content Download"), "receiving", (request. responseReceivedTime - timing.requestTime) * 1000, total); | |
| 161 | |
| 162 if (!request.finished) { | |
| 163 var cell = tableElement.createChild("tr").createChild("td", "caution"); | |
| 164 cell.colSpan = 2; | |
| 165 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini shed yet!")); | |
| 166 } | |
| 167 | 193 |
| 168 return tableElement; | 194 return tableElement; |
| 169 } | 195 } |
| OLD | NEW |