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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 cell.colSpan = 3; | 271 cell.colSpan = 3; |
272 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini
shed yet!")); | 272 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini
shed yet!")); |
273 } | 273 } |
274 | 274 |
275 var footer = tableElement.createChild("tr", "network-timing-footer"); | 275 var footer = tableElement.createChild("tr", "network-timing-footer"); |
276 var note = footer.createChild("td"); | 276 var note = footer.createChild("td"); |
277 note.colSpan = 2; | 277 note.colSpan = 2; |
278 note.appendChild(WebInspector.linkifyDocumentationURLAsNode("profile/network
-performance/resource-loading#view-network-timing-details-for-a-specific-resourc
e", WebInspector.UIString("Explanation"))); | 278 note.appendChild(WebInspector.linkifyDocumentationURLAsNode("profile/network
-performance/resource-loading#view-network-timing-details-for-a-specific-resourc
e", WebInspector.UIString("Explanation"))); |
279 footer.createChild("td").createTextChild(Number.secondsToString(totalDuratio
n, true)); | 279 footer.createChild("td").createTextChild(Number.secondsToString(totalDuratio
n, true)); |
280 | 280 |
| 281 var serverTimings = request.serverTimings; |
| 282 if (!serverTimings) |
| 283 return tableElement; |
| 284 |
| 285 var breakEl = tableElement.createChild("tr", "network-timing-table-header").
createChild("td"); |
| 286 breakEl.colSpan = 3; |
| 287 breakEl.createChild("hr", "break"); |
| 288 var serverHeader = tableElement.createChild("tr", "network-timing-table-head
er"); |
| 289 serverHeader.createChild("td").createTextChild(WebInspector.UIString("Server
Timing")); |
| 290 serverHeader.createChild("td").createTextChild(""); |
| 291 serverHeader.createChild("td").createTextChild(WebInspector.UIString("TIME")
); |
| 292 |
| 293 var colorGenerator = new WebInspector.FlameChart.ColorGenerator( |
| 294 { min: 0, max: 360, count:36 }, |
| 295 { min: 50, max: 80 }, |
| 296 80 |
| 297 ); |
| 298 |
| 299 /** |
| 300 * @param {!WebInspector.ServerTiming} serverTiming |
| 301 */ |
| 302 function addTiming(serverTiming) |
| 303 { |
| 304 var isTotal = serverTiming.metric == "total"; |
| 305 var tr = tableElement.createChild("tr", isTotal ? "network-timing-footer
" : ""); |
| 306 var metric = tr.createChild("td", "network-timing-metric"); |
| 307 metric.createTextChild(serverTiming.description || serverTiming.metric); |
| 308 |
| 309 left = scale * (endTime - startTime - serverTiming.value); |
| 310 row = tr.createChild("td").createChild("div", "network-timing-row"); |
| 311 bar = row.createChild("span", "network-timing-bar server-timing"); |
| 312 bar.style.left = left + "%"; |
| 313 bar.style.right = right + "%"; |
| 314 bar.textContent = "\u200B"; // Important for 0-time items to have 0 widt
h. |
| 315 if (!isTotal) |
| 316 bar.style.backgroundColor = colorGenerator.colorForID(serverTiming.m
etric); |
| 317 |
| 318 var label = tr.createChild("td").createChild("div", "network-timing-bar-
title"); |
| 319 label.textContent = Number.secondsToString(serverTiming.value, true); |
| 320 } |
| 321 |
| 322 serverTimings.filter(item => item.metric.toLowerCase() != "total").forEach(a
ddTiming); |
| 323 serverTimings.filter(item => item.metric.toLowerCase() == "total").forEach(a
ddTiming); |
| 324 |
281 return tableElement; | 325 return tableElement; |
282 } | 326 } |
OLD | NEW |