Chromium Code Reviews| Index: chrome/browser/resources/net_internals/log_view_painter.js |
| =================================================================== |
| --- chrome/browser/resources/net_internals/log_view_painter.js (revision 148858) |
| +++ chrome/browser/resources/net_internals/log_view_painter.js (working copy) |
| @@ -24,7 +24,8 @@ |
| * Adds a child pre element to the end of |parent|, and writes the |
| * formatted contents of |logEntries| to it. |
| */ |
| -printLogEntriesAsText = function(logEntries, parent, enableSecurityStripping) { |
| +printLogEntriesAsText = function(logEntries, parent, enableSecurityStripping, |
| + logCreationTime) { |
| var entries = LogGroupEntry.createArrayFrom(logEntries); |
| var tablePrinter = new TablePrinter(); |
| var parameterOutputter = new ParameterOutputter(tablePrinter); |
| @@ -41,17 +42,10 @@ |
| // Avoid printing the END for a BEGIN that was immediately before, unless |
| // both have extra parameters. |
| if (!entry.isEnd() || !canCollapseBeginWithEnd(entry.begin)) { |
| - tablePrinter.addRow(); |
| + addRowWithTime(tablePrinter, |
| + timeutil.convertTimeTicksToDate(entry.orig.time).getTime(), |
| + startTime); |
| - tablePrinter.addCell('t='); |
| - var date = timeutil.convertTimeTicksToDate(entry.orig.time); |
| - var tCell = tablePrinter.addCell(date.getTime()); |
| - tCell.alignRight = true; |
| - tablePrinter.addCell(' [st='); |
| - var stCell = tablePrinter.addCell(date.getTime() - startTime); |
| - stCell.alignRight = true; |
| - tablePrinter.addCell('] '); |
| - |
| for (var j = entry.getDepth(); j > 0; --j) |
| tablePrinter.addCell(' '); |
| @@ -80,11 +74,37 @@ |
| } |
| } |
| + // If viewing a saved log file, add row with just the time the log was |
| + // created, if the event never completed. |
| + if (logCreationTime != null && entries[entries.length - 1].getDepth() > 0) |
| + addRowWithTime(tablePrinter, logCreationTime, startTime); |
| + |
| // Format the table for fixed-width text. |
| tablePrinter.toText(0, parent); |
| } |
| /** |
| + * Adds a new row to the given TablePrinter, and adds five cells containing |
| + * information about the time an event occured. |
| + * Format is '[t=<UTC time in ms>] [st=<ms since the source started>]'. |
| + * @param {TablePrinter} tablePrinter The table printer to add the cells to. |
| + * @param {number} eventTime The time the event occured, as a UTC time in |
| + * milliseconds. |
| + * @param {number} startTime The time the first event for the source occured, |
| + * as a UTC time in milliseconds. |
| + */ |
| +function addRowWithTime(tablePrinter, eventTime, startTime) { |
|
mmenke
2012/07/31 20:45:42
Could move this over to ParameterOutputter (writeL
|
| + tablePrinter.addRow(); |
| + tablePrinter.addCell('t='); |
| + var tCell = tablePrinter.addCell(eventTime); |
| + tCell.alignRight = true; |
| + tablePrinter.addCell(' [st='); |
| + var stCell = tablePrinter.addCell(eventTime - startTime); |
| + stCell.alignRight = true; |
| + tablePrinter.addCell('] '); |
| +} |
| + |
| +/** |
| * |hexString| must be a string of hexadecimal characters with no whitespace, |
| * whose length is a multiple of two. Writes multiple lines to |out| with |
| * the hexadecimal characters from |hexString| on the left, in groups of |