| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 _isVisible: function(event) | 255 _isVisible: function(event) |
| 256 { | 256 { |
| 257 return this._filters.every(function (filter) { return filter.accept(even
t); }); | 257 return this._filters.every(function (filter) { return filter.accept(even
t); }); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 /** | 261 /** |
| 262 * @enum {symbol} | 262 * @enum {symbol} |
| 263 */ | 263 */ |
| 264 WebInspector.TimelineFlameChartEntryType = { | 264 WebInspector.TimelineFlameChartEntryType = { |
| 265 Header: Symbol("Header"), | |
| 266 Frame: Symbol("Frame"), | 265 Frame: Symbol("Frame"), |
| 267 Event: Symbol("Event"), | 266 Event: Symbol("Event"), |
| 268 InteractionRecord: Symbol("InteractionRecord"), | 267 InteractionRecord: Symbol("InteractionRecord"), |
| 269 }; | 268 }; |
| 270 | 269 |
| 271 /** | 270 /** |
| 272 * @constructor | 271 * @constructor |
| 273 * @extends {WebInspector.TimelineFlameChartDataProviderBase} | 272 * @extends {WebInspector.TimelineFlameChartDataProviderBase} |
| 274 * @param {!WebInspector.TimelineModel} model | 273 * @param {!WebInspector.TimelineModel} model |
| 275 * @param {!WebInspector.TimelineFrameModelBase} frameModel | 274 * @param {!WebInspector.TimelineFrameModelBase} frameModel |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 else | 351 else |
| 353 return WebInspector.TimelineFlameChartDataProviderBase.prototype.tex
tColor.call(this, index); | 352 return WebInspector.TimelineFlameChartDataProviderBase.prototype.tex
tColor.call(this, index); |
| 354 }, | 353 }, |
| 355 | 354 |
| 356 /** | 355 /** |
| 357 * @override | 356 * @override |
| 358 */ | 357 */ |
| 359 reset: function() | 358 reset: function() |
| 360 { | 359 { |
| 361 WebInspector.TimelineFlameChartDataProviderBase.prototype.reset.call(thi
s); | 360 WebInspector.TimelineFlameChartDataProviderBase.prototype.reset.call(thi
s); |
| 362 /** @type {!Array<!WebInspector.TracingModel.Event|!WebInspector.Timelin
eFrame|!WebInspector.TimelineIRModel.Phases|null>} */ | 361 /** @type {!Array<!WebInspector.TracingModel.Event|!WebInspector.Timelin
eFrame|!WebInspector.TimelineIRModel.Phases>} */ |
| 363 this._entryData = []; | 362 this._entryData = []; |
| 364 /** @type {!Array<!WebInspector.TimelineFlameChartEntryType>} */ | 363 /** @type {!Array<!WebInspector.TimelineFlameChartEntryType>} */ |
| 365 this._entryTypeByLevel = []; | 364 this._entryTypeByLevel = []; |
| 366 /** @type {!Array<string>} */ | 365 /** @type {!Array<string>} */ |
| 367 this._entryIndexToTitle = []; | 366 this._entryIndexToTitle = []; |
| 368 /** @type {!Array.<!WebInspector.TimelineFlameChartMarker>} */ | 367 /** @type {!Array.<!WebInspector.TimelineFlameChartMarker>} */ |
| 369 this._markers = []; | 368 this._markers = []; |
| 370 this._asyncColorByCategory = {}; | 369 this._asyncColorByCategory = {}; |
| 371 }, | 370 }, |
| 372 | 371 |
| 373 /** | 372 /** |
| 374 * @override | 373 * @override |
| 375 * @return {!WebInspector.FlameChart.TimelineData} | 374 * @return {!WebInspector.FlameChart.TimelineData} |
| 376 */ | 375 */ |
| 377 timelineData: function() | 376 timelineData: function() |
| 378 { | 377 { |
| 379 if (this._timelineData) | 378 if (this._timelineData) |
| 380 return this._timelineData; | 379 return this._timelineData; |
| 381 | 380 |
| 382 this._timelineData = new WebInspector.FlameChart.TimelineData([], [], []
, []); | 381 this._timelineData = new WebInspector.FlameChart.TimelineData([], [], []
, []); |
| 383 | 382 |
| 384 this._flowEventIndexById = {}; | 383 this._flowEventIndexById = {}; |
| 385 this._minimumBoundary = this._model.minimumRecordTime(); | 384 this._minimumBoundary = this._model.minimumRecordTime(); |
| 386 this._timeSpan = this._model.isEmpty() ? 1000 : this._model.maximumReco
rdTime() - this._minimumBoundary; | 385 this._timeSpan = this._model.isEmpty() ? 1000 : this._model.maximumReco
rdTime() - this._minimumBoundary; |
| 387 this._currentLevel = 0; | 386 this._currentLevel = 0; |
| 388 this._appendFrameBars(this._frameModel.frames()); | 387 this._appendFrameBars(this._frameModel.frames()); |
| 389 this._appendInteractionRecords(); | 388 this._appendInteractionRecords(); |
| 390 this._appendThreadTimelineData(WebInspector.UIString("Main Thread"), thi
s._model.mainThreadEvents(), this._model.mainThreadAsyncEvents(), true); | |
| 391 if (Runtime.experiments.isEnabled("gpuTimeline")) | |
| 392 this._appendGPUEvents(); | |
| 393 | 389 |
| 394 var threads = this._model.virtualThreads(); | 390 var threads = this._model.virtualThreads(); |
| 395 var compositorThreads; | 391 var compositorThreads = threads.filter(thread => thread.name.startsWith(
"CompositorTileWorker")); |
| 396 var otherThreads; | 392 var otherThreads = threads.filter(thread => !thread.name.startsWith("Com
positorTileWorker")); |
| 397 if (Runtime.experiments.isEnabled("timelineCollapsible")) { | |
| 398 compositorThreads = threads.filter(thread => thread.name.startsWith(
"CompositorTileWorker")); | |
| 399 otherThreads = threads.filter(thread => !thread.name.startsWith("Com
positorTileWorker")); | |
| 400 } else { | |
| 401 compositorThreads = []; | |
| 402 otherThreads = threads; | |
| 403 } | |
| 404 otherThreads.forEach(thread => this._appendThreadTimelineData(thread.nam
e, thread.events, thread.asyncEventsByGroup)); | |
| 405 if (compositorThreads.length) { | 393 if (compositorThreads.length) { |
| 406 this._appendHeader(WebInspector.UIString("Rasterizer Threads"), this
._headerLevel1); | 394 this._appendHeader(WebInspector.UIString("Rasterizer Threads"), this
._headerLevel1); |
| 407 for (var i = 0; i < compositorThreads.length; ++i) | 395 for (var i = 0; i < compositorThreads.length; ++i) |
| 408 this._appendSyncEvents(compositorThreads[i].events, WebInspector
.UIString("Rasterizer Thread %d", i), this._headerLevel2); | 396 this._appendSyncEvents(compositorThreads[i].events, WebInspector
.UIString("Rasterizer Thread %d", i), this._headerLevel2); |
| 409 } | 397 } |
| 410 | 398 |
| 399 this._appendThreadTimelineData(WebInspector.UIString("Main Thread"), thi
s._model.mainThreadEvents(), this._model.mainThreadAsyncEvents(), true); |
| 400 if (Runtime.experiments.isEnabled("gpuTimeline")) |
| 401 this._appendGPUEvents(); |
| 402 |
| 403 otherThreads.forEach(thread => this._appendThreadTimelineData(thread.nam
e, thread.events, thread.asyncEventsByGroup)); |
| 404 |
| 411 /** | 405 /** |
| 412 * @param {!WebInspector.TimelineFlameChartMarker} a | 406 * @param {!WebInspector.TimelineFlameChartMarker} a |
| 413 * @param {!WebInspector.TimelineFlameChartMarker} b | 407 * @param {!WebInspector.TimelineFlameChartMarker} b |
| 414 */ | 408 */ |
| 415 function compareStartTime(a, b) | 409 function compareStartTime(a, b) |
| 416 { | 410 { |
| 417 return a.startTime() - b.startTime(); | 411 return a.startTime() - b.startTime(); |
| 418 } | 412 } |
| 419 | 413 |
| 420 this._markers.sort(compareStartTime); | 414 this._markers.sort(compareStartTime); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 var color = this._asyncColorByCategory[category.name]; | 643 var color = this._asyncColorByCategory[category.name]; |
| 650 if (color) | 644 if (color) |
| 651 return color; | 645 return color; |
| 652 var parsedColor = WebInspector.Color.parse(category.color); | 646 var parsedColor = WebInspector.Color.parse(category.color); |
| 653 color = parsedColor.setAlpha(0.7).asString(WebInspector.Color.Format
.RGBA) || ""; | 647 color = parsedColor.setAlpha(0.7).asString(WebInspector.Color.Format
.RGBA) || ""; |
| 654 this._asyncColorByCategory[category.name] = color; | 648 this._asyncColorByCategory[category.name] = color; |
| 655 return color; | 649 return color; |
| 656 } | 650 } |
| 657 if (type === WebInspector.TimelineFlameChartEntryType.Frame) | 651 if (type === WebInspector.TimelineFlameChartEntryType.Frame) |
| 658 return "white"; | 652 return "white"; |
| 659 if (type === WebInspector.TimelineFlameChartEntryType.Header) | |
| 660 return "#aaa"; | |
| 661 if (type === WebInspector.TimelineFlameChartEntryType.InteractionRecord) | 653 if (type === WebInspector.TimelineFlameChartEntryType.InteractionRecord) |
| 662 return WebInspector.TimelineUIUtils.interactionPhaseColor(/** @type
{!WebInspector.TimelineIRModel.Phases} */ (this._entryData[entryIndex])); | 654 return WebInspector.TimelineUIUtils.interactionPhaseColor(/** @type
{!WebInspector.TimelineIRModel.Phases} */ (this._entryData[entryIndex])); |
| 663 return ""; | 655 return ""; |
| 664 }, | 656 }, |
| 665 | 657 |
| 666 /** | 658 /** |
| 667 * @override | 659 * @override |
| 668 * @param {number} entryIndex | 660 * @param {number} entryIndex |
| 669 * @param {!CanvasRenderingContext2D} context | 661 * @param {!CanvasRenderingContext2D} context |
| 670 * @param {?string} text | 662 * @param {?string} text |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 type === WebInspector.TimelineFlameChartEntryType.Event && !!/** @ty
pe {!WebInspector.TracingModel.Event} */ (this._entryData[entryIndex]).warning; | 732 type === WebInspector.TimelineFlameChartEntryType.Event && !!/** @ty
pe {!WebInspector.TracingModel.Event} */ (this._entryData[entryIndex]).warning; |
| 741 }, | 733 }, |
| 742 | 734 |
| 743 /** | 735 /** |
| 744 * @param {string} title | 736 * @param {string} title |
| 745 * @param {!WebInspector.FlameChart.GroupStyle} style | 737 * @param {!WebInspector.FlameChart.GroupStyle} style |
| 746 * @param {boolean=} expanded | 738 * @param {boolean=} expanded |
| 747 */ | 739 */ |
| 748 _appendHeader: function(title, style, expanded) | 740 _appendHeader: function(title, style, expanded) |
| 749 { | 741 { |
| 750 if (Runtime.experiments.isEnabled("timelineCollapsible")) | 742 this._timelineData.groups.push({startLevel: this._currentLevel, name: ti
tle, expanded: expanded, style: style}); |
| 751 this._timelineData.groups.push({startLevel: this._currentLevel, name
: title, expanded: expanded, style: style}); | |
| 752 else | |
| 753 this._appendHeaderRecord(title) | |
| 754 }, | 743 }, |
| 755 | 744 |
| 756 /** | 745 /** |
| 757 * @param {string} title | |
| 758 */ | |
| 759 _appendHeaderRecord: function(title) | |
| 760 { | |
| 761 var index = this._entryData.length; | |
| 762 this._entryIndexToTitle[index] = title; | |
| 763 this._entryData.push(null); | |
| 764 this._entryTypeByLevel[this._currentLevel] = WebInspector.TimelineFlameC
hartEntryType.Header; | |
| 765 this._timelineData.entryLevels[index] = this._currentLevel++; | |
| 766 this._timelineData.entryTotalTimes[index] = this._timeSpan; | |
| 767 this._timelineData.entryStartTimes[index] = this._minimumBoundary; | |
| 768 }, | |
| 769 | |
| 770 /** | |
| 771 * @param {!WebInspector.TracingModel.Event} event | 746 * @param {!WebInspector.TracingModel.Event} event |
| 772 * @param {number} level | 747 * @param {number} level |
| 773 */ | 748 */ |
| 774 _appendEvent: function(event, level) | 749 _appendEvent: function(event, level) |
| 775 { | 750 { |
| 776 var index = this._entryData.length; | 751 var index = this._entryData.length; |
| 777 this._entryData.push(event); | 752 this._entryData.push(event); |
| 778 this._timelineData.entryLevels[index] = level; | 753 this._timelineData.entryLevels[index] = level; |
| 779 this._timelineData.entryTotalTimes[index] = event.duration || WebInspect
or.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs; | 754 this._timelineData.entryTotalTimes[index] = event.duration || WebInspect
or.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs; |
| 780 this._timelineData.entryStartTimes[index] = event.startTime; | 755 this._timelineData.entryStartTimes[index] = event.startTime; |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 /** | 1447 /** |
| 1473 * @constructor | 1448 * @constructor |
| 1474 * @param {!WebInspector.TimelineSelection} selection | 1449 * @param {!WebInspector.TimelineSelection} selection |
| 1475 * @param {number} entryIndex | 1450 * @param {number} entryIndex |
| 1476 */ | 1451 */ |
| 1477 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex) | 1452 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex) |
| 1478 { | 1453 { |
| 1479 this.timelineSelection = selection; | 1454 this.timelineSelection = selection; |
| 1480 this.entryIndex = entryIndex; | 1455 this.entryIndex = entryIndex; |
| 1481 } | 1456 } |
| OLD | NEW |