Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 2242351e265d11469993410984fdda3ec21e6de2 https://github.com/WebKit/WebKit/commit/2242351e265d11469993410984fdda3ec21e6de2 Author: Ben Nham <n...@apple.com> Date: 2023-11-09 (Thu, 09 Nov 2023)
Changed paths: M Source/JavaScriptCore/runtime/JSGlobalObject.cpp M Source/WTF/wtf/SystemTracing.h M Source/WTF/wtf/cocoa/SystemTracingCocoa.cpp M Source/WebCore/dom/Document.cpp M Source/WebCore/dom/ScriptElement.cpp M Source/WebCore/page/LocalDOMWindow.cpp M Source/WebCore/page/LocalFrameView.cpp M Source/WebCore/platform/mac/ScrollingEffectsController.mm M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp M Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm M Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm Log Message: ----------- Add support for os_signpost for WebContent on iOS https://bugs.webkit.org/show_bug.cgi?id=264357 rdar://117593169 Reviewed by Per Arne Vollan. 269026@main blocked WebContent from talking to logd. This also broke os_signpost in WebContent since signposts are emitted to logd. To work around this, in this patch we send WebContent os_signposts down the same IPC pipe as regular os_logs. On the receiving side (in NetworkProcess), we deserialize the log line and emit an os_signpost. This requires some unfortunate use of scanf on the receiving side, but I don't see a better way of doing this without improved signpost hooks from libtrace (rdar://111422207). This also requires a bunch of C macros because signpost names *must* be C string literal tokens from the point of view of the C preprocessor, due to the way os_signpost is implemented. So there are several places here where we use a switch-case through every single possible signpost name in order to emit the right os_signpost call. The various os_signpost APIs themselves are also macros, so there are also places where we have to switch-case through every signpost API type (emit event, begin interval, and end inverval) in order to call the appropriate os_signpost macro. I also made some changes to few existing callers of os_signpost in the codebase: - There were two places where we were calling the EmitSignpostAlways variant of the API. This probably doesn't make sense anymore considering a signpost is now heavier weight and requires an IPC. I converted those call sites to use `os_signpost` directly, which means they emit signposts when logd is enabled (on Mac), and don't emit signposts when logd is blocked. - `handleWheelEvent` used the animation tagged variant of the signpost API. This is hard to continue using when sending signposts over IPC since it requires the format string to be encoded in a particular manner. I also converted this to use os_signpost directly, which should be okay since this code is only running on Mac. - I consolidated all of the page loading and paint signposts under a single signpost name called NavigationAndPaintTiming. For each document loaded, we now emit an interval from [startTime, loadEventEnd) under this signpost name. Within this interval, key milestones from the NavigationTiming and PaintTiming APIs are annotated, e.g. domInteractive, domContentLoadedEventStart, loadEventStart, firstContentfulPaint, etc. * Source/JavaScriptCore/runtime/JSGlobalObject.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/WTF/wtf/SystemTracing.h: * Source/WTF/wtf/cocoa/SystemTracingCocoa.cpp: (beginSignpostInterval): (endSignpostInterval): (emitSignpostEvent): (emitSignpost): (WTFSignpostHandleIndirectLog): (machTimebaseInfo): (WTFCurrentContinuousTime): * Source/WebCore/dom/Document.cpp: (WebCore::m_frameIdentifier): (WebCore::Document::~Document): (WebCore::Document::setReadyState): (WebCore::Document::enqueuePaintTimingEntryIfNeeded): (WebCore::Document::finishedParsing): * Source/WebCore/dom/ScriptElement.cpp: (WebCore::ScriptElement::executeClassicScript): (WebCore::ScriptElement::registerImportMap): (WebCore::ScriptElement::executeModuleScript): * Source/WebCore/page/LocalDOMWindow.cpp: (WebCore::LocalDOMWindow::dispatchLoadEvent): * Source/WebCore/page/LocalFrameView.cpp: (WebCore::LocalFrameView::firePaintRelatedMilestonesIfNeeded): * Source/WebCore/platform/mac/ScrollingEffectsController.mm: (WebCore::ScrollingEffectsController::handleWheelEvent): * Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::logOnBehalfOfWebContent): * Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::didSendData): (WebKit::NetworkDataTaskCocoa::didReceiveChallenge): (WebKit::NetworkDataTaskCocoa::didCompleteWithError): (WebKit::NetworkDataTaskCocoa::didReceiveData): (WebKit::NetworkDataTaskCocoa::didReceiveResponse): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCocoa::cancel): (WebKit::NetworkDataTaskCocoa::resume): * Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::registerLogHook): Canonical link: https://commits.webkit.org/270471@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes