| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 loadFromFile: function(file, progress) | 394 loadFromFile: function(file, progress) |
| 395 { | 395 { |
| 396 var delegate = new WebInspector.TimelineModelLoadFromFileDelegate(this,
progress); | 396 var delegate = new WebInspector.TimelineModelLoadFromFileDelegate(this,
progress); |
| 397 var fileReader = this._createFileReader(file, delegate); | 397 var fileReader = this._createFileReader(file, delegate); |
| 398 var loader = new WebInspector.TimelineModelLoader(this, fileReader, prog
ress); | 398 var loader = new WebInspector.TimelineModelLoader(this, fileReader, prog
ress); |
| 399 fileReader.start(loader); | 399 fileReader.start(loader); |
| 400 }, | 400 }, |
| 401 | 401 |
| 402 /** | 402 /** |
| 403 * @param {string} url | 403 * @param {string} url |
| 404 * @param {!WebInspector.Progress} progress |
| 404 */ | 405 */ |
| 405 loadFromURL: function(url, progress) | 406 loadFromURL: function(url, progress) |
| 406 { | 407 { |
| 407 var delegate = new WebInspector.TimelineModelLoadFromFileDelegate(this,
progress); | 408 var delegate = new WebInspector.TimelineModelLoadFromFileDelegate(this,
progress); |
| 408 var urlReader = new WebInspector.ChunkedXHRReader(url, delegate); | 409 var urlReader = new WebInspector.ChunkedXHRReader(url, delegate); |
| 409 var loader = new WebInspector.TimelineModelLoader(this, urlReader, progr
ess); | 410 var loader = new WebInspector.TimelineModelLoader(this, urlReader, progr
ess); |
| 410 urlReader.start(loader); | 411 urlReader.start(loader); |
| 411 }, | 412 }, |
| 412 | 413 |
| 413 _createFileReader: function(file, delegate) | 414 _createFileReader: function(file, delegate) |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 } | 1082 } |
| 1082 }, | 1083 }, |
| 1083 | 1084 |
| 1084 onTransferFinished: function() | 1085 onTransferFinished: function() |
| 1085 { | 1086 { |
| 1086 this._progress.done(); | 1087 this._progress.done(); |
| 1087 }, | 1088 }, |
| 1088 | 1089 |
| 1089 /** | 1090 /** |
| 1090 * @param {!WebInspector.ChunkedReader} reader | 1091 * @param {!WebInspector.ChunkedReader} reader |
| 1092 * @param {!Event} event |
| 1091 */ | 1093 */ |
| 1092 onError: function(reader, event) | 1094 onError: function(reader, event) |
| 1093 { | 1095 { |
| 1094 this._progress.done(); | 1096 this._progress.done(); |
| 1095 this._model.reset(); | 1097 this._model.reset(); |
| 1096 switch (event.target.error.code) { | 1098 switch (event.target.error.code) { |
| 1097 case FileError.NOT_FOUND_ERR: | 1099 case FileError.NOT_FOUND_ERR: |
| 1098 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("File
\"%s\" not found.", reader.fileName()), true); | 1100 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("File
\"%s\" not found.", reader.fileName()), true); |
| 1099 break; | 1101 break; |
| 1100 case FileError.NOT_READABLE_ERR: | 1102 case FileError.NOT_READABLE_ERR: |
| 1101 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("File
\"%s\" is not readable", reader.fileName()), true); | 1103 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("File
\"%s\" is not readable", reader.fileName()), true); |
| 1102 break; | 1104 break; |
| 1103 case FileError.ABORT_ERR: | 1105 case FileError.ABORT_ERR: |
| 1104 break; | 1106 break; |
| 1105 default: | 1107 default: |
| 1106 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("An e
rror occurred while reading the file \"%s\"", reader.fileName()), true); | 1108 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("An e
rror occurred while reading the file \"%s\"", reader.fileName()), true); |
| 1107 } | 1109 } |
| 1108 } | 1110 } |
| 1109 } | 1111 } |
| 1110 | 1112 |
| 1111 /** | 1113 /** |
| 1112 * @constructor | 1114 * @constructor |
| 1115 * @param {!WebInspector.OutputStream} stream |
| 1113 */ | 1116 */ |
| 1114 WebInspector.TimelineSaver = function(stream) | 1117 WebInspector.TimelineSaver = function(stream) |
| 1115 { | 1118 { |
| 1116 this._stream = stream; | 1119 this._stream = stream; |
| 1117 } | 1120 } |
| 1118 | 1121 |
| 1119 WebInspector.TimelineSaver.prototype = { | 1122 WebInspector.TimelineSaver.prototype = { |
| 1120 /** | 1123 /** |
| 1121 * @param {!Array.<*>} payloads | 1124 * @param {!Array.<*>} payloads |
| 1122 * @param {string} version | 1125 * @param {string} version |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 function recordTimestampComparator(a, b) | 1195 function recordTimestampComparator(a, b) |
| 1193 { | 1196 { |
| 1194 // Never return 0, as the merge function will squash identical entri
es. | 1197 // Never return 0, as the merge function will squash identical entri
es. |
| 1195 return a.startTime() < b.startTime() ? -1 : 1; | 1198 return a.startTime() < b.startTime() ? -1 : 1; |
| 1196 } | 1199 } |
| 1197 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT
imestampComparator); | 1200 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT
imestampComparator); |
| 1198 this._backgroundRecordsBuffer = []; | 1201 this._backgroundRecordsBuffer = []; |
| 1199 return result; | 1202 return result; |
| 1200 } | 1203 } |
| 1201 } | 1204 } |
| OLD | NEW |