[webkit-changes] [WebKit/WebKit] 783a08: Web Inspector: Worker Info not Visible In Most Tim...
Devin Rousso
noreply at github.com
Fri Feb 14 17:16:41 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 783a08ad6950cdf316d3f4ab3807797f09f84dc0
https://github.com/WebKit/WebKit/commit/783a08ad6950cdf316d3f4ab3807797f09f84dc0
Author: Devin Rousso <hi at devinrousso.com>
Date: 2025-02-14 (Fri, 14 Feb 2025)
Changed paths:
M LayoutTests/inspector/sampling-profiler/basic.html
M LayoutTests/inspector/sampling-profiler/call-frame-with-dom-functions.html
M LayoutTests/inspector/sampling-profiler/eval-source-url.html
M LayoutTests/inspector/sampling-profiler/expression-location-info-expected.txt
M LayoutTests/inspector/sampling-profiler/expression-location-info.html
M LayoutTests/inspector/sampling-profiler/many-call-frames.html
M LayoutTests/inspector/sampling-profiler/named-function-expression.html
A LayoutTests/inspector/sampling-profiler/resources/calling-context-tree.js
M Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h
M Source/JavaScriptCore/inspector/protocol/Timeline.json
M Source/WebCore/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/bindings/js/ScriptModuleLoader.cpp
M Source/WebCore/inspector/InspectorController.cpp
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebCore/inspector/InspectorInstrumentation.h
M Source/WebCore/inspector/InstrumentingAgents.h
M Source/WebCore/inspector/WorkerInspectorController.cpp
M Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
M Source/WebCore/inspector/agents/InspectorTimelineAgent.h
M Source/WebCore/inspector/agents/WebHeapAgent.cpp
M Source/WebCore/inspector/agents/WebHeapAgent.h
A Source/WebCore/inspector/agents/page/PageTimelineAgent.cpp
A Source/WebCore/inspector/agents/page/PageTimelineAgent.h
A Source/WebCore/inspector/agents/worker/WorkerTimelineAgent.cpp
A Source/WebCore/inspector/agents/worker/WorkerTimelineAgent.h
M Source/WebCore/page/PerformanceUserTiming.cpp
M Source/WebCore/workers/WorkerOrWorkletScriptController.cpp
M Source/WebCore/workers/WorkerOrWorkletScriptController.h
M Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
M Source/WebInspectorUI/UserInterface/Controllers/HeapManager.js
M Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
M Source/WebInspectorUI/UserInterface/Main.html
M Source/WebInspectorUI/UserInterface/Models/CallingContextTree.js
M Source/WebInspectorUI/UserInterface/Models/CallingContextTreeNode.js
M Source/WebInspectorUI/UserInterface/Models/Instrument.js
M Source/WebInspectorUI/UserInterface/Models/ScriptInstrument.js
M Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
M Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
M Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js
M Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js
M Source/WebInspectorUI/UserInterface/Views/DataGrid.js
M Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js
M Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js
M Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js
A Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.css
M Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js
M Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js
M Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
Log Message:
-----------
Web Inspector: Worker Info not Visible In Most Timeline Profile Views like JavaScript & Events
https://bugs.webkit.org/show_bug.cgi?id=263334
rdar://117491838
Reviewed by BJ Burg.
This will allow developers to investigate performance issues in `Worker` using the Timelines Tab just like they can already do for other page content (i.e. main thread).
* Source/JavaScriptCore/inspector/protocol/Timeline.json:
* Source/WebCore/inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::createLazyAgents):
Expose `Timeline` in `Worker`.
* Source/WebCore/inspector/agents/InspectorTimelineAgent.h:
(WebCore::InspectorTimelineAgent::shouldStartHeapInstrument const):
(WebCore::InspectorTimelineAgent::instruments const):
* Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
(WebCore::InspectorTimelineAgent::enable):
(WebCore::InspectorTimelineAgent::disable):
(WebCore::InspectorTimelineAgent::start):
(WebCore::InspectorTimelineAgent::stop):
(WebCore::InspectorTimelineAgent::enabled const):
(WebCore::InspectorTimelineAgent::internalEnable):
(WebCore::InspectorTimelineAgent::internalDisable):
(WebCore::InspectorTimelineAgent::tracking const):
(WebCore::InspectorTimelineAgent::internalStart):
(WebCore::InspectorTimelineAgent::internalStop):
(WebCore::InspectorTimelineAgent::autoCaptureStarted const):
(WebCore::InspectorTimelineAgent::startFromConsole):
(WebCore::InspectorTimelineAgent::startProgrammaticCapture):
(WebCore::InspectorTimelineAgent::stopProgrammaticCapture):
(WebCore::InspectorTimelineAgent::toggleHeapInstrument):
(WebCore::InspectorTimelineAgent::toggleTimelineInstrument):
(WebCore::InspectorTimelineAgent::lastRecordEntry):
(WebCore::currentRunLoop): Deleted.
(WebCore::InspectorTimelineAgent::setAutoCaptureEnabled): Deleted.
(WebCore::InspectorTimelineAgent::didInvalidateLayout): Deleted.
(WebCore::InspectorTimelineAgent::willLayout): Deleted.
(WebCore::InspectorTimelineAgent::didLayout): Deleted.
(WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation): Deleted.
(WebCore::InspectorTimelineAgent::willRecalculateStyle): Deleted.
(WebCore::InspectorTimelineAgent::didRecalculateStyle): Deleted.
(WebCore::InspectorTimelineAgent::willComposite): Deleted.
(WebCore::InspectorTimelineAgent::didComposite): Deleted.
(WebCore::InspectorTimelineAgent::willPaint): Deleted.
(WebCore::InspectorTimelineAgent::didPaint): Deleted.
(WebCore::InspectorTimelineAgent::mainFrameStartedLoading): Deleted.
(WebCore::InspectorTimelineAgent::mainFrameNavigated): Deleted.
(WebCore::InspectorTimelineAgent::captureScreenshot): Deleted.
(WebCore::InspectorTimelineAgent::didCompleteRenderingFrame): Deleted.
* Source/WebCore/inspector/agents/page/PageTimelineAgent.h: Added.
* Source/WebCore/inspector/agents/page/PageTimelineAgent.cpp: Added.
(WebCore::currentRunLoop):
(WebCore::PageTimelineAgent::PageTimelineAgent):
(WebCore::PageTimelineAgent::enabled const):
(WebCore::PageTimelineAgent::internalEnable):
(WebCore::PageTimelineAgent::internalDisable):
(WebCore::PageTimelineAgent::tracking const):
(WebCore::PageTimelineAgent::internalStart):
(WebCore::PageTimelineAgent::internalStop):
(WebCore::PageTimelineAgent::setAutoCaptureEnabled):
(WebCore::PageTimelineAgent::didInvalidateLayout):
(WebCore::PageTimelineAgent::willLayout):
(WebCore::PageTimelineAgent::didLayout):
(WebCore::PageTimelineAgent::didScheduleStyleRecalculation):
(WebCore::PageTimelineAgent::willRecalculateStyle):
(WebCore::PageTimelineAgent::didRecalculateStyle):
(WebCore::PageTimelineAgent::willComposite):
(WebCore::PageTimelineAgent::didComposite):
(WebCore::PageTimelineAgent::willPaint):
(WebCore::PageTimelineAgent::didPaint):
(WebCore::PageTimelineAgent::mainFrameStartedLoading):
(WebCore::PageTimelineAgent::mainFrameNavigated):
(WebCore::PageTimelineAgent::didCompleteRenderingFrame):
(WebCore::PageTimelineAgent::shouldStartHeapInstrument const):
(WebCore::PageTimelineAgent::captureScreenshot):
* Source/WebCore/inspector/agents/worker/WorkerTimelineAgent.h: Added.
* Source/WebCore/inspector/agents/worker/WorkerTimelineAgent.cpp: Added.
(WebCore::WorkerTimelineAgent::WorkerTimelineAgent):
(WebCore::WorkerTimelineAgent::setAutoCaptureEnabled):
* Source/WebCore/inspector/InstrumentingAgents.h:
* Source/WebCore/inspector/InspectorController.cpp:
(WebCore::InspectorController::createLazyAgents):
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
(WebCore::InspectorInstrumentation::willLayoutImpl):
(WebCore::InspectorInstrumentation::didLayoutImpl):
(WebCore::InspectorInstrumentation::willCompositeImpl):
(WebCore::InspectorInstrumentation::didCompositeImpl):
(WebCore::InspectorInstrumentation::willPaintImpl):
(WebCore::InspectorInstrumentation::didPaintImpl):
(WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
(WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
(WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
(WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
(WebCore::InspectorInstrumentation::didCompleteRenderingFrameImpl):
Split the existing `InspectorTimelineAgent` into a `PageTimelineAgent` and `WorkerTimelineAgent`.
This is mainly done for clarity as certain concepts (e.g. compositing, navigation, screenshots, etc.) don't make sense in a `Worker`.
* Source/WebCore/workers/WorkerOrWorkletScriptController.h:
* Source/WebCore/workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::evaluate):
(WebCore::WorkerOrWorkletScriptController::evaluateModule):
* Source/WebCore/bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::evaluate):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willEvaluateScript):
(WebCore::InspectorInstrumentation::didEvaluateScript):
Add `InspectorInstrumentation` hooks before and after evaluating JS in `Worker`.
* Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h:
* Source/WebCore/inspector/agents/WebHeapAgent.h:
* Source/WebCore/inspector/agents/WebHeapAgent.cpp:
(WebCore::WebHeapAgent::didCreateFrontendAndBackend):
(WebCore::WebHeapAgent::willDestroyFrontendAndBackend):
Also expose `WebHeapAgent` via `InstrumentingAgents` instead of only just `PageHeapAgent`.
This is needed by `InspectorTimelineAgent` to start capturing heap snapshots during a timeline recording.
* Source/WebInspectorUI/UserInterface/Models/Instrument.js:
(WI.Instrument.startLegacyTimelineAgent):
(WI.Instrument.stopLegacyTimelineAgent):
Iterate over all `WI.Target` when starting a timeline recording now that `Timeline` also exists in `Worker`.
* Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js:
(WI.TimelineObserver.prototype.eventRecorded):
* Source/WebInspectorUI/UserInterface/Controllers/HeapManager.js:
(WI.HeapManager.prototype.garbageCollected):
Pass along the `WI.Target`.
* Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager):
(WI.TimelineManager.prototype.initializeTarget):
(WI.TimelineManager.prototype.capturingStarted):
(WI.TimelineManager.prototype.eventRecorded):
(WI.TimelineManager.prototype.scriptProfilerTrackingUpdated):
(WI.TimelineManager.prototype.scriptProfilerTrackingCompleted):
(WI.TimelineManager.prototype._processRecord):
(WI.TimelineManager.prototype._processEvent):
(WI.TimelineManager.prototype._stackTraceFromPayload):
(WI.TimelineManager.prototype._garbageCollected):
Have a separate array of `WI.ScriptTimelineRecord` for each `WI.Target`.
* Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js:
(WI.TimelineRecording):
(WI.TimelineRecording.async import):
(WI.TimelineRecording.prototype.get targets): Added.
(WI.TimelineRecording.prototype.callingContextTree): Added.
(WI.TimelineRecording.prototype.reset):
(WI.TimelineRecording.prototype.updateCallingContextTrees): Renamed from `initializeCallingContextTrees`.
(WI.TimelineRecording.prototype.get topDownCallingContextTree): Deleted.
(WI.TimelineRecording.prototype.get bottomUpCallingContextTree): Deleted.
(WI.TimelineRecording.prototype.get topFunctionsTopDownCallingContextTree): Deleted.
(WI.TimelineRecording.prototype.get topFunctionsBottomUpCallingContextTree): Deleted.
Have separate `WI.CallingContextTree` for each `WI.Target` (and for each `WI.CallingContextTree.Type`).
Callers must `updateCallingContextTrees` with a valid `WI.Target` before attempting to fetch a `WI.CallingContextTree` for that `WI.Target` (and `WI.CallingContextTree.Type`).
* Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js:
(WI.ScriptTimelineRecord.async fromJSON):
(WI.ScriptTimelineRecord.prototype.toJSON):
(WI.ScriptTimelineRecord.prototype.get target): Added.
(WI.ScriptTimelineRecord.prototype._initializeProfileFromPayload.profileNodeFromPayload):
* Source/WebInspectorUI/UserInterface/Models/CallingContextTree.js:
(WI.CallingContextTree):
(WI.CallingContextTree.prototype.get target): Added.
(WI.CallingContextTree.prototype.reset): Deleted.
(WI.CallingContextTree.__test_makeTreeFromProtocolMessageObject): Deleted.
(WI.CallingContextTree.prototype.__test_matchesStackTrace): Deleted.
(WI.CallingContextTree.prototype.__test_buildLeafLinkedLists): Deleted.
* Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js:
(WI.ProfileDataGridTree.prototype.get target): Added.
* Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js:
(WI.ProfileDataGridNode.prototype.iconClassName):
(WI.ProfileDataGridNode.prototype.filterableDataForColumn):
(WI.ProfileDataGridNode.prototype._displayContent):
Save and use the relevant `WI.Target`.
* Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js:
(WI.ScriptDetailsTimelineView):
(WI.ScriptDetailsTimelineView.prototype.closed):
(WI.ScriptDetailsTimelineView.prototype._processPendingRecords):
* Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js:
(WI.ScriptTimelineDataGridNode.prototype.get data):
Show the name of the `WI.Target` (a.k.a. "Context") when there's more than one.
* Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js:
(WI.ScriptProfileTimelineView):
(WI.ScriptProfileTimelineView.prototype.closed):
(WI.ScriptProfileTimelineView.prototype.get navigationItems):
(WI.ScriptProfileTimelineView.prototype._callingContextTreeForOrientation):
(WI.ScriptProfileTimelineView.prototype._updateTargetNavigationItemDisplay):
(WI.ScriptProfileTimelineView.prototype._displayNameForTarget):
(WI.ScriptProfileTimelineView.prototype._profileOrientationButtonClicked):
(WI.ScriptProfileTimelineView.prototype._topFunctionsButtonClicked):
(WI.ScriptProfileTimelineView.prototype._createProfileView):
(WI.ScriptProfileTimelineView.prototype._showProfileView):
(WI.ScriptProfileTimelineView.prototype._handleRecordingTargetAdded):
(WI.ScriptProfileTimelineView.prototype._populateTargetNavigationItemContextMenu):
(WI.ScriptProfileTimelineView.prototype._showProfileViewForOrientation): Deleted.
* Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.css: Added.
(.content-view.timeline-recording .navigation-bar > .script-profile-target > .selector-arrows):
Create a dropdown for all `WI.Target` when there's more than one to control which `WI.CallingContextTree` is shown.
We probably don't want to merge stack trace data from different `WI.Target` as it could be misleading if a function (or at least it's name and source code location) is used in multiple `WI.Target`.
* Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js:
(WI.ClusterContentView):
(WI.ClusterContentView.prototype.closed):
(WI.ClusterContentView.prototype._contentViewNavigationItemsDidChange):
This appears to be the first time that a `WI.ContentView` inside a `WI.ClusterContentView` ever dynamically changes the result of `get navigationItems`, so dispatch a `WI.ContentView.Event.NavigationItemsDidChange` to the parent `WI.ContentBrowser` so that it's updated accordingly.
* Source/WebInspectorUI/UserInterface/Views/DataGrid.js:
(WI.DataGrid.prototype.insertColumn): All cells need to be refreshed when a new column is inserted.
(WI.DataGrid.prototype.setColumnVisible): When a new column is first inserted it doesn't have a previous `hidden` state, so always make sure to set one.
(WI.DataGrid.prototype._contextMenuInHeader): Columns should be listed by ordinal instead of insertion order.
* Source/WebCore/page/PerformanceUserTiming.cpp:
(WebCore::PerformanceUserTiming::mark):
* Source/WebInspectorUI/UserInterface/Models/ScriptInstrument.js:
(WI.ScriptInstrument.prototype.stopInstrumentation):
Drive-by: remove unused variable.
* Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.js:
(WI.CPUTimelineView.prototype.closed):
* Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js:
(WI.HeapAllocationsTimelineView.prototype.closed):
* Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js:
(WI.LayoutTimelineView.prototype.closed):
* Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js:
(WI.MemoryTimelineView.prototype.closed):
* Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js:
(WI.NetworkTimelineView.prototype.closed):
* Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js:
(WI.OverviewTimelineView.prototype.closed):
* Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js:
(WI.RenderingFrameTimelineView.prototype.closed):
Drive-by: add missing `super` call.
* Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
Drive-by: add missing separator.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebInspectorUI/UserInterface/Main.html:
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
* Source/WebInspectorUI/UserInterface/Models/CallingContextTreeNode.js:
(WI.CallingContextTreeNode.prototype.__test_buildLeafLinkedLists): Deleted.
* LayoutTests/inspector/sampling-profiler/basic.html:
* LayoutTests/inspector/sampling-profiler/call-frame-with-dom-functions.html:
* LayoutTests/inspector/sampling-profiler/eval-source-url.html:
* LayoutTests/inspector/sampling-profiler/expression-location-info.html:
* LayoutTests/inspector/sampling-profiler/expression-location-info-expected.txt:
* LayoutTests/inspector/sampling-profiler/many-call-frames.html:
* LayoutTests/inspector/sampling-profiler/named-function-expression.html:
* LayoutTests/inspector/sampling-profiler/resources/calling-context-tree.js: Added.
Move test functions to test files so they're not shipped in production builds.
Canonical link: https://commits.webkit.org/290430@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list