OLD | NEW |
---|---|
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 | 127 |
128 /** | 128 /** |
129 * Does a dispatch of a log record. | 129 * Does a dispatch of a log record. |
130 * | 130 * |
131 * @param {Array.<string>} fields Log record. | 131 * @param {Array.<string>} fields Log record. |
132 * @private | 132 * @private |
133 */ | 133 */ |
134 LogReader.prototype.dispatchLogRow_ = function(fields) { | 134 LogReader.prototype.dispatchLogRow_ = function(fields) { |
135 // Obtain the dispatch. | 135 // Obtain the dispatch. |
136 var command = fields[0]; | 136 var command = fields[0]; |
137 if (!(command in this.dispatchTable_)) { | 137 if (!(command in this.dispatchTable_)) return; |
138 throw new Error('unknown command: ' + command); | 138 |
139 } | |
140 var dispatch = this.dispatchTable_[command]; | 139 var dispatch = this.dispatchTable_[command]; |
141 | 140 |
142 if (dispatch === null || this.skipDispatch(dispatch)) { | 141 if (dispatch === null || this.skipDispatch(dispatch)) { |
143 return; | 142 return; |
144 } | 143 } |
145 | 144 |
146 // Parse fields. | 145 // Parse fields. |
147 var parsedFields = []; | 146 var parsedFields = []; |
148 for (var i = 0; i < dispatch.parsers.length; ++i) { | 147 for (var i = 0; i < dispatch.parsers.length; ++i) { |
149 var parser = dispatch.parsers[i]; | 148 var parser = dispatch.parsers[i]; |
(...skipping 15 matching lines...) Expand all Loading... | |
165 | 164 |
166 /** | 165 /** |
167 * Processes log lines. | 166 * Processes log lines. |
168 * | 167 * |
169 * @param {Array.<string>} lines Log lines. | 168 * @param {Array.<string>} lines Log lines. |
170 * @private | 169 * @private |
171 */ | 170 */ |
172 LogReader.prototype.processLog_ = function(lines) { | 171 LogReader.prototype.processLog_ = function(lines) { |
173 for (var i = 0, n = lines.length; i < n; ++i, ++this.lineNum_) { | 172 for (var i = 0, n = lines.length; i < n; ++i, ++this.lineNum_) { |
174 var line = lines[i]; | 173 var line = lines[i]; |
175 if (!line) { | 174 if (!line) continue; |
176 continue; | 175 var fields = this.csvParser_.parseLine(line); |
177 } | 176 this.dispatchLogRow_(fields); |
178 try { | |
179 var fields = this.csvParser_.parseLine(line); | |
180 this.dispatchLogRow_(fields); | |
181 } catch (e) { | |
182 this.printError('line ' + (this.lineNum_ + 1) + ': ' + (e.message || e)); | |
mnaganov (inactive)
2011/09/15 12:39:29
Why are you removing this code as well? It's gener
| |
183 } | |
184 } | 177 } |
185 }; | 178 }; |
OLD | NEW |