Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(954)

Side by Side Diff: tools/logreader.js

Issue 171038: Fix issue 420: accept truncated log files. (Closed)
Patch Set: Comment addressed Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/tools/logreader.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 continue; 287 continue;
288 } 288 }
289 if (line.charAt(0) == '#' || 289 if (line.charAt(0) == '#' ||
290 line.substr(0, line.indexOf(',')) in this.backRefsCommands_) { 290 line.substr(0, line.indexOf(',')) in this.backRefsCommands_) {
291 line = this.expandBackRef_(line); 291 line = this.expandBackRef_(line);
292 } 292 }
293 var fields = csvParser.parseLine(line); 293 var fields = csvParser.parseLine(line);
294 this.dispatchLogRow_(fields); 294 this.dispatchLogRow_(fields);
295 } 295 }
296 } catch (e) { 296 } catch (e) {
297 this.printError('line ' + (i + 1) + ': ' + (e.message || e)); 297 // An error on the last line is acceptable since log file can be truncated.
298 throw e; 298 if (i < n - 1) {
299 this.printError('line ' + (i + 1) + ': ' + (e.message || e));
300 throw e;
301 }
299 } 302 }
300 }; 303 };
301 304
302 305
303 /** 306 /**
304 * Processes repeat log record. Expands it according to calls count and 307 * Processes repeat log record. Expands it according to calls count and
305 * invokes processing. 308 * invokes processing.
306 * 309 *
307 * @param {number} count Count. 310 * @param {number} count Count.
308 * @param {Array.<string>} cmd Parsed command. 311 * @param {Array.<string>} cmd Parsed command.
309 * @private 312 * @private
310 */ 313 */
311 devtools.profiler.LogReader.prototype.processRepeat_ = function(count, cmd) { 314 devtools.profiler.LogReader.prototype.processRepeat_ = function(count, cmd) {
312 // Replace the repeat-prefixed command from backrefs list with a non-prefixed. 315 // Replace the repeat-prefixed command from backrefs list with a non-prefixed.
313 this.backRefs_[0] = cmd.join(','); 316 this.backRefs_[0] = cmd.join(',');
314 for (var i = 0; i < count; ++i) { 317 for (var i = 0; i < count; ++i) {
315 this.dispatchLogRow_(cmd); 318 this.dispatchLogRow_(cmd);
316 } 319 }
317 }; 320 };
OLDNEW
« no previous file with comments | « test/mjsunit/tools/logreader.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698