| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 115 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 26 matching lines...) Expand all Loading... |
| 176 continue; | 175 continue; |
| 177 } | 176 } |
| 178 try { | 177 try { |
| 179 var fields = this.csvParser_.parseLine(line); | 178 var fields = this.csvParser_.parseLine(line); |
| 180 this.dispatchLogRow_(fields); | 179 this.dispatchLogRow_(fields); |
| 181 } catch (e) { | 180 } catch (e) { |
| 182 this.printError('line ' + (this.lineNum_ + 1) + ': ' + (e.message || e)); | 181 this.printError('line ' + (this.lineNum_ + 1) + ': ' + (e.message || e)); |
| 183 } | 182 } |
| 184 } | 183 } |
| 185 }; | 184 }; |
| OLD | NEW |