| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 _resetData: function() | 158 _resetData: function() |
| 159 { | 159 { |
| 160 this._startTime = 0; | 160 this._startTime = 0; |
| 161 this._endTime = 0; | 161 this._endTime = 0; |
| 162 this._maxStackDepth = 5; | 162 this._maxStackDepth = 5; |
| 163 this._totalTime = 1000; | 163 this._totalTime = 1000; |
| 164 this._zeroTime = 0; | 164 this._zeroTime = 0; |
| 165 | 165 |
| 166 this._timelineData = { | 166 this._timelineData = { |
| 167 entryLevels: [], | 167 entryLevels: /** @type {!Array.<number>} */ ([]), |
| 168 entryTotalTimes: [], | 168 entryTotalTimes: /** @type {!Array.<number>} */ ([]), |
| 169 entryOffsets: [], | 169 entryOffsets: /** @type {!Array.<number>} */ ([]), |
| 170 colorEntryIndexes: [] | |
| 171 }; | 170 }; |
| 172 this._entryTitles = []; | 171 |
| 172 /** @type {!Array.<string>} */ |
| 173 this._entryTitles = []; |
| 174 |
| 175 /** @type {!Array.<string>} */ |
| 176 this._entryColors = []; |
| 173 }, | 177 }, |
| 174 | 178 |
| 175 _appendRecord: function(record, depth) | 179 _appendRecord: function(record, depth) |
| 176 { | 180 { |
| 177 var timelineData = this._timelineData; | 181 var timelineData = this._timelineData; |
| 178 | 182 |
| 179 this._startTime = this._startTime ? Math.min(this._startTime, record.sta
rtTime) : record.startTime; | 183 this._startTime = this._startTime ? Math.min(this._startTime, record.sta
rtTime) : record.startTime; |
| 180 var startTime = this._startTime; | 184 var startTime = this._startTime; |
| 181 var endTime = record.endTime || record.startTime - startTime; | 185 var endTime = record.endTime || record.startTime - startTime; |
| 182 this._endTime = Math.max(this._endTime, endTime); | 186 this._endTime = Math.max(this._endTime, endTime); |
| 183 this._totalTime = Math.max(1000, this._endTime - this._startTime); | 187 this._totalTime = Math.max(1000, this._endTime - this._startTime); |
| 184 | 188 |
| 185 if (this._mainThread) { | 189 if (this._mainThread) { |
| 186 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask ||
!!record.thread) | 190 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask ||
!!record.thread) |
| 187 return; | 191 return; |
| 188 } else { | 192 } else { |
| 189 if (record.type === WebInspector.TimelineModel.RecordType.Program ||
!record.thread) | 193 if (record.type === WebInspector.TimelineModel.RecordType.Program ||
!record.thread) |
| 190 return; | 194 return; |
| 191 } | 195 } |
| 192 | 196 |
| 193 var index = this._entryTitles.length; | 197 var index = this._entryTitles.length; |
| 194 this._entryTitles[index] = record.type; | 198 this._entryTitles[index] = record.type; |
| 195 timelineData.entryOffsets[index] = record.startTime - startTime; | 199 timelineData.entryOffsets[index] = record.startTime - startTime; |
| 196 timelineData.entryLevels[index] = depth - 1; | 200 timelineData.entryLevels[index] = depth - 1; |
| 197 timelineData.entryTotalTimes[index] = endTime - record.startTime; | 201 timelineData.entryTotalTimes[index] = endTime - record.startTime; |
| 198 | 202 this._entryColors[index] = this._colorGenerator.colorForID(WebInspector.
TimelineUIUtils.categoryForRecord(record).name); |
| 199 var color = this._colorGenerator.colorForID(WebInspector.TimelineUIUtils
.categoryForRecord(record).name); | |
| 200 var indexesForColor = timelineData.colorEntryIndexes[color.index]; | |
| 201 if (!indexesForColor) | |
| 202 indexesForColor = timelineData.colorEntryIndexes[color.index] = []; | |
| 203 indexesForColor.push(index); | |
| 204 | |
| 205 this._maxStackDepth = Math.max(this._maxStackDepth, depth + 1); | 203 this._maxStackDepth = Math.max(this._maxStackDepth, depth + 1); |
| 206 }, | 204 }, |
| 207 | 205 |
| 208 /** | 206 /** |
| 209 * @param {number} entryIndex | 207 * @param {number} entryIndex |
| 210 * @return {?Array.<!{title: string, text: string}>} | 208 * @return {?Array.<!{title: string, text: string}>} |
| 211 */ | 209 */ |
| 212 prepareHighlightedEntryInfo: function(entryIndex) | 210 prepareHighlightedEntryInfo: function(entryIndex) |
| 213 { | 211 { |
| 214 return null; | 212 return null; |
| 215 }, | 213 }, |
| 216 | 214 |
| 217 /** | 215 /** |
| 218 * @param {number} entryIndex | 216 * @param {number} entryIndex |
| 219 * @return {boolean} | 217 * @return {boolean} |
| 220 */ | 218 */ |
| 221 canJumpToEntry: function(entryIndex) | 219 canJumpToEntry: function(entryIndex) |
| 222 { | 220 { |
| 223 return false; | 221 return false; |
| 224 }, | 222 }, |
| 225 | 223 |
| 226 /** | 224 /** |
| 227 * @param {number} entryIndex | 225 * @param {number} entryIndex |
| 228 * @return {?Object} | 226 * @return {?Object} |
| 229 */ | 227 */ |
| 230 entryData: function(entryIndex) | 228 entryData: function(entryIndex) |
| 231 { | 229 { |
| 232 return null; | 230 return null; |
| 231 }, |
| 232 |
| 233 /** |
| 234 * @param {number} entryIndex |
| 235 * @return {!string} |
| 236 */ |
| 237 entryColor: function(entryIndex) |
| 238 { |
| 239 return this._entryColors[entryIndex]; |
| 233 } | 240 } |
| 234 } | 241 } |
| 235 | 242 |
| 236 /** | 243 /** |
| 237 * @constructor | 244 * @constructor |
| 238 * @extends {WebInspector.View} | 245 * @extends {WebInspector.View} |
| 239 * @implements {WebInspector.TimelineModeView} | 246 * @implements {WebInspector.TimelineModeView} |
| 240 * @implements {WebInspector.TimeRangeController} | 247 * @implements {WebInspector.TimeRangeController} |
| 241 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 248 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
| 242 * @param {!WebInspector.TimelineModel} model | 249 * @param {!WebInspector.TimelineModel} model |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 343 |
| 337 /** | 344 /** |
| 338 * @param {?WebInspector.TimelinePresentationModel.Record} record | 345 * @param {?WebInspector.TimelinePresentationModel.Record} record |
| 339 */ | 346 */ |
| 340 setSelectedRecord: function(record) | 347 setSelectedRecord: function(record) |
| 341 { | 348 { |
| 342 }, | 349 }, |
| 343 | 350 |
| 344 __proto__: WebInspector.View.prototype | 351 __proto__: WebInspector.View.prototype |
| 345 } | 352 } |
| OLD | NEW |