OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 /** | 5 /** |
6 * TODO(eroman): This needs better presentation, and cleaner code. This | 6 * TODO(eroman): This needs better presentation, and cleaner code. This |
7 * implementation is more of a transitionary step as | 7 * implementation is more of a transitionary step as |
8 * the old net-internals is replaced. | 8 * the old net-internals is replaced. |
9 */ | 9 */ |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 addTextNode(timeCell, entry.orig.time); | 61 addTextNode(timeCell, entry.orig.time); |
62 | 62 |
63 var mainCell = addNode(tr, 'td'); | 63 var mainCell = addNode(tr, 'td'); |
64 mainCell.style.paddingRight = '5px'; | 64 mainCell.style.paddingRight = '5px'; |
65 var dtLabelCell = addNode(tr, 'td'); | 65 var dtLabelCell = addNode(tr, 'td'); |
66 var dtCell = addNode(tr, 'td'); | 66 var dtCell = addNode(tr, 'td'); |
67 dtCell.style.textAlign = 'right'; | 67 dtCell.style.textAlign = 'right'; |
68 | 68 |
69 mainCell.style.paddingLeft = (INDENTATION_PX * entry.getDepth()) + "px"; | 69 mainCell.style.paddingLeft = (INDENTATION_PX * entry.getDepth()) + "px"; |
70 | 70 |
71 if (entry.orig.type == LogEntryType.TYPE_EVENT) { | 71 addTextNode(mainCell, getTextForEvent(entry)); |
72 addTextNode(mainCell, getTextForEvent(entry)); | |
73 | 72 |
74 // Get the elapsed time. | 73 // Get the elapsed time. |
75 if (entry.isBegin()) { | 74 if (entry.isBegin()) { |
76 addTextNode(dtLabelCell, '[dt='); | 75 addTextNode(dtLabelCell, '[dt='); |
77 | 76 |
78 // Definite time. | 77 // Definite time. |
79 if (entry.end) { | 78 if (entry.end) { |
80 var dt = entry.end.orig.time - entry.orig.time; | 79 var dt = entry.end.orig.time - entry.orig.time; |
81 addTextNode(dtCell, dt + ']'); | 80 addTextNode(dtCell, dt + ']'); |
82 } else { | 81 } else { |
83 addTextNode(dtCell, '?]'); | 82 addTextNode(dtCell, '?]'); |
84 } | |
85 } | 83 } |
86 } else { | 84 } else { |
87 mainCell.colSpan = '3'; | 85 mainCell.colSpan = '3'; |
88 if (entry.orig.type == LogEntryType.TYPE_STRING) { | 86 } |
89 addTextNode(mainCell, entry.orig.string); | 87 |
90 } else if (entry.orig.type == LogEntryType.TYPE_ERROR_CODE) { | 88 // Output the extra parameters. |
91 // TODO(eroman): print symbolic name of error code. | 89 // TODO(eroman): Do type-specific formatting. |
92 addTextNode(mainCell, "Network error: " + entry.orig.error_code); | 90 if (entry.orig.extra_parameters != undefined) { |
93 } else { | 91 addNode(mainCell, 'br'); |
94 addTextNode(mainCell, "Unrecognized entry type: " + entry.orig.type); | 92 addTextNode(mainCell, 'params: ' + entry.orig.extra_parameters); |
95 } | |
96 } | 93 } |
97 } | 94 } |
98 } | 95 } |
99 | 96 |
100 function getTextForEvent(entry) { | 97 function getTextForEvent(entry) { |
101 var text = ''; | 98 var text = ''; |
102 | 99 |
103 if (entry.isBegin()) { | 100 if (entry.isBegin()) { |
104 text = '+' + text; | 101 text = '+' + text; |
105 } else if (entry.isEnd()) { | 102 } else if (entry.isEnd()) { |
106 text = '-' + text; | 103 text = '-' + text; |
107 } else { | 104 } else { |
108 text = '.'; | 105 text = '.'; |
109 } | 106 } |
110 | 107 |
111 text += getKeyWithValue(LogEventType, entry.orig.event.type); | 108 text += getKeyWithValue(LogEventType, entry.orig.type); |
112 return text; | 109 return text; |
113 } | 110 } |
114 | 111 |
115 // End of anonymous namespace. | 112 // End of anonymous namespace. |
116 })(); | 113 })(); |
117 | 114 |
OLD | NEW |