| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 if (frames.length > 30) | 87 if (frames.length > 30) |
| 88 return null; | 88 return null; |
| 89 var offsets = []; | 89 var offsets = []; |
| 90 for (var i = 0; i < frames.length; ++i) | 90 for (var i = 0; i < frames.length; ++i) |
| 91 offsets.push(frames[i].startTimeOffset); | 91 offsets.push(frames[i].startTimeOffset); |
| 92 return frames.length ? offsets : null; | 92 return frames.length ? offsets : null; |
| 93 }, | 93 }, |
| 94 | 94 |
| 95 reset: function() | 95 reset: function() |
| 96 { | 96 { |
| 97 this._invalidate(); | 97 this._timelineData = null; |
| 98 }, | 98 }, |
| 99 | 99 |
| 100 /** | 100 /** |
| 101 * @param {!WebInspector.TimelineModel.Record} record | 101 * @param {!WebInspector.TimelineModel.Record} record |
| 102 */ | 102 */ |
| 103 addRecord: function(record) | 103 addRecord: function(record) |
| 104 { | 104 { |
| 105 this._invalidate(); | 105 WebInspector.TimelineModel.forAllRecords([record], this._appendRecord.bi
nd(this)); |
| 106 }, | |
| 107 | |
| 108 _invalidate: function() | |
| 109 { | |
| 110 this._timelineData = null; | |
| 111 }, | 106 }, |
| 112 | 107 |
| 113 /** | 108 /** |
| 114 * @return {!WebInspector.FlameChart.ColorGenerator} | 109 * @return {!WebInspector.FlameChart.ColorGenerator} |
| 115 */ | 110 */ |
| 116 colorGenerator: function() | 111 colorGenerator: function() |
| 117 { | 112 { |
| 118 return this._colorGenerator; | 113 return this._colorGenerator; |
| 119 }, | 114 }, |
| 120 | 115 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 /** @type {!Array.<string>} */ | 173 /** @type {!Array.<string>} */ |
| 179 this._entryColors = []; | 174 this._entryColors = []; |
| 180 }, | 175 }, |
| 181 | 176 |
| 182 /** | 177 /** |
| 183 * @param {!WebInspector.TimelineModel.Record} record | 178 * @param {!WebInspector.TimelineModel.Record} record |
| 184 * @param {number} depth | 179 * @param {number} depth |
| 185 */ | 180 */ |
| 186 _appendRecord: function(record, depth) | 181 _appendRecord: function(record, depth) |
| 187 { | 182 { |
| 188 var timelineData = this._timelineData; | 183 var timelineData = this.timelineData(); |
| 189 | 184 |
| 190 this._startTime = this._startTime ? Math.min(this._startTime, record.sta
rtTime) : record.startTime; | 185 this._startTime = this._startTime ? Math.min(this._startTime, record.sta
rtTime) : record.startTime; |
| 191 var startTime = this._startTime; | 186 var startTime = this._startTime; |
| 187 this._zeroTime = startTime; |
| 192 var endTime = record.endTime || record.startTime - startTime; | 188 var endTime = record.endTime || record.startTime - startTime; |
| 193 this._endTime = Math.max(this._endTime, endTime); | 189 this._endTime = Math.max(this._endTime, endTime); |
| 194 this._totalTime = Math.max(1000, this._endTime - this._startTime); | 190 this._totalTime = Math.max(1000, this._endTime - this._startTime); |
| 195 | 191 |
| 196 if (this._mainThread) { | 192 if (this._mainThread) { |
| 197 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask ||
!!record.thread) | 193 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask ||
!!record.thread) |
| 198 return; | 194 return; |
| 199 } else { | 195 } else { |
| 200 if (record.type === WebInspector.TimelineModel.RecordType.Program ||
!record.thread) | 196 if (record.type === WebInspector.TimelineModel.RecordType.Program ||
!record.thread) |
| 201 return; | 197 return; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 345 |
| 350 /** | 346 /** |
| 351 * @param {?WebInspector.TimelineModel.Record} record | 347 * @param {?WebInspector.TimelineModel.Record} record |
| 352 */ | 348 */ |
| 353 setSelectedRecord: function(record) | 349 setSelectedRecord: function(record) |
| 354 { | 350 { |
| 355 }, | 351 }, |
| 356 | 352 |
| 357 __proto__: WebInspector.View.prototype | 353 __proto__: WebInspector.View.prototype |
| 358 } | 354 } |
| OLD | NEW |