| 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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 return; | 1048 return; |
| 1049 | 1049 |
| 1050 // Prepending "0" to turn string into valid JSON. | 1050 // Prepending "0" to turn string into valid JSON. |
| 1051 if (!this._firstChunk) | 1051 if (!this._firstChunk) |
| 1052 json = "[0" + json; | 1052 json = "[0" + json; |
| 1053 | 1053 |
| 1054 var items; | 1054 var items; |
| 1055 try { | 1055 try { |
| 1056 items = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ (JSON.p
arse(json)); | 1056 items = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ (JSON.p
arse(json)); |
| 1057 } catch (e) { | 1057 } catch (e) { |
| 1058 WebInspector.console.showErrorMessage("Malformed timeline data."); | 1058 WebInspector.messageSink.addErrorMessage("Malformed timeline data.",
true); |
| 1059 this._model.reset(); | 1059 this._model.reset(); |
| 1060 this._reader.cancel(); | 1060 this._reader.cancel(); |
| 1061 this._progress.done(); | 1061 this._progress.done(); |
| 1062 return; | 1062 return; |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 if (this._firstChunk) { | 1065 if (this._firstChunk) { |
| 1066 this._version = items[0]; | 1066 this._version = items[0]; |
| 1067 this._firstChunk = false; | 1067 this._firstChunk = false; |
| 1068 this._model.reset(); | 1068 this._model.reset(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 | 1123 |
| 1124 /** | 1124 /** |
| 1125 * @param {!WebInspector.ChunkedReader} reader | 1125 * @param {!WebInspector.ChunkedReader} reader |
| 1126 */ | 1126 */ |
| 1127 onError: function(reader, event) | 1127 onError: function(reader, event) |
| 1128 { | 1128 { |
| 1129 this._progress.done(); | 1129 this._progress.done(); |
| 1130 this._model.reset(); | 1130 this._model.reset(); |
| 1131 switch (event.target.error.code) { | 1131 switch (event.target.error.code) { |
| 1132 case FileError.NOT_FOUND_ERR: | 1132 case FileError.NOT_FOUND_ERR: |
| 1133 WebInspector.console.showErrorMessage(WebInspector.UIString("File \"
%s\" not found.", reader.fileName())); | 1133 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("File
\"%s\" not found.", reader.fileName()), true); |
| 1134 break; | 1134 break; |
| 1135 case FileError.NOT_READABLE_ERR: | 1135 case FileError.NOT_READABLE_ERR: |
| 1136 WebInspector.console.showErrorMessage(WebInspector.UIString("File \"
%s\" is not readable", reader.fileName())); | 1136 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("File
\"%s\" is not readable", reader.fileName()), true); |
| 1137 break; | 1137 break; |
| 1138 case FileError.ABORT_ERR: | 1138 case FileError.ABORT_ERR: |
| 1139 break; | 1139 break; |
| 1140 default: | 1140 default: |
| 1141 WebInspector.console.showErrorMessage(WebInspector.UIString("An erro
r occurred while reading the file \"%s\"", reader.fileName())); | 1141 WebInspector.messageSink.addErrorMessage(WebInspector.UIString("An e
rror occurred while reading the file \"%s\"", reader.fileName()), true); |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 /** | 1146 /** |
| 1147 * @constructor | 1147 * @constructor |
| 1148 */ | 1148 */ |
| 1149 WebInspector.TimelineSaver = function(stream) | 1149 WebInspector.TimelineSaver = function(stream) |
| 1150 { | 1150 { |
| 1151 this._stream = stream; | 1151 this._stream = stream; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 function recordTimestampComparator(a, b) | 1227 function recordTimestampComparator(a, b) |
| 1228 { | 1228 { |
| 1229 // Never return 0, as the merge function will squash identical entri
es. | 1229 // Never return 0, as the merge function will squash identical entri
es. |
| 1230 return a.startTime() < b.startTime() ? -1 : 1; | 1230 return a.startTime() < b.startTime() ? -1 : 1; |
| 1231 } | 1231 } |
| 1232 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT
imestampComparator); | 1232 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT
imestampComparator); |
| 1233 this._backgroundRecordsBuffer = []; | 1233 this._backgroundRecordsBuffer = []; |
| 1234 return result; | 1234 return result; |
| 1235 } | 1235 } |
| 1236 } | 1236 } |
| OLD | NEW |