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 23 matching lines...) Expand all Loading... |
34 * @param {!WebInspector.NetworkRequest} request | 34 * @param {!WebInspector.NetworkRequest} request |
35 * @param {!WebInspector.NetworkTimeCalculator} calculator | 35 * @param {!WebInspector.NetworkTimeCalculator} calculator |
36 */ | 36 */ |
37 WebInspector.RequestTimingView = function(request, calculator) | 37 WebInspector.RequestTimingView = function(request, calculator) |
38 { | 38 { |
39 WebInspector.VBox.call(this); | 39 WebInspector.VBox.call(this); |
40 this.element.classList.add("resource-timing-view"); | 40 this.element.classList.add("resource-timing-view"); |
41 | 41 |
42 this._request = request; | 42 this._request = request; |
43 this._calculator = calculator; | 43 this._calculator = calculator; |
44 } | 44 }; |
45 | 45 |
46 WebInspector.RequestTimingView.prototype = { | 46 WebInspector.RequestTimingView.prototype = { |
47 wasShown: function() | 47 wasShown: function() |
48 { | 48 { |
49 this._request.addEventListener(WebInspector.NetworkRequest.Events.Timing
Changed, this._refresh, this); | 49 this._request.addEventListener(WebInspector.NetworkRequest.Events.Timing
Changed, this._refresh, this); |
50 this._request.addEventListener(WebInspector.NetworkRequest.Events.Finish
edLoading, this._refresh, this); | 50 this._request.addEventListener(WebInspector.NetworkRequest.Events.Finish
edLoading, this._refresh, this); |
51 this._calculator.addEventListener(WebInspector.NetworkTimeCalculator.Eve
nts.BoundariesChanged, this._refresh, this); | 51 this._calculator.addEventListener(WebInspector.NetworkTimeCalculator.Eve
nts.BoundariesChanged, this._refresh, this); |
52 this._refresh(); | 52 this._refresh(); |
53 }, | 53 }, |
54 | 54 |
55 willHide: function() | 55 willHide: function() |
56 { | 56 { |
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.minimumBoundary()); |
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 Push: "push", | 76 Push: "push", |
77 Queueing: "queueing", | 77 Queueing: "queueing", |
78 Blocking: "blocking", | 78 Blocking: "blocking", |
79 Connecting: "connecting", | 79 Connecting: "connecting", |
80 DNS: "dns", | 80 DNS: "dns", |
81 Proxy: "proxy", | 81 Proxy: "proxy", |
82 Receiving: "receiving", | 82 Receiving: "receiving", |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 case WebInspector.RequestTimeRangeNames.ReceivingPush: return WebInspector.U
IString("Reading Push"); | 117 case WebInspector.RequestTimeRangeNames.ReceivingPush: return WebInspector.U
IString("Reading Push"); |
118 case WebInspector.RequestTimeRangeNames.Receiving: return WebInspector.UIStr
ing("Content Download"); | 118 case WebInspector.RequestTimeRangeNames.Receiving: return WebInspector.UIStr
ing("Content Download"); |
119 case WebInspector.RequestTimeRangeNames.Sending: return WebInspector.UIStrin
g("Request sent"); | 119 case WebInspector.RequestTimeRangeNames.Sending: return WebInspector.UIStrin
g("Request sent"); |
120 case WebInspector.RequestTimeRangeNames.ServiceWorker: return WebInspector.U
IString("Request to ServiceWorker"); | 120 case WebInspector.RequestTimeRangeNames.ServiceWorker: return WebInspector.U
IString("Request to ServiceWorker"); |
121 case WebInspector.RequestTimeRangeNames.ServiceWorkerPreparation: return Web
Inspector.UIString("ServiceWorker Preparation"); | 121 case WebInspector.RequestTimeRangeNames.ServiceWorkerPreparation: return Web
Inspector.UIString("ServiceWorker Preparation"); |
122 case WebInspector.RequestTimeRangeNames.SSL: return WebInspector.UIString("S
SL"); | 122 case WebInspector.RequestTimeRangeNames.SSL: return WebInspector.UIString("S
SL"); |
123 case WebInspector.RequestTimeRangeNames.Total: return WebInspector.UIString(
"Total"); | 123 case WebInspector.RequestTimeRangeNames.Total: return WebInspector.UIString(
"Total"); |
124 case WebInspector.RequestTimeRangeNames.Waiting: return WebInspector.UIStrin
g("Waiting (TTFB)"); | 124 case WebInspector.RequestTimeRangeNames.Waiting: return WebInspector.UIStrin
g("Waiting (TTFB)"); |
125 default: return WebInspector.UIString(name); | 125 default: return WebInspector.UIString(name); |
126 } | 126 } |
127 } | 127 }; |
128 | 128 |
129 /** | 129 /** |
130 * @param {!WebInspector.NetworkRequest} request | 130 * @param {!WebInspector.NetworkRequest} request |
131 * @param {number} navigationStart | 131 * @param {number} navigationStart |
132 * @return {!Array.<!WebInspector.RequestTimeRange>} | 132 * @return {!Array.<!WebInspector.RequestTimeRange>} |
133 */ | 133 */ |
134 WebInspector.RequestTimingView.calculateRequestTimeRanges = function(request, na
vigationStart) | 134 WebInspector.RequestTimingView.calculateRequestTimeRanges = function(request, na
vigationStart) |
135 { | 135 { |
136 var result = []; | 136 var result = []; |
137 /** | 137 /** |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 addOffsetRange(WebInspector.RequestTimeRangeNames.Connecting, timing.con
nectStart, timing.connectEnd); | 208 addOffsetRange(WebInspector.RequestTimeRangeNames.Connecting, timing.con
nectStart, timing.connectEnd); |
209 addOffsetRange(WebInspector.RequestTimeRangeNames.SSL, timing.sslStart,
timing.sslEnd); | 209 addOffsetRange(WebInspector.RequestTimeRangeNames.SSL, timing.sslStart,
timing.sslEnd); |
210 addOffsetRange(WebInspector.RequestTimeRangeNames.Sending, timing.sendSt
art, timing.sendEnd); | 210 addOffsetRange(WebInspector.RequestTimeRangeNames.Sending, timing.sendSt
art, timing.sendEnd); |
211 addOffsetRange(WebInspector.RequestTimeRangeNames.Waiting, timing.sendEn
d, timing.receiveHeadersEnd); | 211 addOffsetRange(WebInspector.RequestTimeRangeNames.Waiting, timing.sendEn
d, timing.receiveHeadersEnd); |
212 } | 212 } |
213 | 213 |
214 if (request.endTime !== -1) | 214 if (request.endTime !== -1) |
215 addRange(timing.pushStart ? WebInspector.RequestTimeRangeNames.Receiving
Push : WebInspector.RequestTimeRangeNames.Receiving, request.responseReceivedTim
e, endTime); | 215 addRange(timing.pushStart ? WebInspector.RequestTimeRangeNames.Receiving
Push : WebInspector.RequestTimeRangeNames.Receiving, request.responseReceivedTim
e, endTime); |
216 | 216 |
217 return result; | 217 return result; |
218 } | 218 }; |
219 | 219 |
220 /** | 220 /** |
221 * @param {!WebInspector.NetworkRequest} request | 221 * @param {!WebInspector.NetworkRequest} request |
222 * @param {number} navigationStart | 222 * @param {number} navigationStart |
223 * @return {!Element} | 223 * @return {!Element} |
224 */ | 224 */ |
225 WebInspector.RequestTimingView.createTimingTable = function(request, navigationS
tart) | 225 WebInspector.RequestTimingView.createTimingTable = function(request, navigationS
tart) |
226 { | 226 { |
227 var tableElement = createElementWithClass("table", "network-timing-table"); | 227 var tableElement = createElementWithClass("table", "network-timing-table"); |
228 var colgroup = tableElement.createChild("colgroup"); | 228 var colgroup = tableElement.createChild("colgroup"); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 * param {string} title | 339 * param {string} title |
340 */ | 340 */ |
341 function createHeader(title) | 341 function createHeader(title) |
342 { | 342 { |
343 var dataHeader = tableElement.createChild("tr", "network-timing-table-he
ader"); | 343 var dataHeader = tableElement.createChild("tr", "network-timing-table-he
ader"); |
344 dataHeader.createChild("td").createTextChild(title); | 344 dataHeader.createChild("td").createTextChild(title); |
345 dataHeader.createChild("td").createTextChild(""); | 345 dataHeader.createChild("td").createTextChild(""); |
346 dataHeader.createChild("td").createTextChild(WebInspector.UIString("TIME
")); | 346 dataHeader.createChild("td").createTextChild(WebInspector.UIString("TIME
")); |
347 return dataHeader; | 347 return dataHeader; |
348 } | 348 } |
349 } | 349 }; |
OLD | NEW |