| 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 this._requestAnimationFrameEvents = {}; | 748 this._requestAnimationFrameEvents = {}; |
| 749 this._invalidationTracker = new WebInspector.InvalidationTracker(); | 749 this._invalidationTracker = new WebInspector.InvalidationTracker(); |
| 750 this._layoutInvalidate = {}; | 750 this._layoutInvalidate = {}; |
| 751 this._lastScheduleStyleRecalculation = {}; | 751 this._lastScheduleStyleRecalculation = {}; |
| 752 this._webSocketCreateEvents = {}; | 752 this._webSocketCreateEvents = {}; |
| 753 this._paintImageEventByPixelRefId = {}; | 753 this._paintImageEventByPixelRefId = {}; |
| 754 this._lastPaintForLayer = {}; | 754 this._lastPaintForLayer = {}; |
| 755 this._lastRecalculateStylesEvent = null; | 755 this._lastRecalculateStylesEvent = null; |
| 756 this._currentScriptEvent = null; | 756 this._currentScriptEvent = null; |
| 757 this._eventStack = []; | 757 this._eventStack = []; |
| 758 this._layerTreeActivatedAfterLoad = false; |
| 759 this._expectFirstPaint = false; |
| 758 }, | 760 }, |
| 759 | 761 |
| 760 /** | 762 /** |
| 761 * @param {number} startTime | 763 * @param {number} startTime |
| 762 * @param {?number} endTime | 764 * @param {?number} endTime |
| 763 * @param {!WebInspector.TracingModel.Thread} mainThread | 765 * @param {!WebInspector.TracingModel.Thread} mainThread |
| 764 * @param {!WebInspector.TracingModel.Thread} thread | 766 * @param {!WebInspector.TracingModel.Thread} thread |
| 765 */ | 767 */ |
| 766 _processThreadEvents: function(startTime, endTime, mainThread, thread) | 768 _processThreadEvents: function(startTime, endTime, mainThread, thread) |
| 767 { | 769 { |
| 770 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 768 var events = thread.events(); | 771 var events = thread.events(); |
| 769 var length = events.length; | 772 var length = events.length; |
| 770 var i = events.lowerBound(startTime, function (time, event) { return tim
e - event.startTime }); | 773 var i = events.lowerBound(startTime, function (time, event) { return tim
e - event.startTime }); |
| 771 | 774 |
| 772 var threadEvents; | 775 var threadEvents; |
| 773 var virtualThread = null; | 776 var virtualThread = null; |
| 774 if (thread === mainThread) { | 777 if (thread === mainThread) { |
| 775 threadEvents = this._mainThreadEvents; | 778 threadEvents = this._mainThreadEvents; |
| 776 this._mainThreadAsyncEvents = this._mainThreadAsyncEvents.concat(thr
ead.asyncEvents()); | 779 this._mainThreadAsyncEvents = this._mainThreadAsyncEvents.concat(thr
ead.asyncEvents()); |
| 777 } else { | 780 } else { |
| 778 virtualThread = new WebInspector.TimelineModel.VirtualThread(thread.
name()); | 781 virtualThread = new WebInspector.TimelineModel.VirtualThread(thread.
name()); |
| 779 threadEvents = virtualThread.events; | 782 threadEvents = virtualThread.events; |
| 780 virtualThread.asyncEvents = virtualThread.asyncEvents.concat(thread.
asyncEvents()); | 783 virtualThread.asyncEvents = virtualThread.asyncEvents.concat(thread.
asyncEvents()); |
| 781 this._virtualThreads.push(virtualThread); | 784 this._virtualThreads.push(virtualThread); |
| 782 } | 785 } |
| 783 | 786 |
| 784 this._eventStack = []; | 787 this._eventStack = []; |
| 785 for (; i < length; i++) { | 788 for (; i < length; i++) { |
| 786 var event = events[i]; | 789 var event = events[i]; |
| 787 if (endTime && event.startTime >= endTime) | 790 if (endTime && event.startTime >= endTime) |
| 788 break; | 791 break; |
| 789 this._processEvent(event); | 792 this._processEvent(event); |
| 793 if (this._expectFirstPaint && event.name === recordTypes.DrawFrame &
& this._layerTreeActivatedAfterLoad) { |
| 794 threadEvents.push(new WebInspector.TracingModel.Event(event.cate
gory, recordTypes.MarkFirstPaint, WebInspector.TracingModel.Phase.Instant, event
.startTime, event.thread)); |
| 795 this._expectFirstPaint = false; |
| 796 } |
| 790 threadEvents.push(event); | 797 threadEvents.push(event); |
| 791 this._inspectedTargetEvents.push(event); | 798 this._inspectedTargetEvents.push(event); |
| 792 } | 799 } |
| 793 | 800 |
| 794 if (this._cpuProfiles && thread.target()) { | 801 if (this._cpuProfiles && thread.target()) { |
| 795 var cpuProfile = this._cpuProfiles[thread.target().id()]; | 802 var cpuProfile = this._cpuProfiles[thread.target().id()]; |
| 796 if (cpuProfile) { | 803 if (cpuProfile) { |
| 797 var jsSamples = WebInspector.TimelineJSProfileProcessor.generate
TracingEventsFromCpuProfile(cpuProfile, thread); | 804 var jsSamples = WebInspector.TimelineJSProfileProcessor.generate
TracingEventsFromCpuProfile(cpuProfile, thread); |
| 798 var mergedEvents = threadEvents.mergeOrdered(jsSamples, WebInspe
ctor.TracingModel.Event.orderedCompareStartTime); | 805 var mergedEvents = threadEvents.mergeOrdered(jsSamples, WebInspe
ctor.TracingModel.Event.orderedCompareStartTime); |
| 799 var jsFrameEvents = WebInspector.TimelineJSProfileProcessor.gene
rateJSFrameEvents(mergedEvents); | 806 var jsFrameEvents = WebInspector.TimelineJSProfileProcessor.gene
rateJSFrameEvents(mergedEvents); |
| 800 mergedEvents = jsFrameEvents.mergeOrdered(mergedEvents, WebInspe
ctor.TracingModel.Event.orderedCompareStartTime); | 807 mergedEvents = jsFrameEvents.mergeOrdered(mergedEvents, WebInspe
ctor.TracingModel.Event.orderedCompareStartTime); |
| 801 if (virtualThread) | 808 if (virtualThread) |
| 802 virtualThread.events = mergedEvents; | 809 virtualThread.events = mergedEvents; |
| 803 else | 810 else |
| 804 this._mainThreadEvents = mergedEvents; | 811 this._mainThreadEvents = mergedEvents; |
| 805 this._inspectedTargetEvents = this._inspectedTargetEvents.concat
(jsSamples, jsFrameEvents); | 812 this._inspectedTargetEvents = this._inspectedTargetEvents.concat
(jsSamples, jsFrameEvents); |
| 806 } | 813 } |
| 807 } | 814 } |
| 808 }, | 815 }, |
| 809 | 816 |
| 810 /** | 817 /** |
| 811 * @param {!WebInspector.TracingModel.Event} event | 818 * @param {!WebInspector.TracingModel.Event} event |
| 812 */ | 819 */ |
| 813 _processEvent: function(event) | 820 _processEvent: function(event) |
| 814 { | 821 { |
| 815 var recordTypes = WebInspector.TimelineModel.RecordType; | 822 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 816 | |
| 817 var eventStack = this._eventStack; | 823 var eventStack = this._eventStack; |
| 818 while (eventStack.length && eventStack.peekLast().endTime < event.startT
ime) | 824 while (eventStack.length && eventStack.peekLast().endTime < event.startT
ime) |
| 819 eventStack.pop(); | 825 eventStack.pop(); |
| 820 var duration = event.duration; | 826 var duration = event.duration; |
| 821 if (duration) { | 827 if (duration) { |
| 822 if (eventStack.length) { | 828 if (eventStack.length) { |
| 823 var parent = eventStack.peekLast(); | 829 var parent = eventStack.peekLast(); |
| 824 parent.selfTime -= duration; | 830 parent.selfTime -= duration; |
| 825 } | 831 } |
| 826 event.selfTime = duration; | 832 event.selfTime = duration; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 break; | 982 break; |
| 977 | 983 |
| 978 case recordTypes.DrawLazyPixelRef: | 984 case recordTypes.DrawLazyPixelRef: |
| 979 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage
); | 985 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage
); |
| 980 if (!paintImageEvent) | 986 if (!paintImageEvent) |
| 981 break; | 987 break; |
| 982 this._paintImageEventByPixelRefId[event.args["LazyPixelRef"]] = pain
tImageEvent; | 988 this._paintImageEventByPixelRefId[event.args["LazyPixelRef"]] = pain
tImageEvent; |
| 983 event.backendNodeId = paintImageEvent.backendNodeId; | 989 event.backendNodeId = paintImageEvent.backendNodeId; |
| 984 event.imageURL = paintImageEvent.imageURL; | 990 event.imageURL = paintImageEvent.imageURL; |
| 985 break; | 991 break; |
| 992 |
| 993 case recordTypes.MarkDOMContent: |
| 994 if (!event.args["data"]["isMainFrame"]) |
| 995 break; |
| 996 this._expectFirstPaint = true; |
| 997 this._layerTreeActivatedAfterLoad = false; |
| 998 break; |
| 999 |
| 1000 case recordTypes.ActivateLayerTree: |
| 1001 this._layerTreeActivatedAfterLoad = true; |
| 1002 break; |
| 986 } | 1003 } |
| 987 }, | 1004 }, |
| 988 | 1005 |
| 989 /** | 1006 /** |
| 990 * @param {string} name | 1007 * @param {string} name |
| 991 * @return {?WebInspector.TracingModel.Event} | 1008 * @return {?WebInspector.TracingModel.Event} |
| 992 */ | 1009 */ |
| 993 _findAncestorEvent: function(name) | 1010 _findAncestorEvent: function(name) |
| 994 { | 1011 { |
| 995 for (var i = this._eventStack.length - 1; i >= 0; --i) { | 1012 for (var i = this._eventStack.length - 1; i >= 0; --i) { |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 _initializePerFrameState: function() | 1714 _initializePerFrameState: function() |
| 1698 { | 1715 { |
| 1699 /** @type {!Array.<!WebInspector.InvalidationTrackingEvent>} */ | 1716 /** @type {!Array.<!WebInspector.InvalidationTrackingEvent>} */ |
| 1700 this._invalidationEvents = []; | 1717 this._invalidationEvents = []; |
| 1701 this._lastStyleRecalcEventIndex = 0; | 1718 this._lastStyleRecalcEventIndex = 0; |
| 1702 this._lastLayoutEventIndex = 0; | 1719 this._lastLayoutEventIndex = 0; |
| 1703 this._lastPaintWithLayer = undefined; | 1720 this._lastPaintWithLayer = undefined; |
| 1704 this._didPaint = false; | 1721 this._didPaint = false; |
| 1705 } | 1722 } |
| 1706 } | 1723 } |
| OLD | NEW |