| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Tim
ingChanged, this._refresh, this); | 57 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Tim
ingChanged, this._refresh, this); |
| 58 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Fin
ishedLoading, this._refresh, this); | 58 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Fin
ishedLoading, this._refresh, this); |
| 59 this._calculator.removeEventListener(WebInspector.NetworkTimeCalculator.
Events.BoundariesChanged, this._refresh, this); | 59 this._calculator.removeEventListener(WebInspector.NetworkTimeCalculator.
Events.BoundariesChanged, this._refresh, this); |
| 60 }, | 60 }, |
| 61 | 61 |
| 62 _refresh: function() | 62 _refresh: function() |
| 63 { | 63 { |
| 64 if (this._tableElement) | 64 if (this._tableElement) |
| 65 this._tableElement.remove(); | 65 this._tableElement.remove(); |
| 66 | 66 |
| 67 this._tableElement = WebInspector.RequestTimingView.createTimingTable(th
is._request, this._calculator.minimumBoundary()); | 67 this._tableElement = WebInspector.RequestTimingView.createTimingTable(th
is._request, this._calculator); |
| 68 this.element.appendChild(this._tableElement); | 68 this.element.appendChild(this._tableElement); |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 __proto__: WebInspector.VBox.prototype | 71 __proto__: WebInspector.VBox.prototype |
| 72 } | 72 } |
| 73 | 73 |
| 74 /** @enum {string} */ | 74 /** @enum {string} */ |
| 75 WebInspector.RequestTimeRangeNames = { | 75 WebInspector.RequestTimeRangeNames = { |
| 76 Queueing: "queueing", | 76 Queueing: "queueing", |
| 77 Blocking: "blocking", | 77 Blocking: "blocking", |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 | 201 |
| 202 if (request.endTime !== -1) | 202 if (request.endTime !== -1) |
| 203 addRange(WebInspector.RequestTimeRangeNames.Receiving, request.responseR
eceivedTime, endTime); | 203 addRange(WebInspector.RequestTimeRangeNames.Receiving, request.responseR
eceivedTime, endTime); |
| 204 | 204 |
| 205 return result; | 205 return result; |
| 206 } | 206 } |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * @param {!WebInspector.NetworkRequest} request | 209 * @param {!WebInspector.NetworkRequest} request |
| 210 * @param {number} navigationStart | 210 * @param {!WebInspector.NetworkTimeCalculator} calculator |
| 211 * @return {!Element} | 211 * @return {!Element} |
| 212 */ | 212 */ |
| 213 WebInspector.RequestTimingView.createTimingTable = function(request, navigationS
tart) | 213 WebInspector.RequestTimingView.createTimingTable = function(request, calculator) |
| 214 { | 214 { |
| 215 var tableElement = createElementWithClass("table", "network-timing-table"); | 215 var tableElement = createElementWithClass("table", "network-timing-table"); |
| 216 var colgroup = tableElement.createChild("colgroup"); | 216 var colgroup = tableElement.createChild("colgroup"); |
| 217 colgroup.createChild("col", "labels"); | 217 colgroup.createChild("col", "labels"); |
| 218 colgroup.createChild("col", "bars"); | 218 colgroup.createChild("col", "bars"); |
| 219 colgroup.createChild("col", "duration"); | 219 colgroup.createChild("col", "duration"); |
| 220 | 220 |
| 221 var timeRanges = WebInspector.RequestTimingView.calculateRequestTimeRanges(r
equest); | 221 var timeRanges = WebInspector.RequestTimingView.calculateRequestTimeRanges(r
equest); |
| 222 var startTime = timeRanges[0].start; | 222 var startTime = timeRanges[0].start; |
| 223 var endTime = timeRanges[0].end; | 223 var endTime = timeRanges[0].end; |
| 224 var scale = 100 / (endTime - startTime); | 224 var scale = 100 / (endTime - startTime); |
| 225 | 225 |
| 226 var connectionHeader; | 226 var connectionHeader; |
| 227 var dataHeader; | 227 var dataHeader; |
| 228 var queueingHeader; |
| 228 var totalDuration = 0; | 229 var totalDuration = 0; |
| 229 | 230 |
| 231 var startTimeHeader = tableElement.createChild("thead", "network-timing-star
t") |
| 232 var queuedCell = startTimeHeader.createChild("tr").createChild("td"); |
| 233 var startedCell = startTimeHeader.createChild("tr").createChild("td"); |
| 234 queuedCell.colSpan = startedCell.colSpan = 2; |
| 235 queuedCell.createTextChild(WebInspector.UIString("Queued at %s.", calculator
.formatTime(request.issueTime(), 2))); |
| 236 startedCell.createTextChild(WebInspector.UIString("Started at %s.", calculat
or.formatTime(request.startTime, 2))); |
| 237 |
| 230 for (var i = 0; i < timeRanges.length; ++i) { | 238 for (var i = 0; i < timeRanges.length; ++i) { |
| 231 var range = timeRanges[i]; | 239 var range = timeRanges[i]; |
| 232 var rangeName = range.name; | 240 var rangeName = range.name; |
| 233 if (rangeName === WebInspector.RequestTimeRangeNames.Total) { | 241 if (rangeName === WebInspector.RequestTimeRangeNames.Total) { |
| 234 totalDuration = range.end - range.start; | 242 totalDuration = range.end - range.start; |
| 235 continue; | 243 continue; |
| 236 } | 244 } |
| 237 if (WebInspector.RequestTimingView.ConnectionSetupRangeNames[rangeName])
{ | 245 if (rangeName === WebInspector.RequestTimeRangeNames.Queueing) { |
| 246 queueingHeader = tableElement.createChild("tr", "network-timing-tabl
e-header"); |
| 247 queueingHeader.createChild("td").createTextChild("Resource Schedulin
g"); |
| 248 queueingHeader.createChild("td").createTextChild(""); |
| 249 queueingHeader.createChild("td").createTextChild("TIME"); |
| 250 } else if (WebInspector.RequestTimingView.ConnectionSetupRangeNames[rang
eName]) { |
| 238 if (!connectionHeader) { | 251 if (!connectionHeader) { |
| 239 connectionHeader = tableElement.createChild("tr", "network-timin
g-table-header"); | 252 connectionHeader = tableElement.createChild("tr", "network-timin
g-table-header"); |
| 240 connectionHeader.createChild("td").createTextChild("Connection S
etup"); | 253 connectionHeader.createChild("td").createTextChild("Connection S
etup"); |
| 241 connectionHeader.createChild("td").createTextChild(""); | 254 connectionHeader.createChild("td").createTextChild(""); |
| 242 connectionHeader.createChild("td").createTextChild("TIME"); | 255 connectionHeader.createChild("td").createTextChild("TIME"); |
| 243 } | 256 } |
| 244 } else { | 257 } else { |
| 245 if (!dataHeader) { | 258 if (!dataHeader) { |
| 246 dataHeader = tableElement.createChild("tr", "network-timing-tabl
e-header"); | 259 dataHeader = tableElement.createChild("tr", "network-timing-tabl
e-header"); |
| 247 dataHeader.createChild("td").createTextChild("Request/Response")
; | 260 dataHeader.createChild("td").createTextChild("Request/Response")
; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 267 } | 280 } |
| 268 | 281 |
| 269 if (!request.finished) { | 282 if (!request.finished) { |
| 270 var cell = tableElement.createChild("tr").createChild("td", "caution"); | 283 var cell = tableElement.createChild("tr").createChild("td", "caution"); |
| 271 cell.colSpan = 3; | 284 cell.colSpan = 3; |
| 272 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini
shed yet!")); | 285 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini
shed yet!")); |
| 273 } | 286 } |
| 274 | 287 |
| 275 var footer = tableElement.createChild("tr", "network-timing-footer"); | 288 var footer = tableElement.createChild("tr", "network-timing-footer"); |
| 276 var note = footer.createChild("td"); | 289 var note = footer.createChild("td"); |
| 277 note.colSpan = 2; | 290 note.colSpan = 1; |
| 278 note.appendChild(WebInspector.linkifyDocumentationURLAsNode("profile/network
-performance/resource-loading#view-network-timing-details-for-a-specific-resourc
e", WebInspector.UIString("Explanation"))); | 291 note.appendChild(WebInspector.linkifyDocumentationURLAsNode("profile/network
-performance/resource-loading#view-network-timing-details-for-a-specific-resourc
e", WebInspector.UIString("Explanation"))); |
| 292 footer.createChild("td"); |
| 279 footer.createChild("td").createTextChild(Number.secondsToString(totalDuratio
n, true)); | 293 footer.createChild("td").createTextChild(Number.secondsToString(totalDuratio
n, true)); |
| 280 | 294 |
| 281 return tableElement; | 295 return tableElement; |
| 282 } | 296 } |
| OLD | NEW |