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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 this._requestAnimationFrameEvents = {}; | 800 this._requestAnimationFrameEvents = {}; |
801 this._invalidationTracker = new WebInspector.InvalidationTracker(); | 801 this._invalidationTracker = new WebInspector.InvalidationTracker(); |
802 this._layoutInvalidate = {}; | 802 this._layoutInvalidate = {}; |
803 this._lastScheduleStyleRecalculation = {}; | 803 this._lastScheduleStyleRecalculation = {}; |
804 this._webSocketCreateEvents = {}; | 804 this._webSocketCreateEvents = {}; |
805 this._paintImageEventByPixelRefId = {}; | 805 this._paintImageEventByPixelRefId = {}; |
806 this._lastPaintForLayer = {}; | 806 this._lastPaintForLayer = {}; |
807 this._lastRecalculateStylesEvent = null; | 807 this._lastRecalculateStylesEvent = null; |
808 this._currentScriptEvent = null; | 808 this._currentScriptEvent = null; |
809 this._eventStack = []; | 809 this._eventStack = []; |
810 this._layerTreeActivatedAfterLoad = false; | |
811 this._expectFirstPaint = false; | |
812 }, | 810 }, |
813 | 811 |
814 /** | 812 /** |
815 * @param {number} startTime | 813 * @param {number} startTime |
816 * @param {?number} endTime | 814 * @param {?number} endTime |
817 * @param {!WebInspector.TracingModel.Thread} mainThread | 815 * @param {!WebInspector.TracingModel.Thread} mainThread |
818 * @param {!WebInspector.TracingModel.Thread} thread | 816 * @param {!WebInspector.TracingModel.Thread} thread |
819 * @param {number} workerId | 817 * @param {number} workerId |
820 */ | 818 */ |
821 _processThreadEvents: function(startTime, endTime, mainThread, thread, worke
rId) | 819 _processThreadEvents: function(startTime, endTime, mainThread, thread, worke
rId) |
(...skipping 25 matching lines...) Expand all Loading... |
847 | 845 |
848 this._eventStack = []; | 846 this._eventStack = []; |
849 var recordTypes = WebInspector.TimelineModel.RecordType; | 847 var recordTypes = WebInspector.TimelineModel.RecordType; |
850 var i = events.lowerBound(startTime, function (time, event) { return tim
e - event.startTime }); | 848 var i = events.lowerBound(startTime, function (time, event) { return tim
e - event.startTime }); |
851 var length = events.length; | 849 var length = events.length; |
852 for (; i < length; i++) { | 850 for (; i < length; i++) { |
853 var event = events[i]; | 851 var event = events[i]; |
854 if (endTime && event.startTime >= endTime) | 852 if (endTime && event.startTime >= endTime) |
855 break; | 853 break; |
856 this._processEvent(event); | 854 this._processEvent(event); |
857 if (this._expectFirstPaint && event.name === recordTypes.DrawFrame &
& this._layerTreeActivatedAfterLoad) { | |
858 threadEvents.push(new WebInspector.TracingModel.Event(event.cate
gory, recordTypes.MarkFirstPaint, WebInspector.TracingModel.Phase.Instant, event
.startTime, event.thread)); | |
859 this._expectFirstPaint = false; | |
860 } | |
861 threadEvents.push(event); | 855 threadEvents.push(event); |
862 this._inspectedTargetEvents.push(event); | 856 this._inspectedTargetEvents.push(event); |
863 } | 857 } |
864 }, | 858 }, |
865 | 859 |
866 /** | 860 /** |
867 * @param {!WebInspector.TracingModel.Event} event | 861 * @param {!WebInspector.TracingModel.Event} event |
868 */ | 862 */ |
869 _processEvent: function(event) | 863 _processEvent: function(event) |
870 { | 864 { |
871 var recordTypes = WebInspector.TimelineModel.RecordType; | 865 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 866 |
872 var eventStack = this._eventStack; | 867 var eventStack = this._eventStack; |
873 while (eventStack.length && eventStack.peekLast().endTime < event.startT
ime) | 868 while (eventStack.length && eventStack.peekLast().endTime < event.startT
ime) |
874 eventStack.pop(); | 869 eventStack.pop(); |
875 var duration = event.duration; | 870 var duration = event.duration; |
876 if (duration) { | 871 if (duration) { |
877 if (eventStack.length) { | 872 if (eventStack.length) { |
878 var parent = eventStack.peekLast(); | 873 var parent = eventStack.peekLast(); |
879 parent.selfTime -= duration; | 874 parent.selfTime -= duration; |
880 } | 875 } |
881 event.selfTime = duration; | 876 event.selfTime = duration; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 break; | 1024 break; |
1030 | 1025 |
1031 case recordTypes.DrawLazyPixelRef: | 1026 case recordTypes.DrawLazyPixelRef: |
1032 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage
); | 1027 var paintImageEvent = this._findAncestorEvent(recordTypes.PaintImage
); |
1033 if (!paintImageEvent) | 1028 if (!paintImageEvent) |
1034 break; | 1029 break; |
1035 this._paintImageEventByPixelRefId[event.args["LazyPixelRef"]] = pain
tImageEvent; | 1030 this._paintImageEventByPixelRefId[event.args["LazyPixelRef"]] = pain
tImageEvent; |
1036 event.backendNodeId = paintImageEvent.backendNodeId; | 1031 event.backendNodeId = paintImageEvent.backendNodeId; |
1037 event.imageURL = paintImageEvent.imageURL; | 1032 event.imageURL = paintImageEvent.imageURL; |
1038 break; | 1033 break; |
1039 | |
1040 case recordTypes.MarkDOMContent: | |
1041 if (!event.args["data"]["isMainFrame"]) | |
1042 break; | |
1043 this._expectFirstPaint = true; | |
1044 this._layerTreeActivatedAfterLoad = false; | |
1045 break; | |
1046 | |
1047 case recordTypes.ActivateLayerTree: | |
1048 this._layerTreeActivatedAfterLoad = true; | |
1049 break; | |
1050 } | 1034 } |
1051 }, | 1035 }, |
1052 | 1036 |
1053 /** | 1037 /** |
1054 * @param {string} name | 1038 * @param {string} name |
1055 * @return {?WebInspector.TracingModel.Event} | 1039 * @return {?WebInspector.TracingModel.Event} |
1056 */ | 1040 */ |
1057 _findAncestorEvent: function(name) | 1041 _findAncestorEvent: function(name) |
1058 { | 1042 { |
1059 for (var i = this._eventStack.length - 1; i >= 0; --i) { | 1043 for (var i = this._eventStack.length - 1; i >= 0; --i) { |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 _initializePerFrameState: function() | 1813 _initializePerFrameState: function() |
1830 { | 1814 { |
1831 /** @type {!Object.<string, ?Array.<!WebInspector.InvalidationTrackingEv
ent>>} */ | 1815 /** @type {!Object.<string, ?Array.<!WebInspector.InvalidationTrackingEv
ent>>} */ |
1832 this._invalidations = {}; | 1816 this._invalidations = {}; |
1833 | 1817 |
1834 this._lastRecalcStyle = undefined; | 1818 this._lastRecalcStyle = undefined; |
1835 this._lastPaintWithLayer = undefined; | 1819 this._lastPaintWithLayer = undefined; |
1836 this._didPaint = false; | 1820 this._didPaint = false; |
1837 } | 1821 } |
1838 } | 1822 } |
OLD | NEW |