| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @implements {WebInspector.FlameChartDataProvider} | 33 * @implements {WebInspector.FlameChartDataProvider} |
| 34 * @implements {WebInspector.TimelineFlameChart.SelectionProvider} | |
| 35 * @param {!WebInspector.TimelineModelImpl} model | |
| 36 * @param {!WebInspector.TimelineFrameModelBase} frameModel | |
| 37 * @param {!WebInspector.TimelineUIUtils} uiUtils | |
| 38 */ | |
| 39 WebInspector.TimelineFlameChartDataProvider = function(model, frameModel, uiUtil
s) | |
| 40 { | |
| 41 WebInspector.FlameChartDataProvider.call(this); | |
| 42 this._model = model; | |
| 43 this._frameModel = frameModel; | |
| 44 this._uiUtils = uiUtils; | |
| 45 this._font = "12px " + WebInspector.fontFamily(); | |
| 46 this._linkifier = new WebInspector.Linkifier(); | |
| 47 } | |
| 48 | |
| 49 WebInspector.TimelineFlameChartDataProvider.prototype = { | |
| 50 /** | |
| 51 * @return {number} | |
| 52 */ | |
| 53 barHeight: function() | |
| 54 { | |
| 55 return 20; | |
| 56 }, | |
| 57 | |
| 58 /** | |
| 59 * @return {number} | |
| 60 */ | |
| 61 textBaseline: function() | |
| 62 { | |
| 63 return 6; | |
| 64 }, | |
| 65 | |
| 66 /** | |
| 67 * @return {number} | |
| 68 */ | |
| 69 textPadding: function() | |
| 70 { | |
| 71 return 5; | |
| 72 }, | |
| 73 | |
| 74 /** | |
| 75 * @param {number} entryIndex | |
| 76 * @return {string} | |
| 77 */ | |
| 78 entryFont: function(entryIndex) | |
| 79 { | |
| 80 return this._font; | |
| 81 }, | |
| 82 | |
| 83 /** | |
| 84 * @param {number} entryIndex | |
| 85 * @return {?string} | |
| 86 */ | |
| 87 entryTitle: function(entryIndex) | |
| 88 { | |
| 89 var record = this._records[entryIndex]; | |
| 90 if (record === this._cpuThreadRecord) | |
| 91 return WebInspector.UIString("CPU"); | |
| 92 else if (record === this._gpuThreadRecord) | |
| 93 return WebInspector.UIString("GPU"); | |
| 94 var details = this._uiUtils.buildDetailsNode(record, this._linkifier, th
is._model.loadedFromFile()); | |
| 95 var title = this._uiUtils.titleForRecord(record); | |
| 96 return details ? WebInspector.UIString("%s (%s)", title, details.textCon
tent) : title; | |
| 97 }, | |
| 98 | |
| 99 /** | |
| 100 * @param {number} startTime | |
| 101 * @param {number} endTime | |
| 102 * @return {?Array.<number>} | |
| 103 */ | |
| 104 dividerOffsets: function(startTime, endTime) | |
| 105 { | |
| 106 // While we have tracing and timeline flame chart on screen at a time, | |
| 107 // we don't want to render frame-based grid. | |
| 108 return null; | |
| 109 }, | |
| 110 | |
| 111 reset: function() | |
| 112 { | |
| 113 this._timelineData = null; | |
| 114 }, | |
| 115 | |
| 116 /** | |
| 117 * @return {!WebInspector.FlameChart.TimelineData} | |
| 118 */ | |
| 119 timelineData: function() | |
| 120 { | |
| 121 if (this._timelineData) | |
| 122 return this._timelineData; | |
| 123 | |
| 124 this._linkifier.reset(); | |
| 125 | |
| 126 /** | |
| 127 * @type {?WebInspector.FlameChart.TimelineData} | |
| 128 */ | |
| 129 this._timelineData = { | |
| 130 entryLevels: [], | |
| 131 entryTotalTimes: [], | |
| 132 entryStartTimes: [] | |
| 133 }; | |
| 134 | |
| 135 this._records = []; | |
| 136 this._entryThreadDepths = {}; | |
| 137 this._minimumBoundary = this._model.minimumRecordTime(); | |
| 138 | |
| 139 this._cpuThreadRecord = this._uiUtils.createProgramRecord(this._model); | |
| 140 this._pushRecord(this._cpuThreadRecord, 0, this.minimumBoundary(), Math.
max(this._model.maximumRecordTime(), this.totalTime() + this.minimumBoundary()))
; | |
| 141 | |
| 142 this._gpuThreadRecord = null; | |
| 143 | |
| 144 var records = this._model.records(); | |
| 145 for (var i = 0; i < records.length; ++i) { | |
| 146 var record = records[i]; | |
| 147 var thread = record.thread(); | |
| 148 if (thread === "gpu") | |
| 149 continue; | |
| 150 if (thread === WebInspector.TimelineModel.MainThreadName) { | |
| 151 for (var j = 0; j < record.children().length; ++j) | |
| 152 this._appendRecord(record.children()[j], 1); | |
| 153 } else { | |
| 154 var visible = this._appendRecord(records[i], 1); | |
| 155 if (visible && !this._gpuThreadRecord) { | |
| 156 this._gpuThreadRecord = this._uiUtils.createProgramRecord(th
is._model); | |
| 157 this._pushRecord(this._gpuThreadRecord, 0, this.minimumBound
ary(), Math.max(this._model.maximumRecordTime(), this.totalTime() + this.minimum
Boundary())); | |
| 158 } | |
| 159 } | |
| 160 } | |
| 161 | |
| 162 var cpuStackDepth = Math.max(4, this._entryThreadDepths[WebInspector.Tim
elineModel.MainThreadName]); | |
| 163 delete this._entryThreadDepths[WebInspector.TimelineModel.MainThreadName
]; | |
| 164 this._maxStackDepth = cpuStackDepth; | |
| 165 | |
| 166 if (this._gpuThreadRecord) { | |
| 167 // We have multiple threads, update levels. | |
| 168 var threadBaselines = {}; | |
| 169 var threadBaseline = cpuStackDepth + 2; | |
| 170 | |
| 171 for (var thread in this._entryThreadDepths) { | |
| 172 threadBaselines[thread] = threadBaseline; | |
| 173 threadBaseline += this._entryThreadDepths[thread]; | |
| 174 } | |
| 175 this._maxStackDepth = threadBaseline; | |
| 176 | |
| 177 for (var i = 0; i < this._records.length; ++i) { | |
| 178 var record = this._records[i]; | |
| 179 var level = this._timelineData.entryLevels[i]; | |
| 180 if (record === this._cpuThreadRecord) | |
| 181 level = 0; | |
| 182 else if (record === this._gpuThreadRecord) | |
| 183 level = cpuStackDepth + 2; | |
| 184 else if (record.thread() !== WebInspector.TimelineModel.MainThre
adName) | |
| 185 level += threadBaselines[record.thread()]; | |
| 186 this._timelineData.entryLevels[i] = level; | |
| 187 } | |
| 188 } | |
| 189 | |
| 190 return this._timelineData; | |
| 191 }, | |
| 192 | |
| 193 /** | |
| 194 * @return {number} | |
| 195 */ | |
| 196 minimumBoundary: function() | |
| 197 { | |
| 198 return this._minimumBoundary; | |
| 199 }, | |
| 200 | |
| 201 /** | |
| 202 * @return {number} | |
| 203 */ | |
| 204 totalTime: function() | |
| 205 { | |
| 206 return Math.max(1000, this._model.maximumRecordTime() - this._model.mini
mumRecordTime()); | |
| 207 }, | |
| 208 | |
| 209 /** | |
| 210 * @return {number} | |
| 211 */ | |
| 212 maxStackDepth: function() | |
| 213 { | |
| 214 return this._maxStackDepth; | |
| 215 }, | |
| 216 | |
| 217 /** | |
| 218 * @param {!WebInspector.TimelineModel.Record} record | |
| 219 * @param {number} level | |
| 220 * @return {boolean} | |
| 221 */ | |
| 222 _appendRecord: function(record, level) | |
| 223 { | |
| 224 var result = false; | |
| 225 if (!this._model.isVisible(record)) { | |
| 226 for (var i = 0; i < record.children().length; ++i) | |
| 227 result = this._appendRecord(record.children()[i], level) || resu
lt; | |
| 228 return result; | |
| 229 } | |
| 230 | |
| 231 this._pushRecord(record, level, record.startTime(), record.endTime()); | |
| 232 for (var i = 0; i < record.children().length; ++i) | |
| 233 this._appendRecord(record.children()[i], level + 1); | |
| 234 return true; | |
| 235 }, | |
| 236 | |
| 237 /** | |
| 238 * @param {!WebInspector.TimelineModel.Record} record | |
| 239 * @param {number} level | |
| 240 * @param {number} startTime | |
| 241 * @param {number} endTime | |
| 242 * @return {number} | |
| 243 */ | |
| 244 _pushRecord: function(record, level, startTime, endTime) | |
| 245 { | |
| 246 var index = this._records.length; | |
| 247 this._records.push(record); | |
| 248 this._timelineData.entryStartTimes[index] = startTime; | |
| 249 this._timelineData.entryLevels[index] = level; | |
| 250 this._timelineData.entryTotalTimes[index] = endTime - startTime; | |
| 251 this._entryThreadDepths[record.thread()] = Math.max(level, this._entryTh
readDepths[record.thread()] || 0); | |
| 252 return index; | |
| 253 }, | |
| 254 | |
| 255 /** | |
| 256 * @param {number} entryIndex | |
| 257 * @return {?Array.<!{title: string, text: string}>} | |
| 258 */ | |
| 259 prepareHighlightedEntryInfo: function(entryIndex) | |
| 260 { | |
| 261 return null; | |
| 262 }, | |
| 263 | |
| 264 /** | |
| 265 * @param {number} entryIndex | |
| 266 * @return {boolean} | |
| 267 */ | |
| 268 canJumpToEntry: function(entryIndex) | |
| 269 { | |
| 270 return false; | |
| 271 }, | |
| 272 | |
| 273 /** | |
| 274 * @param {number} entryIndex | |
| 275 * @return {string} | |
| 276 */ | |
| 277 entryColor: function(entryIndex) | |
| 278 { | |
| 279 var record = this._records[entryIndex]; | |
| 280 if (record === this._cpuThreadRecord || record === this._gpuThreadRecord
) | |
| 281 return "#555"; | |
| 282 | |
| 283 if (record.type() === WebInspector.TimelineModel.RecordType.JSFrame) | |
| 284 return WebInspector.TimelineFlameChartDataProvider.jsFrameColorGener
ator().colorForID(record.data()["functionName"]); | |
| 285 | |
| 286 return this._uiUtils.categoryForRecord(record).fillColorStop1; | |
| 287 }, | |
| 288 | |
| 289 | |
| 290 /** | |
| 291 * @param {number} entryIndex | |
| 292 * @param {!CanvasRenderingContext2D} context | |
| 293 * @param {?string} text | |
| 294 * @param {number} barX | |
| 295 * @param {number} barY | |
| 296 * @param {number} barWidth | |
| 297 * @param {number} barHeight | |
| 298 * @param {function(number):number} offsetToPosition | |
| 299 * @return {boolean} | |
| 300 */ | |
| 301 decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, bar
Height, offsetToPosition) | |
| 302 { | |
| 303 if (barWidth < 5) | |
| 304 return false; | |
| 305 | |
| 306 var record = this._records[entryIndex]; | |
| 307 var timelineData = this._timelineData; | |
| 308 | |
| 309 var category = this._uiUtils.categoryForRecord(record); | |
| 310 // Paint text using white color on dark background. | |
| 311 if (text) { | |
| 312 context.save(); | |
| 313 context.fillStyle = "white"; | |
| 314 context.shadowColor = "rgba(0, 0, 0, 0.1)"; | |
| 315 context.shadowOffsetX = 1; | |
| 316 context.shadowOffsetY = 1; | |
| 317 context.font = this._font; | |
| 318 context.fillText(text, barX + this.textPadding(), barY + barHeight -
this.textBaseline()); | |
| 319 context.restore(); | |
| 320 } | |
| 321 | |
| 322 if (record.children().length) { | |
| 323 var entryStartTime = timelineData.entryStartTimes[entryIndex]; | |
| 324 var barSelf = offsetToPosition(entryStartTime + record.selfTime()) | |
| 325 | |
| 326 context.beginPath(); | |
| 327 context.fillStyle = category.backgroundColor; | |
| 328 context.rect(barSelf, barY, barX + barWidth - barSelf, barHeight); | |
| 329 context.fill(); | |
| 330 | |
| 331 // Paint text using dark color on light background. | |
| 332 if (text) { | |
| 333 context.save(); | |
| 334 context.clip(); | |
| 335 context.fillStyle = category.borderColor; | |
| 336 context.shadowColor = "rgba(0, 0, 0, 0.1)"; | |
| 337 context.shadowOffsetX = 1; | |
| 338 context.shadowOffsetY = 1; | |
| 339 context.fillText(text, barX + this.textPadding(), barY + barHeig
ht - this.textBaseline()); | |
| 340 context.restore(); | |
| 341 } | |
| 342 } | |
| 343 | |
| 344 if (record.warnings()) { | |
| 345 context.save(); | |
| 346 | |
| 347 context.rect(barX, barY, barWidth, this.barHeight()); | |
| 348 context.clip(); | |
| 349 | |
| 350 context.beginPath(); | |
| 351 context.fillStyle = record.warnings() ? "red" : "rgba(255, 0, 0, 0.5
)"; | |
| 352 context.moveTo(barX + barWidth - 15, barY + 1); | |
| 353 context.lineTo(barX + barWidth - 1, barY + 1); | |
| 354 context.lineTo(barX + barWidth - 1, barY + 15); | |
| 355 context.fill(); | |
| 356 | |
| 357 context.restore(); | |
| 358 } | |
| 359 | |
| 360 return true; | |
| 361 }, | |
| 362 | |
| 363 /** | |
| 364 * @param {number} entryIndex | |
| 365 * @return {boolean} | |
| 366 */ | |
| 367 forceDecoration: function(entryIndex) | |
| 368 { | |
| 369 var record = this._records[entryIndex]; | |
| 370 return !!record.warnings(); | |
| 371 }, | |
| 372 | |
| 373 /** | |
| 374 * @param {number} entryIndex | |
| 375 * @return {?{startTime: number, endTime: number}} | |
| 376 */ | |
| 377 highlightTimeRange: function(entryIndex) | |
| 378 { | |
| 379 var record = this._records[entryIndex]; | |
| 380 if (record === this._cpuThreadRecord || record === this._gpuThreadRecord
) | |
| 381 return null; | |
| 382 return { | |
| 383 startTime: record.startTime(), | |
| 384 endTime: record.endTime() | |
| 385 }; | |
| 386 }, | |
| 387 | |
| 388 /** | |
| 389 * @return {number} | |
| 390 */ | |
| 391 paddingLeft: function() | |
| 392 { | |
| 393 return 0; | |
| 394 }, | |
| 395 | |
| 396 /** | |
| 397 * @param {number} entryIndex | |
| 398 * @return {string} | |
| 399 */ | |
| 400 textColor: function(entryIndex) | |
| 401 { | |
| 402 return "white"; | |
| 403 }, | |
| 404 | |
| 405 /** | |
| 406 * @param {number} entryIndex | |
| 407 * @return {?WebInspector.TimelineSelection} | |
| 408 */ | |
| 409 createSelection: function(entryIndex) | |
| 410 { | |
| 411 var record = this._records[entryIndex]; | |
| 412 if (record instanceof WebInspector.TimelineModel.RecordImpl) { | |
| 413 this._lastSelection = new WebInspector.TimelineFlameChart.Selection(
WebInspector.TimelineSelection.fromRecord(record), entryIndex); | |
| 414 return this._lastSelection.timelineSelection; | |
| 415 } | |
| 416 return null; | |
| 417 }, | |
| 418 | |
| 419 /** | |
| 420 * @param {?WebInspector.TimelineSelection} selection | |
| 421 * @return {number} | |
| 422 */ | |
| 423 entryIndexForSelection: function(selection) | |
| 424 { | |
| 425 if (!selection || selection.type() !== WebInspector.TimelineSelection.Ty
pe.Record) | |
| 426 return -1; | |
| 427 var record = /** @type{!WebInspector.TimelineModel.Record} */ (selection
.object()); | |
| 428 if (this._lastSelection && this._lastSelection.timelineSelection.object(
) === record) | |
| 429 return this._lastSelection.entryIndex; | |
| 430 var entryRecords = this._records; | |
| 431 for (var entryIndex = 0; entryIndex < entryRecords.length; ++entryIndex)
{ | |
| 432 if (entryRecords[entryIndex] === record) { | |
| 433 this._lastSelection = new WebInspector.TimelineFlameChart.Select
ion(WebInspector.TimelineSelection.fromRecord(record), entryIndex); | |
| 434 return entryIndex; | |
| 435 } | |
| 436 } | |
| 437 return -1; | |
| 438 } | |
| 439 } | |
| 440 | |
| 441 /** | |
| 442 * @constructor | |
| 443 * @implements {WebInspector.FlameChartDataProvider} | |
| 444 * @implements {WebInspector.TimelineFlameChart.SelectionProvider} | |
| 445 * @param {!WebInspector.TracingTimelineModel} model | 34 * @param {!WebInspector.TracingTimelineModel} model |
| 446 * @param {!WebInspector.TimelineFrameModelBase} frameModel | 35 * @param {!WebInspector.TimelineFrameModelBase} frameModel |
| 447 * @param {!WebInspector.Target} target | 36 * @param {!WebInspector.Target} target |
| 448 */ | 37 */ |
| 449 WebInspector.TracingBasedTimelineFlameChartDataProvider = function(model, frameM
odel, target) | 38 WebInspector.TracingBasedTimelineFlameChartDataProvider = function(model, frameM
odel, target) |
| 450 { | 39 { |
| 451 WebInspector.FlameChartDataProvider.call(this); | 40 WebInspector.FlameChartDataProvider.call(this); |
| 452 this._model = model; | 41 this._model = model; |
| 453 this._frameModel = frameModel; | 42 this._frameModel = frameModel; |
| 454 this._target = target; | 43 this._target = target; |
| 455 this._font = "12px " + WebInspector.fontFamily(); | 44 this._font = "12px " + WebInspector.fontFamily(); |
| 456 this._linkifier = new WebInspector.Linkifier(); | 45 this._linkifier = new WebInspector.Linkifier(); |
| 457 this._palette = new WebInspector.TraceViewPalette(); | |
| 458 this._entryIndexToTitle = {}; | 46 this._entryIndexToTitle = {}; |
| 459 this._filters = []; | 47 this._filters = []; |
| 460 this.addFilter(WebInspector.TracingTimelineUIUtils.hiddenEventsFilter()); | 48 this.addFilter(WebInspector.TracingTimelineUIUtils.hiddenEventsFilter()); |
| 461 this.addFilter(new WebInspector.TracingTimelineModel.ExclusiveEventNameFilte
r([WebInspector.TracingTimelineModel.RecordType.Program])); | 49 this.addFilter(new WebInspector.TracingTimelineModel.ExclusiveEventNameFilte
r([WebInspector.TracingTimelineModel.RecordType.Program])); |
| 462 } | 50 } |
| 463 | 51 |
| 464 WebInspector.TracingBasedTimelineFlameChartDataProvider.InstantEventVisibleDurat
ionMs = 0.01; | 52 WebInspector.TracingBasedTimelineFlameChartDataProvider.InstantEventVisibleDurat
ionMs = 0.01; |
| 465 | 53 |
| 466 WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = { | 54 WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = { |
| 467 /** | 55 /** |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 /** | 282 /** |
| 695 * @param {number} entryIndex | 283 * @param {number} entryIndex |
| 696 * @return {string} | 284 * @return {string} |
| 697 */ | 285 */ |
| 698 entryColor: function(entryIndex) | 286 entryColor: function(entryIndex) |
| 699 { | 287 { |
| 700 var event = this._entryEvents[entryIndex]; | 288 var event = this._entryEvents[entryIndex]; |
| 701 if (!event) | 289 if (!event) |
| 702 return "#555"; | 290 return "#555"; |
| 703 if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFrame) | 291 if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFrame) |
| 704 return WebInspector.TimelineFlameChartDataProvider.jsFrameColorGener
ator().colorForID(event.args.data["functionName"]); | 292 return WebInspector.TracingBasedTimelineFlameChartDataProvider.jsFra
meColorGenerator().colorForID(event.args.data["functionName"]); |
| 705 var style = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event
.name); | 293 var style = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event
.name); |
| 706 return style.category.fillColorStop1; | 294 return style.category.fillColorStop1; |
| 707 }, | 295 }, |
| 708 | 296 |
| 709 /** | 297 /** |
| 710 * @param {number} entryIndex | 298 * @param {number} entryIndex |
| 711 * @param {!CanvasRenderingContext2D} context | 299 * @param {!CanvasRenderingContext2D} context |
| 712 * @param {?string} text | 300 * @param {?string} text |
| 713 * @param {number} barX | 301 * @param {number} barX |
| 714 * @param {number} barY | 302 * @param {number} barY |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 return entryIndex; | 446 return entryIndex; |
| 859 } | 447 } |
| 860 } | 448 } |
| 861 return -1; | 449 return -1; |
| 862 } | 450 } |
| 863 } | 451 } |
| 864 | 452 |
| 865 /** | 453 /** |
| 866 * @return {!WebInspector.FlameChart.ColorGenerator} | 454 * @return {!WebInspector.FlameChart.ColorGenerator} |
| 867 */ | 455 */ |
| 868 WebInspector.TimelineFlameChartDataProvider.jsFrameColorGenerator = function() | 456 WebInspector.TracingBasedTimelineFlameChartDataProvider.jsFrameColorGenerator =
function() |
| 869 { | 457 { |
| 870 if (!WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator) { | 458 if (!WebInspector.TracingBasedTimelineFlameChartDataProvider._jsFrameColorGe
nerator) { |
| 871 var hueSpace = { min: 30, max: 55, count: 5 }; | 459 var hueSpace = { min: 30, max: 55, count: 5 }; |
| 872 var satSpace = { min: 70, max: 100, count: 6 }; | 460 var satSpace = { min: 70, max: 100, count: 6 }; |
| 873 var colorGenerator = new WebInspector.FlameChart.ColorGenerator(hueSpace
, satSpace, 50); | 461 var colorGenerator = new WebInspector.FlameChart.ColorGenerator(hueSpace
, satSpace, 50); |
| 874 colorGenerator.setColorForID("(idle)", "hsl(0, 0%, 60%)"); | 462 colorGenerator.setColorForID("(idle)", "hsl(0, 0%, 60%)"); |
| 875 colorGenerator.setColorForID("(program)", "hsl(0, 0%, 60%)"); | 463 colorGenerator.setColorForID("(program)", "hsl(0, 0%, 60%)"); |
| 876 colorGenerator.setColorForID("(garbage collector)", "hsl(0, 0%, 60%)"); | 464 colorGenerator.setColorForID("(garbage collector)", "hsl(0, 0%, 60%)"); |
| 877 WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator = col
orGenerator; | 465 WebInspector.TracingBasedTimelineFlameChartDataProvider._jsFrameColorGen
erator = colorGenerator; |
| 878 } | 466 } |
| 879 return WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator; | 467 return WebInspector.TracingBasedTimelineFlameChartDataProvider._jsFrameColor
Generator; |
| 880 } | 468 } |
| 881 | 469 |
| 882 /** | 470 /** |
| 883 * @constructor | 471 * @constructor |
| 884 * @extends {WebInspector.VBox} | 472 * @extends {WebInspector.VBox} |
| 885 * @implements {WebInspector.TimelineModeView} | 473 * @implements {WebInspector.TimelineModeView} |
| 886 * @implements {WebInspector.FlameChartDelegate} | 474 * @implements {WebInspector.FlameChartDelegate} |
| 887 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 475 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
| 888 * @param {!WebInspector.TimelineModel} model | 476 * @param {!WebInspector.TracingTimelineModel} tracingModel |
| 889 * @param {?WebInspector.TracingTimelineModel} tracingModel | |
| 890 * @param {!WebInspector.TimelineFrameModelBase} frameModel | 477 * @param {!WebInspector.TimelineFrameModelBase} frameModel |
| 891 * @param {!WebInspector.TimelineUIUtils} uiUtils | |
| 892 */ | 478 */ |
| 893 WebInspector.TimelineFlameChart = function(delegate, model, tracingModel, frameM
odel, uiUtils) | 479 WebInspector.TimelineFlameChart = function(delegate, tracingModel, frameModel) |
| 894 { | 480 { |
| 895 WebInspector.VBox.call(this); | 481 WebInspector.VBox.call(this); |
| 896 this.element.classList.add("timeline-flamechart"); | 482 this.element.classList.add("timeline-flamechart"); |
| 897 this.registerRequiredCSS("flameChart.css"); | 483 this.registerRequiredCSS("flameChart.css"); |
| 898 this._delegate = delegate; | 484 this._delegate = delegate; |
| 899 this._model = model; | 485 this._model = tracingModel; |
| 900 this._dataProvider = tracingModel | 486 this._dataProvider = new WebInspector.TracingBasedTimelineFlameChartDataProv
ider(tracingModel, frameModel, tracingModel.target()) |
| 901 ? new WebInspector.TracingBasedTimelineFlameChartDataProvider(tracingMod
el, frameModel, model.target()) | |
| 902 : new WebInspector.TimelineFlameChartDataProvider(/** @type {!WebInspect
or.TimelineModelImpl} */(model), frameModel, uiUtils); | |
| 903 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true)
; | 487 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true)
; |
| 904 this._mainView.show(this.element); | 488 this._mainView.show(this.element); |
| 905 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar
ted, this._onRecordingStarted, this); | 489 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar
ted, this._onRecordingStarted, this); |
| 906 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected
, this._onEntrySelected, this); | 490 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected
, this._onEntrySelected, this); |
| 907 } | 491 } |
| 908 | 492 |
| 909 WebInspector.TimelineFlameChart.prototype = { | 493 WebInspector.TimelineFlameChart.prototype = { |
| 910 dispose: function() | 494 dispose: function() |
| 911 { | 495 { |
| 912 this._model.removeEventListener(WebInspector.TimelineModel.Events.Record
ingStarted, this._onRecordingStarted, this); | 496 this._model.removeEventListener(WebInspector.TimelineModel.Events.Record
ingStarted, this._onRecordingStarted, this); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 /** | 620 /** |
| 1037 * @constructor | 621 * @constructor |
| 1038 * @param {!WebInspector.TimelineSelection} selection | 622 * @param {!WebInspector.TimelineSelection} selection |
| 1039 * @param {number} entryIndex | 623 * @param {number} entryIndex |
| 1040 */ | 624 */ |
| 1041 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) | 625 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) |
| 1042 { | 626 { |
| 1043 this.timelineSelection = selection; | 627 this.timelineSelection = selection; |
| 1044 this.entryIndex = entryIndex; | 628 this.entryIndex = entryIndex; |
| 1045 } | 629 } |
| 1046 | |
| 1047 /** | |
| 1048 * @interface | |
| 1049 */ | |
| 1050 WebInspector.TimelineFlameChart.SelectionProvider = function() { } | |
| 1051 | |
| 1052 WebInspector.TimelineFlameChart.SelectionProvider.prototype = { | |
| 1053 /** | |
| 1054 * @param {number} entryIndex | |
| 1055 * @return {?WebInspector.TimelineSelection} | |
| 1056 */ | |
| 1057 createSelection: function(entryIndex) { }, | |
| 1058 /** | |
| 1059 * @param {?WebInspector.TimelineSelection} selection | |
| 1060 * @return {number} | |
| 1061 */ | |
| 1062 entryIndexForSelection: function(selection) { } | |
| 1063 } | |
| OLD | NEW |