| OLD | NEW |
| 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 var eventStack = this._eventStack; | 639 var eventStack = this._eventStack; |
| 640 while (eventStack.length && eventStack.peekLast().endTime <= event.startTime
) | 640 while (eventStack.length && eventStack.peekLast().endTime <= event.startTime
) |
| 641 eventStack.pop(); | 641 eventStack.pop(); |
| 642 | 642 |
| 643 var recordTypes = WebInspector.TimelineModel.RecordType; | 643 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 644 | 644 |
| 645 if (this._currentScriptEvent && event.startTime > this._currentScriptEvent.e
ndTime) | 645 if (this._currentScriptEvent && event.startTime > this._currentScriptEvent.e
ndTime) |
| 646 this._currentScriptEvent = null; | 646 this._currentScriptEvent = null; |
| 647 | 647 |
| 648 var eventData = event.args['data'] || event.args['beginData'] || {}; | 648 var eventData = event.args['data'] || event.args['beginData'] || {}; |
| 649 var timelineData = WebInspector.TimelineData.forEvent(event); |
| 649 if (eventData['stackTrace']) | 650 if (eventData['stackTrace']) |
| 650 event.stackTrace = eventData['stackTrace']; | 651 timelineData.stackTrace = eventData['stackTrace']; |
| 651 if (event.stackTrace && event.name !== recordTypes.JSSample) { | 652 if (timelineData.stackTrace && event.name !== recordTypes.JSSample) { |
| 652 // TraceEvents come with 1-based line & column numbers. The frontend code | 653 // TraceEvents come with 1-based line & column numbers. The frontend code |
| 653 // requires 0-based ones. Adjust the values. | 654 // requires 0-based ones. Adjust the values. |
| 654 for (var i = 0; i < event.stackTrace.length; ++i) { | 655 for (var i = 0; i < timelineData.stackTrace.length; ++i) { |
| 655 --event.stackTrace[i].lineNumber; | 656 --timelineData.stackTrace[i].lineNumber; |
| 656 --event.stackTrace[i].columnNumber; | 657 --timelineData.stackTrace[i].columnNumber; |
| 657 } | 658 } |
| 658 } | 659 } |
| 659 | 660 |
| 660 if (eventStack.length && eventStack.peekLast().name === recordTypes.EventDis
patch) | |
| 661 eventStack.peekLast().hasChildren = true; | |
| 662 this._asyncEventTracker.processEvent(event); | 661 this._asyncEventTracker.processEvent(event); |
| 663 if (event.initiator && event.initiator.url) | |
| 664 event.url = event.initiator.url; | |
| 665 switch (event.name) { | 662 switch (event.name) { |
| 666 case recordTypes.ResourceSendRequest: | 663 case recordTypes.ResourceSendRequest: |
| 667 case recordTypes.WebSocketCreate: | 664 case recordTypes.WebSocketCreate: |
| 668 event.url = eventData['url']; | 665 timelineData.setInitiator(eventStack.peekLast() || null); |
| 669 event.initiator = eventStack.peekLast() || null; | 666 timelineData.url = eventData['url']; |
| 670 break; | 667 break; |
| 671 | 668 |
| 672 case recordTypes.ScheduleStyleRecalculation: | 669 case recordTypes.ScheduleStyleRecalculation: |
| 673 this._lastScheduleStyleRecalculation[eventData['frame']] = event; | 670 this._lastScheduleStyleRecalculation[eventData['frame']] = event; |
| 674 break; | 671 break; |
| 675 | 672 |
| 676 case recordTypes.UpdateLayoutTree: | 673 case recordTypes.UpdateLayoutTree: |
| 677 case recordTypes.RecalculateStyles: | 674 case recordTypes.RecalculateStyles: |
| 678 this._invalidationTracker.didRecalcStyle(event); | 675 this._invalidationTracker.didRecalcStyle(event); |
| 679 if (event.args['beginData']) | 676 if (event.args['beginData']) |
| 680 event.initiator = this._lastScheduleStyleRecalculation[event.args['beg
inData']['frame']]; | 677 timelineData.setInitiator(this._lastScheduleStyleRecalculation[event.a
rgs['beginData']['frame']]); |
| 681 this._lastRecalculateStylesEvent = event; | 678 this._lastRecalculateStylesEvent = event; |
| 682 if (this._currentScriptEvent) | 679 if (this._currentScriptEvent) |
| 683 event.warning = WebInspector.TimelineModel.WarningType.ForcedStyle; | 680 timelineData.warning = WebInspector.TimelineModel.WarningType.ForcedSt
yle; |
| 684 break; | 681 break; |
| 685 | 682 |
| 686 case recordTypes.ScheduleStyleInvalidationTracking: | 683 case recordTypes.ScheduleStyleInvalidationTracking: |
| 687 case recordTypes.StyleRecalcInvalidationTracking: | 684 case recordTypes.StyleRecalcInvalidationTracking: |
| 688 case recordTypes.StyleInvalidatorInvalidationTracking: | 685 case recordTypes.StyleInvalidatorInvalidationTracking: |
| 689 case recordTypes.LayoutInvalidationTracking: | 686 case recordTypes.LayoutInvalidationTracking: |
| 690 case recordTypes.LayerInvalidationTracking: | 687 case recordTypes.LayerInvalidationTracking: |
| 691 case recordTypes.PaintInvalidationTracking: | 688 case recordTypes.PaintInvalidationTracking: |
| 692 case recordTypes.ScrollInvalidationTracking: | 689 case recordTypes.ScrollInvalidationTracking: |
| 693 this._invalidationTracker.addInvalidation(new WebInspector.InvalidationT
rackingEvent(event)); | 690 this._invalidationTracker.addInvalidation(new WebInspector.InvalidationT
rackingEvent(event)); |
| 694 break; | 691 break; |
| 695 | 692 |
| 696 case recordTypes.InvalidateLayout: | 693 case recordTypes.InvalidateLayout: |
| 697 // Consider style recalculation as a reason for layout invalidation, | 694 // Consider style recalculation as a reason for layout invalidation, |
| 698 // but only if we had no earlier layout invalidation records. | 695 // but only if we had no earlier layout invalidation records. |
| 699 var layoutInitator = event; | 696 var layoutInitator = event; |
| 700 var frameId = eventData['frame']; | 697 var frameId = eventData['frame']; |
| 701 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesEvent
&& | 698 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesEvent
&& |
| 702 this._lastRecalculateStylesEvent.endTime > event.startTime) | 699 this._lastRecalculateStylesEvent.endTime > event.startTime) |
| 703 layoutInitator = this._lastRecalculateStylesEvent.initiator; | 700 layoutInitator = WebInspector.TimelineData.forEvent(this._lastRecalcul
ateStylesEvent).initiator(); |
| 704 this._layoutInvalidate[frameId] = layoutInitator; | 701 this._layoutInvalidate[frameId] = layoutInitator; |
| 705 break; | 702 break; |
| 706 | 703 |
| 707 case recordTypes.Layout: | 704 case recordTypes.Layout: |
| 708 this._invalidationTracker.didLayout(event); | 705 this._invalidationTracker.didLayout(event); |
| 709 var frameId = event.args['beginData']['frame']; | 706 var frameId = event.args['beginData']['frame']; |
| 710 event.initiator = this._layoutInvalidate[frameId]; | 707 timelineData.setInitiator(this._layoutInvalidate[frameId]); |
| 711 // In case we have no closing Layout event, endData is not available. | 708 // In case we have no closing Layout event, endData is not available. |
| 712 if (event.args['endData']) { | 709 if (event.args['endData']) |
| 713 event.backendNodeId = event.args['endData']['rootNode']; | 710 timelineData.backendNodeId = event.args['endData']['rootNode']; |
| 714 event.highlightQuad = event.args['endData']['root']; | |
| 715 } | |
| 716 this._layoutInvalidate[frameId] = null; | 711 this._layoutInvalidate[frameId] = null; |
| 717 if (this._currentScriptEvent) | 712 if (this._currentScriptEvent) |
| 718 event.warning = WebInspector.TimelineModel.WarningType.ForcedLayout; | 713 timelineData.warning = WebInspector.TimelineModel.WarningType.ForcedLa
yout; |
| 719 break; | 714 break; |
| 720 | 715 |
| 721 case recordTypes.FunctionCall: | 716 case recordTypes.FunctionCall: |
| 722 // Compatibility with old format. | 717 // Compatibility with old format. |
| 723 if (typeof eventData['scriptName'] === 'string') | 718 if (typeof eventData['scriptName'] === 'string') |
| 724 eventData['url'] = eventData['scriptName']; | 719 eventData['url'] = eventData['scriptName']; |
| 725 if (typeof eventData['scriptLine'] === 'number') | 720 if (typeof eventData['scriptLine'] === 'number') |
| 726 eventData['lineNumber'] = eventData['scriptLine']; | 721 eventData['lineNumber'] = eventData['scriptLine']; |
| 727 // Fallthrough. | 722 // Fallthrough. |
| 728 case recordTypes.EvaluateScript: | 723 case recordTypes.EvaluateScript: |
| 729 case recordTypes.CompileScript: | 724 case recordTypes.CompileScript: |
| 730 if (typeof eventData['lineNumber'] === 'number') | 725 if (typeof eventData['lineNumber'] === 'number') |
| 731 --eventData['lineNumber']; | 726 --eventData['lineNumber']; |
| 732 if (typeof eventData['columnNumber'] === 'number') | 727 if (typeof eventData['columnNumber'] === 'number') |
| 733 --eventData['columnNumber']; | 728 --eventData['columnNumber']; |
| 734 // Fallthrough intended. | 729 // Fallthrough intended. |
| 735 case recordTypes.RunMicrotasks: | 730 case recordTypes.RunMicrotasks: |
| 736 // Microtasks technically are not necessarily scripts, but for purpose o
f | 731 // Microtasks technically are not necessarily scripts, but for purpose o
f |
| 737 // forced sync style recalc or layout detection they are. | 732 // forced sync style recalc or layout detection they are. |
| 738 if (!this._currentScriptEvent) | 733 if (!this._currentScriptEvent) |
| 739 this._currentScriptEvent = event; | 734 this._currentScriptEvent = event; |
| 740 break; | 735 break; |
| 741 | 736 |
| 742 case recordTypes.SetLayerTreeId: | 737 case recordTypes.SetLayerTreeId: |
| 743 this._inspectedTargetLayerTreeId = event.args['layerTreeId'] || event.ar
gs['data']['layerTreeId']; | 738 this._inspectedTargetLayerTreeId = event.args['layerTreeId'] || event.ar
gs['data']['layerTreeId']; |
| 744 break; | 739 break; |
| 745 | 740 |
| 746 case recordTypes.Paint: | 741 case recordTypes.Paint: |
| 747 this._invalidationTracker.didPaint(event); | 742 this._invalidationTracker.didPaint(event); |
| 748 event.highlightQuad = eventData['clip']; | 743 timelineData.backendNodeId = eventData['nodeId']; |
| 749 event.backendNodeId = eventData['nodeId']; | |
| 750 // Only keep layer paint events, skip paints for subframes that get pain
ted to the same layer as parent. | 744 // Only keep layer paint events, skip paints for subframes that get pain
ted to the same layer as parent. |
| 751 if (!eventData['layerId']) | 745 if (!eventData['layerId']) |
| 752 break; | 746 break; |
| 753 var layerId = eventData['layerId']; | 747 var layerId = eventData['layerId']; |
| 754 this._lastPaintForLayer[layerId] = event; | 748 this._lastPaintForLayer[layerId] = event; |
| 755 break; | 749 break; |
| 756 | 750 |
| 757 case recordTypes.DisplayItemListSnapshot: | 751 case recordTypes.DisplayItemListSnapshot: |
| 758 case recordTypes.PictureSnapshot: | 752 case recordTypes.PictureSnapshot: |
| 759 var layerUpdateEvent = this._findAncestorEvent(recordTypes.UpdateLayer); | 753 var layerUpdateEvent = this._findAncestorEvent(recordTypes.UpdateLayer); |
| 760 if (!layerUpdateEvent || layerUpdateEvent.args['layerTreeId'] !== this._
inspectedTargetLayerTreeId) | 754 if (!layerUpdateEvent || layerUpdateEvent.args['layerTreeId'] !== this._
inspectedTargetLayerTreeId) |
| 761 break; | 755 break; |
| 762 var paintEvent = this._lastPaintForLayer[layerUpdateEvent.args['layerId'
]]; | 756 var paintEvent = this._lastPaintForLayer[layerUpdateEvent.args['layerId'
]]; |
| 763 if (paintEvent) | 757 if (paintEvent) |
| 764 paintEvent.picture = event; | 758 WebInspector.TimelineData.forEvent(paintEvent).picture = /** @type {!W
ebInspector.TracingModel.ObjectSnapshot} */ (event); |
| 765 break; | 759 break; |
| 766 | 760 |
| 767 case recordTypes.ScrollLayer: | 761 case recordTypes.ScrollLayer: |
| 768 event.backendNodeId = eventData['nodeId']; | 762 timelineData.backendNodeId = eventData['nodeId']; |
| 769 break; | 763 break; |
| 770 | 764 |
| 771 case recordTypes.PaintImage: | 765 case recordTypes.PaintImage: |
| 772 event.backendNodeId = eventData['nodeId']; | 766 timelineData.backendNodeId = eventData['nodeId']; |
| 773 event.url = eventData['url']; | 767 timelineData.url = eventData['url']; |
| 774 break; | 768 break; |
| 775 | 769 |
| 776 case recordTypes.DecodeImage: | 770 case recordTypes.DecodeImage: |
| 777 case recordTypes.ResizeImage: | 771 case recordTypes.ResizeImage: |
| 778 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); | 772 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); |
| 779 if (!paintImageEvent) { | 773 if (!paintImageEvent) { |
| 780 var decodeLazyPixelRefEvent = this._findAncestorEvent(recordTypes.Deco
deLazyPixelRef); | 774 var decodeLazyPixelRefEvent = this._findAncestorEvent(recordTypes.Deco
deLazyPixelRef); |
| 781 paintImageEvent = decodeLazyPixelRefEvent && | 775 paintImageEvent = decodeLazyPixelRefEvent && |
| 782 this._paintImageEventByPixelRefId[decodeLazyPixelRefEvent.args['La
zyPixelRef']]; | 776 this._paintImageEventByPixelRefId[decodeLazyPixelRefEvent.args['La
zyPixelRef']]; |
| 783 } | 777 } |
| 784 if (!paintImageEvent) | 778 if (!paintImageEvent) |
| 785 break; | 779 break; |
| 786 event.backendNodeId = paintImageEvent.backendNodeId; | 780 var paintImageData = WebInspector.TimelineData.forEvent(paintImageEvent)
; |
| 787 event.url = paintImageEvent.url; | 781 timelineData.backendNodeId = paintImageData.backendNodeId; |
| 782 timelineData.url = paintImageData.url; |
| 788 break; | 783 break; |
| 789 | 784 |
| 790 case recordTypes.DrawLazyPixelRef: | 785 case recordTypes.DrawLazyPixelRef: |
| 791 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); | 786 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); |
| 792 if (!paintImageEvent) | 787 if (!paintImageEvent) |
| 793 break; | 788 break; |
| 794 this._paintImageEventByPixelRefId[event.args['LazyPixelRef']] = paintIma
geEvent; | 789 this._paintImageEventByPixelRefId[event.args['LazyPixelRef']] = paintIma
geEvent; |
| 795 event.backendNodeId = paintImageEvent.backendNodeId; | 790 var paintImageData = WebInspector.TimelineData.forEvent(paintImageEvent)
; |
| 796 event.url = paintImageEvent.url; | 791 event.backendNodeId = paintImageData.backendNodeId; |
| 792 event.url = paintImageData.url; |
| 797 break; | 793 break; |
| 798 | 794 |
| 799 case recordTypes.MarkDOMContent: | 795 case recordTypes.MarkDOMContent: |
| 800 case recordTypes.MarkLoad: | 796 case recordTypes.MarkLoad: |
| 801 var page = eventData['page']; | 797 var page = eventData['page']; |
| 802 if (page && page !== this._currentPage) | 798 if (page && page !== this._currentPage) |
| 803 return false; | 799 return false; |
| 804 break; | 800 break; |
| 805 | 801 |
| 806 case recordTypes.CommitLoad: | 802 case recordTypes.CommitLoad: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 822 this._firstCompositeLayers = null; | 818 this._firstCompositeLayers = null; |
| 823 break; | 819 break; |
| 824 | 820 |
| 825 case recordTypes.CompositeLayers: | 821 case recordTypes.CompositeLayers: |
| 826 if (!this._firstCompositeLayers && this._hadCommitLoad) | 822 if (!this._firstCompositeLayers && this._hadCommitLoad) |
| 827 this._firstCompositeLayers = event; | 823 this._firstCompositeLayers = event; |
| 828 break; | 824 break; |
| 829 | 825 |
| 830 case recordTypes.FireIdleCallback: | 826 case recordTypes.FireIdleCallback: |
| 831 if (event.duration > eventData['allottedMilliseconds']) { | 827 if (event.duration > eventData['allottedMilliseconds']) { |
| 832 event.warning = WebInspector.TimelineModel.WarningType.IdleDeadlineExc
eeded; | 828 timelineData.warning = WebInspector.TimelineModel.WarningType.IdleDead
lineExceeded; |
| 833 } | 829 } |
| 834 break; | 830 break; |
| 835 } | 831 } |
| 836 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) | 832 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) |
| 837 return true; | 833 return true; |
| 838 var duration = event.duration; | 834 var duration = event.duration; |
| 839 if (!duration) | 835 if (!duration) |
| 840 return true; | 836 return true; |
| 841 if (eventStack.length) { | 837 if (eventStack.length) { |
| 842 var parent = eventStack.peekLast(); | 838 var parent = eventStack.peekLast(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 var data = lastStep.args['data']; | 883 var data = lastStep.args['data']; |
| 888 asyncEvent.causedFrame = !!(data && data['INPUT_EVENT_LATENCY_RENDERER_SWA
P_COMPONENT']); | 884 asyncEvent.causedFrame = !!(data && data['INPUT_EVENT_LATENCY_RENDERER_SWA
P_COMPONENT']); |
| 889 if (asyncEvent.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo
)) { | 885 if (asyncEvent.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo
)) { |
| 890 if (!this._knownInputEvents.has(lastStep.id)) | 886 if (!this._knownInputEvents.has(lastStep.id)) |
| 891 return null; | 887 return null; |
| 892 if (asyncEvent.name === WebInspector.TimelineModel.RecordType.InputLaten
cyMouseMove && !asyncEvent.causedFrame) | 888 if (asyncEvent.name === WebInspector.TimelineModel.RecordType.InputLaten
cyMouseMove && !asyncEvent.causedFrame) |
| 893 return null; | 889 return null; |
| 894 var rendererMain = data['INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT']; | 890 var rendererMain = data['INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT']; |
| 895 if (rendererMain) { | 891 if (rendererMain) { |
| 896 var time = rendererMain['time'] / 1000; | 892 var time = rendererMain['time'] / 1000; |
| 897 asyncEvent.steps[0].timeWaitingForMainThread = time - asyncEvent.steps
[0].startTime; | 893 WebInspector.TimelineData.forEvent(asyncEvent.steps[0]).timeWaitingFor
MainThread = time - asyncEvent.steps[0].startTime; |
| 898 } | 894 } |
| 899 } | 895 } |
| 900 return groups.input; | 896 return groups.input; |
| 901 } | 897 } |
| 902 return null; | 898 return null; |
| 903 } | 899 } |
| 904 | 900 |
| 905 /** | 901 /** |
| 906 * @param {string} name | 902 * @param {string} name |
| 907 * @return {?WebInspector.TracingModel.Event} | 903 * @return {?WebInspector.TracingModel.Event} |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 } | 1325 } |
| 1330 | 1326 |
| 1331 /** | 1327 /** |
| 1332 * @return {!WebInspector.TimelineModel.RecordType} | 1328 * @return {!WebInspector.TimelineModel.RecordType} |
| 1333 */ | 1329 */ |
| 1334 type() { | 1330 type() { |
| 1335 return WebInspector.TimelineModel._eventType(this._event); | 1331 return WebInspector.TimelineModel._eventType(this._event); |
| 1336 } | 1332 } |
| 1337 | 1333 |
| 1338 /** | 1334 /** |
| 1339 * @param {string} key | |
| 1340 * @return {?Object} | |
| 1341 */ | |
| 1342 getUserObject(key) { | |
| 1343 if (key === 'TimelineUIUtils::preview-element') | |
| 1344 return this._event.previewElement; | |
| 1345 throw new Error('Unexpected key: ' + key); | |
| 1346 } | |
| 1347 | |
| 1348 /** | |
| 1349 * @param {string} key | |
| 1350 * @param {?Object|undefined} value | |
| 1351 */ | |
| 1352 setUserObject(key, value) { | |
| 1353 if (key !== 'TimelineUIUtils::preview-element') | |
| 1354 throw new Error('Unexpected key: ' + key); | |
| 1355 this._event.previewElement = /** @type {?Element} */ (value); | |
| 1356 } | |
| 1357 | |
| 1358 /** | |
| 1359 * @return {!WebInspector.TracingModel.Event} | 1335 * @return {!WebInspector.TracingModel.Event} |
| 1360 */ | 1336 */ |
| 1361 traceEvent() { | 1337 traceEvent() { |
| 1362 return this._event; | 1338 return this._event; |
| 1363 } | 1339 } |
| 1364 | 1340 |
| 1365 /** | 1341 /** |
| 1366 * @param {!WebInspector.TimelineModel.Record} child | 1342 * @param {!WebInspector.TimelineModel.Record} child |
| 1367 */ | 1343 */ |
| 1368 _addChild(child) { | 1344 _addChild(child) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 constructor() { | 1529 constructor() { |
| 1554 /** @type {?WebInspector.TracingModel.Event} */ | 1530 /** @type {?WebInspector.TracingModel.Event} */ |
| 1555 this._lastRecalcStyle = null; | 1531 this._lastRecalcStyle = null; |
| 1556 /** @type {?WebInspector.TracingModel.Event} */ | 1532 /** @type {?WebInspector.TracingModel.Event} */ |
| 1557 this._lastPaintWithLayer = null; | 1533 this._lastPaintWithLayer = null; |
| 1558 this._didPaint = false; | 1534 this._didPaint = false; |
| 1559 this._initializePerFrameState(); | 1535 this._initializePerFrameState(); |
| 1560 } | 1536 } |
| 1561 | 1537 |
| 1562 /** | 1538 /** |
| 1539 * @param {!WebInspector.TracingModel.Event} event |
| 1540 * @return {?Array<!WebInspector.InvalidationTrackingEvent>} |
| 1541 */ |
| 1542 static invalidationEventsFor(event) { |
| 1543 return event[WebInspector.InvalidationTracker._invalidationTrackingEventsSym
bol] || null; |
| 1544 } |
| 1545 |
| 1546 /** |
| 1563 * @param {!WebInspector.InvalidationTrackingEvent} invalidation | 1547 * @param {!WebInspector.InvalidationTrackingEvent} invalidation |
| 1564 */ | 1548 */ |
| 1565 addInvalidation(invalidation) { | 1549 addInvalidation(invalidation) { |
| 1566 this._startNewFrameIfNeeded(); | 1550 this._startNewFrameIfNeeded(); |
| 1567 | 1551 |
| 1568 if (!invalidation.nodeId && !invalidation.paintId) { | 1552 if (!invalidation.nodeId && !invalidation.paintId) { |
| 1569 console.error('Invalidation lacks node information.'); | 1553 console.error('Invalidation lacks node information.'); |
| 1570 console.error(invalidation); | 1554 console.error(invalidation); |
| 1571 return; | 1555 return; |
| 1572 } | 1556 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 } | 1738 } |
| 1755 | 1739 |
| 1756 /** | 1740 /** |
| 1757 * @param {!WebInspector.TracingModel.Event} event | 1741 * @param {!WebInspector.TracingModel.Event} event |
| 1758 * @param {number} eventFrameId | 1742 * @param {number} eventFrameId |
| 1759 * @param {!WebInspector.InvalidationTrackingEvent} invalidation | 1743 * @param {!WebInspector.InvalidationTrackingEvent} invalidation |
| 1760 */ | 1744 */ |
| 1761 _addInvalidationToEvent(event, eventFrameId, invalidation) { | 1745 _addInvalidationToEvent(event, eventFrameId, invalidation) { |
| 1762 if (eventFrameId !== invalidation.frame) | 1746 if (eventFrameId !== invalidation.frame) |
| 1763 return; | 1747 return; |
| 1764 if (!event.invalidationTrackingEvents) | 1748 if (!event[WebInspector.InvalidationTracker._invalidationTrackingEventsSymbo
l]) |
| 1765 event.invalidationTrackingEvents = [invalidation]; | 1749 event[WebInspector.InvalidationTracker._invalidationTrackingEventsSymbol]
= [invalidation]; |
| 1766 else | 1750 else |
| 1767 event.invalidationTrackingEvents.push(invalidation); | 1751 event[WebInspector.InvalidationTracker._invalidationTrackingEventsSymbol].
push(invalidation); |
| 1768 } | 1752 } |
| 1769 | 1753 |
| 1770 /** | 1754 /** |
| 1771 * @param {!Array.<string>=} types | 1755 * @param {!Array.<string>=} types |
| 1772 * @return {!Iterator.<!WebInspector.InvalidationTrackingEvent>} | 1756 * @return {!Iterator.<!WebInspector.InvalidationTrackingEvent>} |
| 1773 */ | 1757 */ |
| 1774 _invalidationsOfTypes(types) { | 1758 _invalidationsOfTypes(types) { |
| 1775 var invalidations = this._invalidations; | 1759 var invalidations = this._invalidations; |
| 1776 if (!types) | 1760 if (!types) |
| 1777 types = Object.keys(invalidations); | 1761 types = Object.keys(invalidations); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1797 this._invalidations = {}; | 1781 this._invalidations = {}; |
| 1798 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEvent>
>} */ | 1782 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEvent>
>} */ |
| 1799 this._invalidationsByNodeId = {}; | 1783 this._invalidationsByNodeId = {}; |
| 1800 | 1784 |
| 1801 this._lastRecalcStyle = null; | 1785 this._lastRecalcStyle = null; |
| 1802 this._lastPaintWithLayer = null; | 1786 this._lastPaintWithLayer = null; |
| 1803 this._didPaint = false; | 1787 this._didPaint = false; |
| 1804 } | 1788 } |
| 1805 }; | 1789 }; |
| 1806 | 1790 |
| 1791 WebInspector.InvalidationTracker._invalidationTrackingEventsSymbol = Symbol('inv
alidationTrackingEvents'); |
| 1792 |
| 1807 /** | 1793 /** |
| 1808 * @unrestricted | 1794 * @unrestricted |
| 1809 */ | 1795 */ |
| 1810 WebInspector.TimelineAsyncEventTracker = class { | 1796 WebInspector.TimelineAsyncEventTracker = class { |
| 1811 constructor() { | 1797 constructor() { |
| 1812 WebInspector.TimelineAsyncEventTracker._initialize(); | 1798 WebInspector.TimelineAsyncEventTracker._initialize(); |
| 1813 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !Map<string, !WebIns
pector.TracingModel.Event>>} */ | 1799 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !Map<string, !WebIns
pector.TracingModel.Event>>} */ |
| 1814 this._initiatorByType = new Map(); | 1800 this._initiatorByType = new Map(); |
| 1815 for (var initiator of WebInspector.TimelineAsyncEventTracker._asyncEvents.ke
ys()) | 1801 for (var initiator of WebInspector.TimelineAsyncEventTracker._asyncEvents.ke
ys()) |
| 1816 this._initiatorByType.set(initiator, new Map()); | 1802 this._initiatorByType.set(initiator, new Map()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 if (!initiatorInfo) | 1842 if (!initiatorInfo) |
| 1857 return; | 1843 return; |
| 1858 var id = event.args['data'][initiatorInfo.joinBy]; | 1844 var id = event.args['data'][initiatorInfo.joinBy]; |
| 1859 if (!id) | 1845 if (!id) |
| 1860 return; | 1846 return; |
| 1861 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ | 1847 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ |
| 1862 var initiatorMap = this._initiatorByType.get(initiatorType); | 1848 var initiatorMap = this._initiatorByType.get(initiatorType); |
| 1863 if (isInitiator) | 1849 if (isInitiator) |
| 1864 initiatorMap.set(id, event); | 1850 initiatorMap.set(id, event); |
| 1865 else | 1851 else |
| 1866 event.initiator = initiatorMap.get(id) || null; | 1852 WebInspector.TimelineData.forEvent(event).setInitiator(initiatorMap.get(id
) || null); |
| 1867 } | 1853 } |
| 1868 }; | 1854 }; |
| 1855 |
| 1856 |
| 1857 WebInspector.TimelineData = class { |
| 1858 constructor() { |
| 1859 /** @type {?string} */ |
| 1860 this.warning = null; |
| 1861 /** @type {?Element} */ |
| 1862 this.previewElement = null; |
| 1863 /** @type {?string} */ |
| 1864 this.url = null; |
| 1865 /** @type {number} */ |
| 1866 this.backendNodeId = 0; |
| 1867 /** @type {?Array<!Protocol.Runtime.CallFrame>} */ |
| 1868 this.stackTrace = null; |
| 1869 /** @type {?WebInspector.TracingModel.ObjectSnapshot} */ |
| 1870 this.picture = null; |
| 1871 /** @type {?WebInspector.TracingModel.Event} */ |
| 1872 this._initiator = null; |
| 1873 /** @type {number|undefined} */ |
| 1874 this.timeWaitingForMainThread; |
| 1875 } |
| 1876 |
| 1877 /** |
| 1878 * @param {!WebInspector.TracingModel.Event} initiator |
| 1879 */ |
| 1880 setInitiator(initiator) { |
| 1881 this._initiator = initiator; |
| 1882 if (!initiator || this.url) |
| 1883 return; |
| 1884 var initiatorURL = WebInspector.TimelineData.forEvent(initiator).url; |
| 1885 if (initiatorURL) |
| 1886 this.url = initiatorURL; |
| 1887 } |
| 1888 |
| 1889 /** |
| 1890 * @return {?WebInspector.TracingModel.Event} |
| 1891 */ |
| 1892 initiator() { |
| 1893 return this._initiator; |
| 1894 } |
| 1895 |
| 1896 /** |
| 1897 * @return {?Protocol.Runtime.CallFrame} |
| 1898 */ |
| 1899 topFrame() { |
| 1900 var stackTrace = this.stackTraceForSelfOrInitiator(); |
| 1901 return stackTrace && stackTrace[0] || null; |
| 1902 } |
| 1903 |
| 1904 /** |
| 1905 * @return {?Array<!Protocol.Runtime.CallFrame>} |
| 1906 */ |
| 1907 stackTraceForSelfOrInitiator() { |
| 1908 return this.stackTrace || (this._initiator && WebInspector.TimelineData.forE
vent(this._initiator).stackTrace); |
| 1909 } |
| 1910 |
| 1911 /** |
| 1912 * @param {!WebInspector.TracingModel.Event} event |
| 1913 * @return {!WebInspector.TimelineData} |
| 1914 */ |
| 1915 static forEvent(event) { |
| 1916 var data = event[WebInspector.TimelineData._symbol]; |
| 1917 if (!data) { |
| 1918 data = new WebInspector.TimelineData(); |
| 1919 event[WebInspector.TimelineData._symbol] = data; |
| 1920 } |
| 1921 return data; |
| 1922 } |
| 1923 }; |
| 1924 |
| 1925 WebInspector.TimelineData._symbol = Symbol('timelineData'); |
| OLD | NEW |