Chromium Code Reviews| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 | 244 |
| 245 saveToFile: function() | 245 saveToFile: function() |
| 246 { | 246 { |
| 247 throw new Error("Not implemented"); | 247 throw new Error("Not implemented"); |
| 248 }, | 248 }, |
| 249 | 249 |
| 250 reset: function() | 250 reset: function() |
| 251 { | 251 { |
| 252 this._loadedFromFile = false; | 252 this._loadedFromFile = false; |
| 253 this._records = []; | 253 this._records = []; |
| 254 this._minimumRecordTime = -1; | 254 this._minimumRecordTime = 0; |
| 255 this._maximumRecordTime = -1; | 255 this._maximumRecordTime = 0; |
| 256 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ | 256 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ |
| 257 this._mainThreadTasks = []; | 257 this._mainThreadTasks = []; |
| 258 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ | 258 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ |
| 259 this._gpuThreadTasks = []; | 259 this._gpuThreadTasks = []; |
| 260 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ | 260 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ |
| 261 this._eventDividerRecords = []; | 261 this._eventDividerRecords = []; |
| 262 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordsC leared); | 262 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordsC leared); |
| 263 }, | 263 }, |
| 264 | 264 |
| 265 /** | 265 /** |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 279 }, | 279 }, |
| 280 | 280 |
| 281 /** | 281 /** |
| 282 * @param {!WebInspector.TimelineModel.Record} record | 282 * @param {!WebInspector.TimelineModel.Record} record |
| 283 */ | 283 */ |
| 284 _updateBoundaries: function(record) | 284 _updateBoundaries: function(record) |
| 285 { | 285 { |
| 286 var startTime = record.startTime(); | 286 var startTime = record.startTime(); |
| 287 var endTime = record.endTime(); | 287 var endTime = record.endTime(); |
| 288 | 288 |
| 289 if (this._minimumRecordTime === -1 || startTime < this._minimumRecordTim e) | 289 if (!this._minimumRecordTime || startTime < this._minimumRecordTime) |
| 290 this._minimumRecordTime = startTime; | 290 this._minimumRecordTime = startTime; |
| 291 if ((this._maximumRecordTime === -1 && endTime) || endTime > this._maxim umRecordTime) | 291 if ((!this._maximumRecordTime && endTime) || endTime > this._maximumReco rdTime) |
|
alph
2014/06/09 09:31:14
Looks like you can drop the part before ||
yurys
2014/06/09 09:46:08
endTime may be undefined and we may end up compari
alph
2014/06/09 10:09:19
According to https://code.google.com/p/chromium/co
yurys
2014/06/09 11:16:36
You're right. I confused that with TracingModel.Ev
| |
| 292 this._maximumRecordTime = endTime; | 292 this._maximumRecordTime = endTime; |
| 293 }, | 293 }, |
| 294 | 294 |
| 295 /** | 295 /** |
| 296 * @return {!Array.<!WebInspector.TimelineModel.Record>} | 296 * @return {!Array.<!WebInspector.TimelineModel.Record>} |
| 297 */ | 297 */ |
| 298 mainThreadTasks: function() | 298 mainThreadTasks: function() |
| 299 { | 299 { |
| 300 return this._mainThreadTasks; | 300 return this._mainThreadTasks; |
| 301 }, | 301 }, |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 function recordTimestampComparator(a, b) | 486 function recordTimestampComparator(a, b) |
| 487 { | 487 { |
| 488 // Never return 0, as the merge function will squash identical entri es. | 488 // Never return 0, as the merge function will squash identical entri es. |
| 489 return a.startTime() < b.startTime() ? -1 : 1; | 489 return a.startTime() < b.startTime() ? -1 : 1; |
| 490 } | 490 } |
| 491 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT imestampComparator); | 491 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT imestampComparator); |
| 492 this._backgroundRecordsBuffer = []; | 492 this._backgroundRecordsBuffer = []; |
| 493 return result; | 493 return result; |
| 494 } | 494 } |
| 495 } | 495 } |
| OLD | NEW |