OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // TODO(eroman): put these methods into a namespace. | 5 // TODO(eroman): put these methods into a namespace. |
6 | 6 |
7 var createLogEntryTablePrinter; | 7 var createLogEntryTablePrinter; |
8 var proxySettingsToString; | 8 var proxySettingsToString; |
9 var stripCookiesAndLoginInfo; | 9 var stripCookiesAndLoginInfo; |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // If the last entry has a non-zero depth or is a begin event, the source is | 80 // If the last entry has a non-zero depth or is a begin event, the source is |
81 // still active. | 81 // still active. |
82 var isSourceActive = lastEntry.getDepth() != 0 || lastEntry.isBegin(); | 82 var isSourceActive = lastEntry.getDepth() != 0 || lastEntry.isBegin(); |
83 if (logCreationTime != undefined && isSourceActive) { | 83 if (logCreationTime != undefined && isSourceActive) { |
84 addRowWithTime(tablePrinter, | 84 addRowWithTime(tablePrinter, |
85 logCreationTime - baseTime, | 85 logCreationTime - baseTime, |
86 startTime - baseTime); | 86 startTime - baseTime); |
87 } | 87 } |
88 | 88 |
89 return tablePrinter; | 89 return tablePrinter; |
90 } | 90 }; |
91 | 91 |
92 /** | 92 /** |
93 * Adds a new row to the given TablePrinter, and adds five cells containing | 93 * Adds a new row to the given TablePrinter, and adds five cells containing |
94 * information about the time an event occured. | 94 * information about the time an event occured. |
95 * Format is '[t=<time of the event in ms>] [st=<ms since the source started>]'. | 95 * Format is '[t=<time of the event in ms>] [st=<ms since the source started>]'. |
96 * @param {TablePrinter} tablePrinter The table printer to add the cells to. | 96 * @param {TablePrinter} tablePrinter The table printer to add the cells to. |
97 * @param {number} eventTime The time the event occured, in milliseconds, | 97 * @param {number} eventTime The time the event occured, in milliseconds, |
98 * relative to some base time. | 98 * relative to some base time. |
99 * @param {number} startTime The time the first event for the source occured, | 99 * @param {number} startTime The time the first event for the source occured, |
100 * relative to the same base time as eventTime. | 100 * relative to the same base time as eventTime. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 out.writeArrowKeyValue(key, valueStr); | 343 out.writeArrowKeyValue(key, valueStr); |
344 return; | 344 return; |
345 } | 345 } |
346 | 346 |
347 if (key == 'load_state' && typeof value == 'number') { | 347 if (key == 'load_state' && typeof value == 'number') { |
348 var valueStr = value + ' (' + getKeyWithValue(LoadState, value) + ')'; | 348 var valueStr = value + ' (' + getKeyWithValue(LoadState, value) + ')'; |
349 out.writeArrowKeyValue(key, valueStr); | 349 out.writeArrowKeyValue(key, valueStr); |
350 return; | 350 return; |
351 } | 351 } |
352 | 352 |
| 353 if (key == 'sdch_problem_code' && typeof value == 'number') { |
| 354 var valueStr = value + ' (' + sdchProblemCodeToString(value) + ')'; |
| 355 out.writeArrowKeyValue(key, valueStr); |
| 356 return; |
| 357 } |
| 358 |
353 // Otherwise just default to JSON formatting of the value. | 359 // Otherwise just default to JSON formatting of the value. |
354 out.writeArrowKeyValue(key, JSON.stringify(value)); | 360 out.writeArrowKeyValue(key, JSON.stringify(value)); |
355 } | 361 } |
356 | 362 |
357 /** | 363 /** |
358 * Returns the set of LoadFlags that make up the integer |loadFlag|. | 364 * Returns the set of LoadFlags that make up the integer |loadFlag|. |
359 * For example: getLoadFlagSymbolicString( | 365 * For example: getLoadFlagSymbolicString( |
360 */ | 366 */ |
361 function getLoadFlagSymbolicString(loadFlag) { | 367 function getLoadFlagSymbolicString(loadFlag) { |
362 | 368 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 entry = reformatHeaders(entry); | 557 entry = reformatHeaders(entry); |
552 | 558 |
553 // Duplicate the top level object, and |entry.params|. All other fields are | 559 // Duplicate the top level object, and |entry.params|. All other fields are |
554 // just pointers to the original values, as they won't be modified, other than | 560 // just pointers to the original values, as they won't be modified, other than |
555 // |entry.params.headers|. | 561 // |entry.params.headers|. |
556 entry = shallowCloneObject(entry); | 562 entry = shallowCloneObject(entry); |
557 entry.params = shallowCloneObject(entry.params); | 563 entry.params = shallowCloneObject(entry.params); |
558 | 564 |
559 entry.params.headers = entry.params.headers.map(stripCookieOrLoginInfo); | 565 entry.params.headers = entry.params.headers.map(stripCookieOrLoginInfo); |
560 return entry; | 566 return entry; |
561 } | 567 }; |
562 | 568 |
563 /** | 569 /** |
564 * Outputs the request header parameters of |entry| to |out|. | 570 * Outputs the request header parameters of |entry| to |out|. |
565 */ | 571 */ |
566 function writeParamsForRequestHeaders(entry, out, consumedParams) { | 572 function writeParamsForRequestHeaders(entry, out, consumedParams) { |
567 var params = entry.params; | 573 var params = entry.params; |
568 | 574 |
569 if (!(typeof params.line == 'string') || !(params.headers instanceof Array)) { | 575 if (!(typeof params.line == 'string') || !(params.headers instanceof Array)) { |
570 // Unrecognized params. | 576 // Unrecognized params. |
571 return; | 577 return; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 } | 765 } |
760 | 766 |
761 if (config.source != undefined && config.source != 'UNKNOWN') | 767 if (config.source != undefined && config.source != 'UNKNOWN') |
762 result.push('Source: ' + config.source); | 768 result.push('Source: ' + config.source); |
763 | 769 |
764 return result.join('\n'); | 770 return result.join('\n'); |
765 }; | 771 }; |
766 | 772 |
767 // End of anonymous namespace. | 773 // End of anonymous namespace. |
768 })(); | 774 })(); |
OLD | NEW |