Chromium Code Reviews| 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 var eventStack = this._eventStack; | 614 var eventStack = this._eventStack; |
| 615 while (eventStack.length && eventStack.peekLast().endTime <= event.startTime ) | 615 while (eventStack.length && eventStack.peekLast().endTime <= event.startTime ) |
| 616 eventStack.pop(); | 616 eventStack.pop(); |
| 617 | 617 |
| 618 var recordTypes = WebInspector.TimelineModel.RecordType; | 618 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 619 | 619 |
| 620 if (this._currentScriptEvent && event.startTime > this._currentScriptEvent.e ndTime) | 620 if (this._currentScriptEvent && event.startTime > this._currentScriptEvent.e ndTime) |
| 621 this._currentScriptEvent = null; | 621 this._currentScriptEvent = null; |
| 622 | 622 |
| 623 var eventData = event.args['data'] || event.args['beginData'] || {}; | 623 var eventData = event.args['data'] || event.args['beginData'] || {}; |
| 624 var timelineData = WebInspector.TimelineData.forEvent(event); | |
| 624 if (eventData['stackTrace']) | 625 if (eventData['stackTrace']) |
| 625 event.stackTrace = eventData['stackTrace']; | 626 timelineData.stackTrace = eventData['stackTrace']; |
| 626 if (event.stackTrace && event.name !== recordTypes.JSSample) { | 627 if (timelineData.stackTrace && event.name !== recordTypes.JSSample) { |
| 627 // TraceEvents come with 1-based line & column numbers. The frontend code | 628 // TraceEvents come with 1-based line & column numbers. The frontend code |
| 628 // requires 0-based ones. Adjust the values. | 629 // requires 0-based ones. Adjust the values. |
| 629 for (var i = 0; i < event.stackTrace.length; ++i) { | 630 for (var i = 0; i < timelineData.stackTrace.length; ++i) { |
| 630 --event.stackTrace[i].lineNumber; | 631 --timelineData.stackTrace[i].lineNumber; |
| 631 --event.stackTrace[i].columnNumber; | 632 --timelineData.stackTrace[i].columnNumber; |
| 632 } | 633 } |
| 633 } | 634 } |
| 634 | 635 |
| 635 if (eventStack.length && eventStack.peekLast().name === recordTypes.EventDis patch) | |
| 636 eventStack.peekLast().hasChildren = true; | |
| 637 this._asyncEventTracker.processEvent(event); | 636 this._asyncEventTracker.processEvent(event); |
| 638 if (event.initiator && event.initiator.url) | |
| 639 event.url = event.initiator.url; | |
| 640 switch (event.name) { | 637 switch (event.name) { |
| 641 case recordTypes.ResourceSendRequest: | 638 case recordTypes.ResourceSendRequest: |
| 642 case recordTypes.WebSocketCreate: | 639 case recordTypes.WebSocketCreate: |
| 643 event.url = eventData['url']; | 640 timelineData.setInitiator(eventStack.peekLast() || null); |
| 644 event.initiator = eventStack.peekLast() || null; | 641 timelineData.url = eventData['url']; |
| 645 break; | 642 break; |
| 646 | 643 |
| 647 case recordTypes.ScheduleStyleRecalculation: | 644 case recordTypes.ScheduleStyleRecalculation: |
| 648 this._lastScheduleStyleRecalculation[eventData['frame']] = event; | 645 this._lastScheduleStyleRecalculation[eventData['frame']] = event; |
| 649 break; | 646 break; |
| 650 | 647 |
| 651 case recordTypes.UpdateLayoutTree: | 648 case recordTypes.UpdateLayoutTree: |
| 652 case recordTypes.RecalculateStyles: | 649 case recordTypes.RecalculateStyles: |
| 653 this._invalidationTracker.didRecalcStyle(event); | 650 this._invalidationTracker.didRecalcStyle(event); |
| 654 if (event.args['beginData']) | 651 if (event.args['beginData']) |
| 655 event.initiator = this._lastScheduleStyleRecalculation[event.args['beg inData']['frame']]; | 652 timelineData.setInitiator(this._lastScheduleStyleRecalculation[event.a rgs['beginData']['frame']]); |
| 656 this._lastRecalculateStylesEvent = event; | 653 this._lastRecalculateStylesEvent = event; |
| 657 if (this._currentScriptEvent) | 654 if (this._currentScriptEvent) |
| 658 event.warning = WebInspector.TimelineModel.WarningType.ForcedStyle; | 655 timelineData.warning = WebInspector.TimelineModel.WarningType.ForcedSt yle; |
| 659 break; | 656 break; |
| 660 | 657 |
| 661 case recordTypes.ScheduleStyleInvalidationTracking: | 658 case recordTypes.ScheduleStyleInvalidationTracking: |
| 662 case recordTypes.StyleRecalcInvalidationTracking: | 659 case recordTypes.StyleRecalcInvalidationTracking: |
| 663 case recordTypes.StyleInvalidatorInvalidationTracking: | 660 case recordTypes.StyleInvalidatorInvalidationTracking: |
| 664 case recordTypes.LayoutInvalidationTracking: | 661 case recordTypes.LayoutInvalidationTracking: |
| 665 case recordTypes.LayerInvalidationTracking: | 662 case recordTypes.LayerInvalidationTracking: |
| 666 case recordTypes.PaintInvalidationTracking: | 663 case recordTypes.PaintInvalidationTracking: |
| 667 case recordTypes.ScrollInvalidationTracking: | 664 case recordTypes.ScrollInvalidationTracking: |
| 668 this._invalidationTracker.addInvalidation(new WebInspector.InvalidationT rackingEvent(event)); | 665 this._invalidationTracker.addInvalidation(new WebInspector.InvalidationT rackingEvent(event)); |
| 669 break; | 666 break; |
| 670 | 667 |
| 671 case recordTypes.InvalidateLayout: | 668 case recordTypes.InvalidateLayout: |
| 672 // Consider style recalculation as a reason for layout invalidation, | 669 // Consider style recalculation as a reason for layout invalidation, |
| 673 // but only if we had no earlier layout invalidation records. | 670 // but only if we had no earlier layout invalidation records. |
| 674 var layoutInitator = event; | 671 var layoutInitator = event; |
| 675 var frameId = eventData['frame']; | 672 var frameId = eventData['frame']; |
| 676 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesEvent && | 673 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesEvent && |
| 677 this._lastRecalculateStylesEvent.endTime > event.startTime) | 674 this._lastRecalculateStylesEvent.endTime > event.startTime) |
| 678 layoutInitator = this._lastRecalculateStylesEvent.initiator; | 675 layoutInitator = WebInspector.TimelineData.forEvent(this._lastRecalcul ateStylesEvent).initiator(); |
| 679 this._layoutInvalidate[frameId] = layoutInitator; | 676 this._layoutInvalidate[frameId] = layoutInitator; |
| 680 break; | 677 break; |
| 681 | 678 |
| 682 case recordTypes.Layout: | 679 case recordTypes.Layout: |
| 683 this._invalidationTracker.didLayout(event); | 680 this._invalidationTracker.didLayout(event); |
| 684 var frameId = event.args['beginData']['frame']; | 681 var frameId = event.args['beginData']['frame']; |
| 685 event.initiator = this._layoutInvalidate[frameId]; | 682 timelineData.setInitiator(this._layoutInvalidate[frameId]); |
| 686 // In case we have no closing Layout event, endData is not available. | 683 // In case we have no closing Layout event, endData is not available. |
| 687 if (event.args['endData']) { | 684 if (event.args['endData']) |
| 688 event.backendNodeId = event.args['endData']['rootNode']; | 685 timelineData.backendNodeId = event.args['endData']['rootNode']; |
| 689 event.highlightQuad = event.args['endData']['root']; | |
| 690 } | |
| 691 this._layoutInvalidate[frameId] = null; | 686 this._layoutInvalidate[frameId] = null; |
| 692 if (this._currentScriptEvent) | 687 if (this._currentScriptEvent) |
| 693 event.warning = WebInspector.TimelineModel.WarningType.ForcedLayout; | 688 timelineData.warning = WebInspector.TimelineModel.WarningType.ForcedLa yout; |
| 694 break; | 689 break; |
| 695 | 690 |
| 696 case recordTypes.FunctionCall: | 691 case recordTypes.FunctionCall: |
| 697 // Compatibility with old format. | 692 // Compatibility with old format. |
| 698 if (typeof eventData['scriptName'] === 'string') | 693 if (typeof eventData['scriptName'] === 'string') |
| 699 eventData['url'] = eventData['scriptName']; | 694 eventData['url'] = eventData['scriptName']; |
| 700 if (typeof eventData['scriptLine'] === 'number') | 695 if (typeof eventData['scriptLine'] === 'number') |
| 701 eventData['lineNumber'] = eventData['scriptLine']; | 696 eventData['lineNumber'] = eventData['scriptLine']; |
| 702 // Fallthrough. | 697 // Fallthrough. |
| 703 case recordTypes.EvaluateScript: | 698 case recordTypes.EvaluateScript: |
| 704 case recordTypes.CompileScript: | 699 case recordTypes.CompileScript: |
| 705 if (typeof eventData['lineNumber'] === 'number') | 700 if (typeof eventData['lineNumber'] === 'number') |
| 706 --eventData['lineNumber']; | 701 --eventData['lineNumber']; |
| 707 if (typeof eventData['columnNumber'] === 'number') | 702 if (typeof eventData['columnNumber'] === 'number') |
| 708 --eventData['columnNumber']; | 703 --eventData['columnNumber']; |
| 709 // Fallthrough intended. | 704 // Fallthrough intended. |
| 710 case recordTypes.RunMicrotasks: | 705 case recordTypes.RunMicrotasks: |
| 711 // Microtasks technically are not necessarily scripts, but for purpose o f | 706 // Microtasks technically are not necessarily scripts, but for purpose o f |
| 712 // forced sync style recalc or layout detection they are. | 707 // forced sync style recalc or layout detection they are. |
| 713 if (!this._currentScriptEvent) | 708 if (!this._currentScriptEvent) |
| 714 this._currentScriptEvent = event; | 709 this._currentScriptEvent = event; |
| 715 break; | 710 break; |
| 716 | 711 |
| 717 case recordTypes.SetLayerTreeId: | 712 case recordTypes.SetLayerTreeId: |
| 718 this._inspectedTargetLayerTreeId = event.args['layerTreeId'] || event.ar gs['data']['layerTreeId']; | 713 this._inspectedTargetLayerTreeId = event.args['layerTreeId'] || event.ar gs['data']['layerTreeId']; |
| 719 break; | 714 break; |
| 720 | 715 |
| 721 case recordTypes.Paint: | 716 case recordTypes.Paint: |
| 722 this._invalidationTracker.didPaint(event); | 717 this._invalidationTracker.didPaint(event); |
| 723 event.highlightQuad = eventData['clip']; | 718 timelineData.backendNodeId = eventData['nodeId']; |
| 724 event.backendNodeId = eventData['nodeId']; | |
| 725 // Only keep layer paint events, skip paints for subframes that get pain ted to the same layer as parent. | 719 // Only keep layer paint events, skip paints for subframes that get pain ted to the same layer as parent. |
| 726 if (!eventData['layerId']) | 720 if (!eventData['layerId']) |
| 727 break; | 721 break; |
| 728 var layerId = eventData['layerId']; | 722 var layerId = eventData['layerId']; |
| 729 this._lastPaintForLayer[layerId] = event; | 723 this._lastPaintForLayer[layerId] = event; |
| 730 break; | 724 break; |
| 731 | 725 |
| 732 case recordTypes.DisplayItemListSnapshot: | 726 case recordTypes.DisplayItemListSnapshot: |
| 733 case recordTypes.PictureSnapshot: | 727 case recordTypes.PictureSnapshot: |
| 734 var layerUpdateEvent = this._findAncestorEvent(recordTypes.UpdateLayer); | 728 var layerUpdateEvent = this._findAncestorEvent(recordTypes.UpdateLayer); |
| 735 if (!layerUpdateEvent || layerUpdateEvent.args['layerTreeId'] !== this._ inspectedTargetLayerTreeId) | 729 if (!layerUpdateEvent || layerUpdateEvent.args['layerTreeId'] !== this._ inspectedTargetLayerTreeId) |
| 736 break; | 730 break; |
| 737 var paintEvent = this._lastPaintForLayer[layerUpdateEvent.args['layerId' ]]; | 731 var paintEvent = this._lastPaintForLayer[layerUpdateEvent.args['layerId' ]]; |
| 738 if (paintEvent) | 732 if (paintEvent) |
| 739 paintEvent.picture = event; | 733 WebInspector.TimelineData.forEvent(paintEvent).picture = event; |
| 740 break; | 734 break; |
| 741 | 735 |
| 742 case recordTypes.ScrollLayer: | 736 case recordTypes.ScrollLayer: |
| 743 event.backendNodeId = eventData['nodeId']; | 737 timelineData.backendNodeId = eventData['nodeId']; |
| 744 break; | 738 break; |
| 745 | 739 |
| 746 case recordTypes.PaintImage: | 740 case recordTypes.PaintImage: |
| 747 event.backendNodeId = eventData['nodeId']; | 741 timelineData.backendNodeId = eventData['nodeId']; |
| 748 event.url = eventData['url']; | 742 timelineData.url = eventData['url']; |
| 749 break; | 743 break; |
| 750 | 744 |
| 751 case recordTypes.DecodeImage: | 745 case recordTypes.DecodeImage: |
| 752 case recordTypes.ResizeImage: | 746 case recordTypes.ResizeImage: |
| 753 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); | 747 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); |
| 754 if (!paintImageEvent) { | 748 if (!paintImageEvent) { |
| 755 var decodeLazyPixelRefEvent = this._findAncestorEvent(recordTypes.Deco deLazyPixelRef); | 749 var decodeLazyPixelRefEvent = this._findAncestorEvent(recordTypes.Deco deLazyPixelRef); |
| 756 paintImageEvent = decodeLazyPixelRefEvent && | 750 paintImageEvent = decodeLazyPixelRefEvent && |
| 757 this._paintImageEventByPixelRefId[decodeLazyPixelRefEvent.args['La zyPixelRef']]; | 751 this._paintImageEventByPixelRefId[decodeLazyPixelRefEvent.args['La zyPixelRef']]; |
| 758 } | 752 } |
| 759 if (!paintImageEvent) | 753 if (!paintImageEvent) |
| 760 break; | 754 break; |
| 761 event.backendNodeId = paintImageEvent.backendNodeId; | 755 var paintImageData = WebInspector.TimelineData.forEvent(paintImageEvent) ; |
| 762 event.url = paintImageEvent.url; | 756 timelineData.backendNodeId = paintImageData.backendNodeId; |
| 757 timelineData.url = paintImageData.url; | |
| 763 break; | 758 break; |
| 764 | 759 |
| 765 case recordTypes.DrawLazyPixelRef: | 760 case recordTypes.DrawLazyPixelRef: |
| 766 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); | 761 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage); |
| 767 if (!paintImageEvent) | 762 if (!paintImageEvent) |
| 768 break; | 763 break; |
| 769 this._paintImageEventByPixelRefId[event.args['LazyPixelRef']] = paintIma geEvent; | 764 this._paintImageEventByPixelRefId[event.args['LazyPixelRef']] = paintIma geEvent; |
| 770 event.backendNodeId = paintImageEvent.backendNodeId; | 765 var paintImageData = WebInspector.TimelineData.forEvent(paintImageEvent) ; |
| 771 event.url = paintImageEvent.url; | 766 event.backendNodeId = paintImageData.backendNodeId; |
| 767 event.url = paintImageData.url; | |
| 772 break; | 768 break; |
| 773 | 769 |
| 774 case recordTypes.MarkDOMContent: | 770 case recordTypes.MarkDOMContent: |
| 775 case recordTypes.MarkLoad: | 771 case recordTypes.MarkLoad: |
| 776 var page = eventData['page']; | 772 var page = eventData['page']; |
| 777 if (page && page !== this._currentPage) | 773 if (page && page !== this._currentPage) |
| 778 return false; | 774 return false; |
| 779 break; | 775 break; |
| 780 | 776 |
| 781 case recordTypes.CommitLoad: | 777 case recordTypes.CommitLoad: |
| 782 var page = eventData['page']; | 778 var page = eventData['page']; |
| 783 if (page && page !== this._currentPage) | 779 if (page && page !== this._currentPage) |
| 784 return false; | 780 return false; |
| 785 if (!eventData['isMainFrame']) | 781 if (!eventData['isMainFrame']) |
| 786 break; | 782 break; |
| 787 this._hadCommitLoad = true; | 783 this._hadCommitLoad = true; |
| 788 this._firstCompositeLayers = null; | 784 this._firstCompositeLayers = null; |
| 789 break; | 785 break; |
| 790 | 786 |
| 791 case recordTypes.CompositeLayers: | 787 case recordTypes.CompositeLayers: |
| 792 if (!this._firstCompositeLayers && this._hadCommitLoad) | 788 if (!this._firstCompositeLayers && this._hadCommitLoad) |
| 793 this._firstCompositeLayers = event; | 789 this._firstCompositeLayers = event; |
| 794 break; | 790 break; |
| 795 | 791 |
| 796 case recordTypes.FireIdleCallback: | 792 case recordTypes.FireIdleCallback: |
| 797 if (event.duration > eventData['allottedMilliseconds']) { | 793 if (event.duration > eventData['allottedMilliseconds']) { |
| 798 event.warning = WebInspector.TimelineModel.WarningType.IdleDeadlineExc eeded; | 794 timelineData.warning = WebInspector.TimelineModel.WarningType.IdleDead lineExceeded; |
| 799 } | 795 } |
| 800 break; | 796 break; |
| 801 } | 797 } |
| 802 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) | 798 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) |
| 803 return true; | 799 return true; |
| 804 var duration = event.duration; | 800 var duration = event.duration; |
| 805 if (!duration) | 801 if (!duration) |
| 806 return true; | 802 return true; |
| 807 if (eventStack.length) { | 803 if (eventStack.length) { |
| 808 var parent = eventStack.peekLast(); | 804 var parent = eventStack.peekLast(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 853 var data = lastStep.args['data']; | 849 var data = lastStep.args['data']; |
| 854 asyncEvent.causedFrame = !!(data && data['INPUT_EVENT_LATENCY_RENDERER_SWA P_COMPONENT']); | 850 asyncEvent.causedFrame = !!(data && data['INPUT_EVENT_LATENCY_RENDERER_SWA P_COMPONENT']); |
| 855 if (asyncEvent.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo )) { | 851 if (asyncEvent.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo )) { |
| 856 if (!this._knownInputEvents.has(lastStep.id)) | 852 if (!this._knownInputEvents.has(lastStep.id)) |
| 857 return null; | 853 return null; |
| 858 if (asyncEvent.name === WebInspector.TimelineModel.RecordType.InputLaten cyMouseMove && !asyncEvent.causedFrame) | 854 if (asyncEvent.name === WebInspector.TimelineModel.RecordType.InputLaten cyMouseMove && !asyncEvent.causedFrame) |
| 859 return null; | 855 return null; |
| 860 var rendererMain = data['INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT']; | 856 var rendererMain = data['INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT']; |
| 861 if (rendererMain) { | 857 if (rendererMain) { |
| 862 var time = rendererMain['time'] / 1000; | 858 var time = rendererMain['time'] / 1000; |
| 863 asyncEvent.steps[0].timeWaitingForMainThread = time - asyncEvent.steps [0].startTime; | 859 WebInspector.TimelineData.forEvent(asyncEvent.steps[0]).timeWaitingFor MainThread = time - asyncEvent.steps[0].startTime; |
| 864 } | 860 } |
| 865 } | 861 } |
| 866 return groups.input; | 862 return groups.input; |
| 867 } | 863 } |
| 868 return null; | 864 return null; |
| 869 } | 865 } |
| 870 | 866 |
| 871 /** | 867 /** |
| 872 * @param {string} name | 868 * @param {string} name |
| 873 * @return {?WebInspector.TracingModel.Event} | 869 * @return {?WebInspector.TracingModel.Event} |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 } | 1280 } |
| 1285 | 1281 |
| 1286 /** | 1282 /** |
| 1287 * @return {!WebInspector.TimelineModel.RecordType} | 1283 * @return {!WebInspector.TimelineModel.RecordType} |
| 1288 */ | 1284 */ |
| 1289 type() { | 1285 type() { |
| 1290 return WebInspector.TimelineModel._eventType(this._event); | 1286 return WebInspector.TimelineModel._eventType(this._event); |
| 1291 } | 1287 } |
| 1292 | 1288 |
| 1293 /** | 1289 /** |
| 1294 * @param {string} key | |
| 1295 * @return {?Object} | |
| 1296 */ | |
| 1297 getUserObject(key) { | |
| 1298 if (key === 'TimelineUIUtils::preview-element') | |
| 1299 return this._event.previewElement; | |
| 1300 throw new Error('Unexpected key: ' + key); | |
| 1301 } | |
| 1302 | |
| 1303 /** | |
| 1304 * @param {string} key | |
| 1305 * @param {?Object|undefined} value | |
| 1306 */ | |
| 1307 setUserObject(key, value) { | |
| 1308 if (key !== 'TimelineUIUtils::preview-element') | |
| 1309 throw new Error('Unexpected key: ' + key); | |
| 1310 this._event.previewElement = /** @type {?Element} */ (value); | |
| 1311 } | |
| 1312 | |
| 1313 /** | |
| 1314 * @return {!WebInspector.TracingModel.Event} | 1290 * @return {!WebInspector.TracingModel.Event} |
| 1315 */ | 1291 */ |
| 1316 traceEvent() { | 1292 traceEvent() { |
| 1317 return this._event; | 1293 return this._event; |
| 1318 } | 1294 } |
| 1319 | 1295 |
| 1320 /** | 1296 /** |
| 1321 * @param {!WebInspector.TimelineModel.Record} child | 1297 * @param {!WebInspector.TimelineModel.Record} child |
| 1322 */ | 1298 */ |
| 1323 _addChild(child) { | 1299 _addChild(child) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1493 constructor() { | 1469 constructor() { |
| 1494 /** @type {?WebInspector.TracingModel.Event} */ | 1470 /** @type {?WebInspector.TracingModel.Event} */ |
| 1495 this._lastRecalcStyle = null; | 1471 this._lastRecalcStyle = null; |
| 1496 /** @type {?WebInspector.TracingModel.Event} */ | 1472 /** @type {?WebInspector.TracingModel.Event} */ |
| 1497 this._lastPaintWithLayer = null; | 1473 this._lastPaintWithLayer = null; |
| 1498 this._didPaint = false; | 1474 this._didPaint = false; |
| 1499 this._initializePerFrameState(); | 1475 this._initializePerFrameState(); |
| 1500 } | 1476 } |
| 1501 | 1477 |
| 1502 /** | 1478 /** |
| 1479 * @param {!WebInspector.TracingModel.Event} event | |
| 1480 * @return {?Array<!WebInspector.InvalidationTrackingEvent>} | |
| 1481 */ | |
| 1482 static invalidationEventsFor(event) { | |
| 1483 return event[WebInspector.InvalidationTracker._invalidationTrackingEventsSym bol] || null; | |
| 1484 } | |
| 1485 | |
| 1486 /** | |
| 1503 * @param {!WebInspector.InvalidationTrackingEvent} invalidation | 1487 * @param {!WebInspector.InvalidationTrackingEvent} invalidation |
| 1504 */ | 1488 */ |
| 1505 addInvalidation(invalidation) { | 1489 addInvalidation(invalidation) { |
| 1506 this._startNewFrameIfNeeded(); | 1490 this._startNewFrameIfNeeded(); |
| 1507 | 1491 |
| 1508 if (!invalidation.nodeId && !invalidation.paintId) { | 1492 if (!invalidation.nodeId && !invalidation.paintId) { |
| 1509 console.error('Invalidation lacks node information.'); | 1493 console.error('Invalidation lacks node information.'); |
| 1510 console.error(invalidation); | 1494 console.error(invalidation); |
| 1511 return; | 1495 return; |
| 1512 } | 1496 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1694 } | 1678 } |
| 1695 | 1679 |
| 1696 /** | 1680 /** |
| 1697 * @param {!WebInspector.TracingModel.Event} event | 1681 * @param {!WebInspector.TracingModel.Event} event |
| 1698 * @param {number} eventFrameId | 1682 * @param {number} eventFrameId |
| 1699 * @param {!WebInspector.InvalidationTrackingEvent} invalidation | 1683 * @param {!WebInspector.InvalidationTrackingEvent} invalidation |
| 1700 */ | 1684 */ |
| 1701 _addInvalidationToEvent(event, eventFrameId, invalidation) { | 1685 _addInvalidationToEvent(event, eventFrameId, invalidation) { |
| 1702 if (eventFrameId !== invalidation.frame) | 1686 if (eventFrameId !== invalidation.frame) |
| 1703 return; | 1687 return; |
| 1704 if (!event.invalidationTrackingEvents) | 1688 if (!event[WebInspector.InvalidationTracker._invalidationTrackingEventsSymbo l]) |
| 1705 event.invalidationTrackingEvents = [invalidation]; | 1689 event[WebInspector.InvalidationTracker._invalidationTrackingEventsSymbol] = [invalidation]; |
| 1706 else | 1690 else |
| 1707 event.invalidationTrackingEvents.push(invalidation); | 1691 event[WebInspector.InvalidationTracker._invalidationTrackingEventsSymbol]. push(invalidation); |
| 1708 } | 1692 } |
| 1709 | 1693 |
| 1710 /** | 1694 /** |
| 1711 * @param {!Array.<string>=} types | 1695 * @param {!Array.<string>=} types |
| 1712 * @return {!Iterator.<!WebInspector.InvalidationTrackingEvent>} | 1696 * @return {!Iterator.<!WebInspector.InvalidationTrackingEvent>} |
| 1713 */ | 1697 */ |
| 1714 _invalidationsOfTypes(types) { | 1698 _invalidationsOfTypes(types) { |
| 1715 var invalidations = this._invalidations; | 1699 var invalidations = this._invalidations; |
| 1716 if (!types) | 1700 if (!types) |
| 1717 types = Object.keys(invalidations); | 1701 types = Object.keys(invalidations); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1737 this._invalidations = {}; | 1721 this._invalidations = {}; |
| 1738 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEvent> >} */ | 1722 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEvent> >} */ |
| 1739 this._invalidationsByNodeId = {}; | 1723 this._invalidationsByNodeId = {}; |
| 1740 | 1724 |
| 1741 this._lastRecalcStyle = null; | 1725 this._lastRecalcStyle = null; |
| 1742 this._lastPaintWithLayer = null; | 1726 this._lastPaintWithLayer = null; |
| 1743 this._didPaint = false; | 1727 this._didPaint = false; |
| 1744 } | 1728 } |
| 1745 }; | 1729 }; |
| 1746 | 1730 |
| 1731 WebInspector.InvalidationTracker._invalidationTrackingEventsSymbol = Symbol('inv alidationTrackingEvents'); | |
| 1732 | |
| 1747 /** | 1733 /** |
| 1748 * @unrestricted | 1734 * @unrestricted |
| 1749 */ | 1735 */ |
| 1750 WebInspector.TimelineAsyncEventTracker = class { | 1736 WebInspector.TimelineAsyncEventTracker = class { |
| 1751 constructor() { | 1737 constructor() { |
| 1752 WebInspector.TimelineAsyncEventTracker._initialize(); | 1738 WebInspector.TimelineAsyncEventTracker._initialize(); |
| 1753 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !Map<string, !WebIns pector.TracingModel.Event>>} */ | 1739 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !Map<string, !WebIns pector.TracingModel.Event>>} */ |
| 1754 this._initiatorByType = new Map(); | 1740 this._initiatorByType = new Map(); |
| 1755 for (var initiator of WebInspector.TimelineAsyncEventTracker._asyncEvents.ke ys()) | 1741 for (var initiator of WebInspector.TimelineAsyncEventTracker._asyncEvents.ke ys()) |
| 1756 this._initiatorByType.set(initiator, new Map()); | 1742 this._initiatorByType.set(initiator, new Map()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1796 if (!initiatorInfo) | 1782 if (!initiatorInfo) |
| 1797 return; | 1783 return; |
| 1798 var id = event.args['data'][initiatorInfo.joinBy]; | 1784 var id = event.args['data'][initiatorInfo.joinBy]; |
| 1799 if (!id) | 1785 if (!id) |
| 1800 return; | 1786 return; |
| 1801 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ | 1787 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ |
| 1802 var initiatorMap = this._initiatorByType.get(initiatorType); | 1788 var initiatorMap = this._initiatorByType.get(initiatorType); |
| 1803 if (isInitiator) | 1789 if (isInitiator) |
| 1804 initiatorMap.set(id, event); | 1790 initiatorMap.set(id, event); |
| 1805 else | 1791 else |
| 1806 event.initiator = initiatorMap.get(id) || null; | 1792 WebInspector.TimelineData.forEvent(event).setInitiator(initiatorMap.get(id ) || null); |
| 1807 } | 1793 } |
| 1808 }; | 1794 }; |
| 1795 | |
| 1796 | |
| 1797 WebInspector.TimelineData = class { | |
| 1798 constructor() { | |
| 1799 /** @type {?string} */ | |
| 1800 this.warning = null; | |
| 1801 /** @type {?Element} */ | |
| 1802 this.previewElement = null; | |
| 1803 /** @type {?string} */ | |
| 1804 this.url = null; | |
| 1805 /** @type {number} */ | |
| 1806 this.backendNodeId = 0; | |
| 1807 /** @type {?Array<!Protocol.Runtime.CallFrame>} */ | |
| 1808 this.stackTrace = null; | |
| 1809 /** @type {?WebInspector.TracingModel.Event} */ | |
| 1810 this._initiator = null; | |
| 1811 /** @type {number|undefined} */ | |
| 1812 this.timeWaitingForMainThread; | |
| 1813 } | |
| 1814 | |
| 1815 /** | |
| 1816 * @param {!WebInspector.TracingModel.Event} initiator | |
| 1817 */ | |
| 1818 setInitiator(initiator) { | |
| 1819 this._initiator = initiator; | |
| 1820 if (!initiator || this.url) | |
| 1821 return; | |
| 1822 var initiatorURL = WebInspector.TimelineData.forEvent(initiator).url; | |
| 1823 if (initiatorURL) | |
| 1824 this.url = initiatorURL; | |
| 1825 } | |
| 1826 | |
| 1827 /** | |
| 1828 * @return {?WebInspector.TracingModel.Event} | |
| 1829 */ | |
| 1830 initiator() { | |
| 1831 return this._initiator; | |
| 1832 } | |
| 1833 | |
| 1834 /** | |
| 1835 * @return {?Protocol.Runtime.CallFrame} | |
| 1836 */ | |
| 1837 topFrame() { | |
| 1838 var stackTrace = this.stackTraceForSelfOrInitiator(); | |
| 1839 return stackTrace && stackTrace[0] || null; | |
| 1840 } | |
| 1841 | |
| 1842 /** | |
| 1843 * @return {?Array<!Protocol.Runtime.CallFrame>} | |
| 1844 */ | |
| 1845 stackTraceForSelfOrInitiator() { | |
| 1846 return this.stackTrace || (this._initiator && WebInspector.TimelineData.forE vent(this._initiator).stackTrace); | |
| 1847 } | |
| 1848 | |
| 1849 /** | |
| 1850 * @return !{WebInspector.TimelineData} | |
|
alph
2016/11/09 00:46:22
@param
| |
| 1851 */ | |
| 1852 static forEvent(event) { | |
| 1853 var data = event[WebInspector.TimelineData._symbol]; | |
| 1854 if (!data) { | |
| 1855 data = new WebInspector.TimelineData(); | |
| 1856 event[WebInspector.TimelineData._symbol] = data; | |
| 1857 } | |
| 1858 return data; | |
| 1859 } | |
| 1860 }; | |
| 1861 | |
| 1862 WebInspector.TimelineData._symbol = Symbol('timelineData'); | |
| OLD | NEW |