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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 * @param {!SDK.ServerTiming} serverTiming | 266 * @param {!SDK.ServerTiming} serverTiming |
267 * @param {number} right | 267 * @param {number} right |
268 */ | 268 */ |
269 function addTiming(serverTiming, right) { | 269 function addTiming(serverTiming, right) { |
270 var colorGenerator = new PerfUI.FlameChart.ColorGenerator({min: 0, max: 36
0, count: 36}, {min: 50, max: 80}, 80); | 270 var colorGenerator = new PerfUI.FlameChart.ColorGenerator({min: 0, max: 36
0, count: 36}, {min: 50, max: 80}, 80); |
271 var isTotal = serverTiming.metric.toLowerCase() === 'total'; | 271 var isTotal = serverTiming.metric.toLowerCase() === 'total'; |
272 var tr = tableElement.createChild('tr', isTotal ? 'network-timing-footer'
: ''); | 272 var tr = tableElement.createChild('tr', isTotal ? 'network-timing-footer'
: ''); |
273 var metric = tr.createChild('td', 'network-timing-metric'); | 273 var metric = tr.createChild('td', 'network-timing-metric'); |
274 metric.createTextChild(serverTiming.description || serverTiming.metric); | 274 metric.createTextChild(serverTiming.description || serverTiming.metric); |
275 var row = tr.createChild('td').createChild('div', 'network-timing-row'); | 275 var row = tr.createChild('td').createChild('div', 'network-timing-row'); |
276 var left = scale * (endTime - startTime - serverTiming.value); | 276 |
277 if (serverTiming.value && left >= 0) { // don't chart values too big or t
oo small | 277 if (serverTiming.value === null) |
| 278 return; |
| 279 var left = scale * (endTime - startTime - (serverTiming.value / 1000)); |
| 280 if (left >= 0) { // don't chart values too big or too small |
278 var bar = row.createChild('span', 'network-timing-bar server-timing'); | 281 var bar = row.createChild('span', 'network-timing-bar server-timing'); |
279 bar.style.left = left + '%'; | 282 bar.style.left = left + '%'; |
280 bar.style.right = right + '%'; | 283 bar.style.right = right + '%'; |
281 bar.textContent = '\u200B'; // Important for 0-time items to have 0 wid
th. | 284 bar.textContent = '\u200B'; // Important for 0-time items to have 0 wid
th. |
282 if (!isTotal) | 285 if (!isTotal) |
283 bar.style.backgroundColor = colorGenerator.colorForID(serverTiming.met
ric); | 286 bar.style.backgroundColor = colorGenerator.colorForID(serverTiming.met
ric); |
284 } | 287 } |
285 var label = tr.createChild('td').createChild('div', 'network-timing-bar-ti
tle'); | 288 var label = tr.createChild('td').createChild('div', 'network-timing-bar-ti
tle'); |
286 if (typeof serverTiming.value === 'number') // a metric timing value is o
ptional | 289 label.textContent = Number.millisToString(serverTiming.value, true); |
287 label.textContent = Number.secondsToString(serverTiming.value, true); | |
288 } | 290 } |
289 | 291 |
290 /** | 292 /** |
291 * param {string} title | 293 * param {string} title |
292 */ | 294 */ |
293 function createHeader(title) { | 295 function createHeader(title) { |
294 var dataHeader = tableElement.createChild('tr', 'network-timing-table-head
er'); | 296 var dataHeader = tableElement.createChild('tr', 'network-timing-table-head
er'); |
295 dataHeader.createChild('td').createTextChild(title); | 297 dataHeader.createChild('td').createTextChild(title); |
296 dataHeader.createChild('td').createTextChild(''); | 298 dataHeader.createChild('td').createTextChild(''); |
297 dataHeader.createChild('td').createTextChild(Common.UIString('TIME')); | 299 dataHeader.createChild('td').createTextChild(Common.UIString('TIME')); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 }; | 348 }; |
347 | 349 |
348 Network.RequestTimingView.ConnectionSetupRangeNames = new Set([ | 350 Network.RequestTimingView.ConnectionSetupRangeNames = new Set([ |
349 Network.RequestTimeRangeNames.Queueing, Network.RequestTimeRangeNames.Blocking
, | 351 Network.RequestTimeRangeNames.Queueing, Network.RequestTimeRangeNames.Blocking
, |
350 Network.RequestTimeRangeNames.Connecting, Network.RequestTimeRangeNames.DNS, N
etwork.RequestTimeRangeNames.Proxy, | 352 Network.RequestTimeRangeNames.Connecting, Network.RequestTimeRangeNames.DNS, N
etwork.RequestTimeRangeNames.Proxy, |
351 Network.RequestTimeRangeNames.SSL | 353 Network.RequestTimeRangeNames.SSL |
352 ]); | 354 ]); |
353 | 355 |
354 /** @typedef {{name: !Network.RequestTimeRangeNames, start: number, end: number}
} */ | 356 /** @typedef {{name: !Network.RequestTimeRangeNames, start: number, end: number}
} */ |
355 Network.RequestTimeRange; | 357 Network.RequestTimeRange; |
OLD | NEW |