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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineModel.js

Issue 322783002: Initialize min/max record time to 0 instead of -1 or null (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
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
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
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 (endTime > this._maximumRecordTime)
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
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 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineFlameChart.js ('k') | Source/devtools/front_end/timeline/TimelineOverviewPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698