Title: [240351] trunk/Source/WebInspectorUI
- Revision
- 240351
- Author
- [email protected]
- Date
- 2019-01-23 11:29:18 -0800 (Wed, 23 Jan 2019)
Log Message
WebInspector: Confusingly nested events in the timeline for Mutation Observers
https://bugs.webkit.org/show_bug.cgi?id=192884
<rdar://problem/46854178>
Reviewed by Joseph Pecoraro.
If a microtask event (e.g. `ObserverCallback`) is contained within a `EvaluatedScript`
event, move that microtask event to be a sibling of the `EvaluateScript`, subtracting the
microtask's time taken from the `EvaluateScript`'s time. If there are no other children
after this move, then remove the `EvaluateScript` altogether.
* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype.eventRecorded.fixMicrotaskPlacement): Added.
(WI.TimelineManager.prototype.eventRecorded):
(WI.TimelineManager.prototype._mergeScriptProfileRecords):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (240350 => 240351)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-01-23 19:18:59 UTC (rev 240350)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-01-23 19:29:18 UTC (rev 240351)
@@ -1,3 +1,21 @@
+2019-01-23 Devin Rousso <[email protected]>
+
+ WebInspector: Confusingly nested events in the timeline for Mutation Observers
+ https://bugs.webkit.org/show_bug.cgi?id=192884
+ <rdar://problem/46854178>
+
+ Reviewed by Joseph Pecoraro.
+
+ If a microtask event (e.g. `ObserverCallback`) is contained within a `EvaluatedScript`
+ event, move that microtask event to be a sibling of the `EvaluateScript`, subtracting the
+ microtask's time taken from the `EvaluateScript`'s time. If there are no other children
+ after this move, then remove the `EvaluateScript` altogether.
+
+ * UserInterface/Controllers/TimelineManager.js:
+ (WI.TimelineManager.prototype.eventRecorded.fixMicrotaskPlacement): Added.
+ (WI.TimelineManager.prototype.eventRecorded):
+ (WI.TimelineManager.prototype._mergeScriptProfileRecords):
+
2019-01-23 Joseph Pecoraro <[email protected]>
Web Inspector: Network Waterfall column should redraw when adding/removing new columns
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (240350 => 240351)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js 2019-01-23 19:18:59 UTC (rev 240350)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js 2019-01-23 19:29:18 UTC (rev 240351)
@@ -356,6 +356,28 @@
if (!this._isCapturing)
return;
+ function fixMicrotaskPlacement(children)
+ {
+ let newChildren = [];
+ for (let child of children) {
+ if (child.type === TimelineAgent.EventType.EvaluateScript) {
+ let [microtasks, events] = child.children.partition((grandchild) => {
+ return grandchild.type === TimelineAgent.EventType.ObserverCallback;
+ });
+
+ if (events.length) {
+ child.children = events;
+ child.endTime = events.lastValue.endTime;
+ newChildren.push(child);
+ }
+
+ newChildren = newChildren.concat(microtasks);
+ } else
+ newChildren.push(child);
+ }
+ return newChildren;
+ }
+
var records = [];
// Iterate over the records tree using a stack. Doing this recursively has
@@ -376,7 +398,7 @@
}
if (recordPayload.children && recordPayload.children.length)
- stack.push({array: recordPayload.children, parent: recordPayload, parentRecord: record || entry.parentRecord, index: 0});
+ stack.push({array: fixMicrotaskPlacement(recordPayload.children), parent: recordPayload, parentRecord: record || entry.parentRecord, index: 0});
++entry.index;
} else
stack.pop();
@@ -1055,15 +1077,23 @@
webRecord.profilePayload = profilerRecord.profilePayload;
profilerRecord = nextScriptProfilerRecord();
+ let firstProfilerRecordForWebRecord = null;
+
// If there are more script profile records in the same time interval, add them
// as individual script evaluated records with profiles. This can happen with
// web microtask checkpoints that are technically inside of other web records.
// FIXME: <https://webkit.org/b/152903> Web Inspector: Timeline Cleanup: Better Timeline Record for Microtask Checkpoints
while (profilerRecord && recordEnclosesRecord(webRecord, profilerRecord)) {
+ if (!firstProfilerRecordForWebRecord)
+ firstProfilerRecordForWebRecord = profilerRecord;
+
this._addRecord(profilerRecord);
profilerRecord = nextScriptProfilerRecord();
}
+ if (firstProfilerRecordForWebRecord)
+ webRecord.endTime = firstProfilerRecordForWebRecord.startTime;
+
webRecord = nextWebTimelineRecord();
continue;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes