Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/RequestTimingView.js

Issue 1794783006: Add Server-Timing support to devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: really remove whitespace. sigh. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 cell.colSpan = 3; 277 cell.colSpan = 3;
278 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini shed yet!")); 278 cell.createTextChild(WebInspector.UIString("CAUTION: request is not fini shed yet!"));
279 } 279 }
280 280
281 var footer = tableElement.createChild("tr", "network-timing-footer"); 281 var footer = tableElement.createChild("tr", "network-timing-footer");
282 var note = footer.createChild("td"); 282 var note = footer.createChild("td");
283 note.colSpan = 2; 283 note.colSpan = 2;
284 note.appendChild(WebInspector.linkifyDocumentationURLAsNode("profile/network -performance/resource-loading#view-network-timing-details-for-a-specific-resourc e", WebInspector.UIString("Explanation"))); 284 note.appendChild(WebInspector.linkifyDocumentationURLAsNode("profile/network -performance/resource-loading#view-network-timing-details-for-a-specific-resourc e", WebInspector.UIString("Explanation")));
285 footer.createChild("td").createTextChild(Number.secondsToString(totalDuratio n, true)); 285 footer.createChild("td").createTextChild(Number.secondsToString(totalDuratio n, true));
286 286
287 var serverTimings = request.serverTimings;
288 if (!serverTimings)
289 return tableElement;
290
291 var breakElement = tableElement.createChild("tr", "network-timing-table-head er").createChild("td");
292 breakElement.colSpan = 3;
293 breakElement.createChild("hr", "break");
294 var serverHeader = tableElement.createChild("tr", "network-timing-table-head er");
295 serverHeader.createChild("td").createTextChild(WebInspector.UIString("Server Timing"));
296 serverHeader.createChild("td");
297 serverHeader.createChild("td").createTextChild(WebInspector.UIString("TIME") );
298
299 var colorGenerator = new WebInspector.FlameChart.ColorGenerator(
300 { min: 0, max: 360, count:36 },
301 { min: 50, max: 80 },
302 80
303 );
304
305 /**
306 * @param {!WebInspector.ServerTiming} serverTiming
307 * @param {number} right
308 */
309 function addTiming(serverTiming, right)
310 {
311 var isTotal = serverTiming.metric.toLowerCase() === "total";
312 var tr = tableElement.createChild("tr", isTotal ? "network-timing-footer " : "");
313 var metric = tr.createChild("td", "network-timing-metric");
314 metric.createTextChild(serverTiming.description || serverTiming.metric);
315 var row = tr.createChild("td").createChild("div", "network-timing-row");
316 var left = scale * (endTime - startTime - serverTiming.value);
317 if (serverTiming.value && left >= 0) { // don't chart values too big or too small
318 var bar = row.createChild("span", "network-timing-bar server-timing" );
319 bar.style.left = left + "%";
320 bar.style.right = right + "%";
321 bar.textContent = "\u200B"; // Important for 0-time items to have 0 width.
322 if (!isTotal)
323 bar.style.backgroundColor = colorGenerator.colorForID(serverTimi ng.metric);
324 }
325 var label = tr.createChild("td").createChild("div", "network-timing-bar- title");
326 if (typeof serverTiming.value === "number") // a metric timing value is optional
327 label.textContent = Number.secondsToString(serverTiming.value, true) ;
328 }
329
330 serverTimings.filter(item => item.metric.toLowerCase() !== "total").forEach( item => addTiming(item, right));
caseq 2016/08/08 17:12:56 let's have right explicitly computed somewhere on
331 serverTimings.filter(item => item.metric.toLowerCase() === "total").forEach( item => addTiming(item, right));
332
287 return tableElement; 333 return tableElement;
288 334
289 /** 335 /**
290 * param {string} title 336 * param {string} title
291 */ 337 */
292 function createHeader(title) 338 function createHeader(title)
293 { 339 {
294 var dataHeader = tableElement.createChild("tr", "network-timing-table-he ader"); 340 var dataHeader = tableElement.createChild("tr", "network-timing-table-he ader");
295 dataHeader.createChild("td").createTextChild(title); 341 dataHeader.createChild("td").createTextChild(title);
296 dataHeader.createChild("td").createTextChild(""); 342 dataHeader.createChild("td").createTextChild("");
297 dataHeader.createChild("td").createTextChild(WebInspector.UIString("TIME ")); 343 dataHeader.createChild("td").createTextChild(WebInspector.UIString("TIME "));
298 return dataHeader; 344 return dataHeader;
299 } 345 }
300 } 346 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698