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 | |
359 // Otherwise just default to JSON formatting of the value. | 353 // Otherwise just default to JSON formatting of the value. |
360 out.writeArrowKeyValue(key, JSON.stringify(value)); | 354 out.writeArrowKeyValue(key, JSON.stringify(value)); |
361 } | 355 } |
362 | 356 |
363 /** | 357 /** |
364 * Returns the set of LoadFlags that make up the integer |loadFlag|. | 358 * Returns the set of LoadFlags that make up the integer |loadFlag|. |
365 * For example: getLoadFlagSymbolicString( | 359 * For example: getLoadFlagSymbolicString( |
366 */ | 360 */ |
367 function getLoadFlagSymbolicString(loadFlag) { | 361 function getLoadFlagSymbolicString(loadFlag) { |
368 | 362 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 entry = reformatHeaders(entry); | 551 entry = reformatHeaders(entry); |
558 | 552 |
559 // Duplicate the top level object, and |entry.params|. All other fields are | 553 // Duplicate the top level object, and |entry.params|. All other fields are |
560 // just pointers to the original values, as they won't be modified, other than | 554 // just pointers to the original values, as they won't be modified, other than |
561 // |entry.params.headers|. | 555 // |entry.params.headers|. |
562 entry = shallowCloneObject(entry); | 556 entry = shallowCloneObject(entry); |
563 entry.params = shallowCloneObject(entry.params); | 557 entry.params = shallowCloneObject(entry.params); |
564 | 558 |
565 entry.params.headers = entry.params.headers.map(stripCookieOrLoginInfo); | 559 entry.params.headers = entry.params.headers.map(stripCookieOrLoginInfo); |
566 return entry; | 560 return entry; |
567 }; | 561 } |
568 | 562 |
569 /** | 563 /** |
570 * Outputs the request header parameters of |entry| to |out|. | 564 * Outputs the request header parameters of |entry| to |out|. |
571 */ | 565 */ |
572 function writeParamsForRequestHeaders(entry, out, consumedParams) { | 566 function writeParamsForRequestHeaders(entry, out, consumedParams) { |
573 var params = entry.params; | 567 var params = entry.params; |
574 | 568 |
575 if (!(typeof params.line == 'string') || !(params.headers instanceof Array)) { | 569 if (!(typeof params.line == 'string') || !(params.headers instanceof Array)) { |
576 // Unrecognized params. | 570 // Unrecognized params. |
577 return; | 571 return; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 759 } |
766 | 760 |
767 if (config.source != undefined && config.source != 'UNKNOWN') | 761 if (config.source != undefined && config.source != 'UNKNOWN') |
768 result.push('Source: ' + config.source); | 762 result.push('Source: ' + config.source); |
769 | 763 |
770 return result.join('\n'); | 764 return result.join('\n'); |
771 }; | 765 }; |
772 | 766 |
773 // End of anonymous namespace. | 767 // End of anonymous namespace. |
774 })(); | 768 })(); |
OLD | NEW |