Title: [295287] trunk/Source
Revision
295287
Author
pvol...@apple.com
Date
2022-06-06 08:22:21 -0700 (Mon, 06 Jun 2022)

Log Message

Eagerly soft link Data Detection frameworks
https://bugs.webkit.org/show_bug.cgi?id=241267

Reviewed by Geoffrey Garen.

Eagerly soft link Data Detection frameworks in the WebContent process. There are two motivations behind this change.
First, soft linking frameworks may lead to communication with launchd. Doing the soft linking before the WebContent
process has finished launching, will help our effort in blocking launchd post launch. Second, the data detection
frameworks are normally used in every WebContent process, and eagerly soft linking them should be a performance
improvement. Ideally, these frameworks should be hard linked or weak linked. However, that would most likely create
cycles in the build dependencies.

* Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h:
* Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm:
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::softlinkDataDetectorsFrameworks):
(WebKit::WebProcess::platformInitializeWebProcess):

Canonical link: https://commits.webkit.org/251333@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h (295286 => 295287)


--- trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h	2022-06-06 14:34:46 UTC (rev 295286)
+++ trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h	2022-06-06 15:22:21 UTC (rev 295287)
@@ -30,6 +30,8 @@
 #include <pal/spi/cocoa/DataDetectorsCoreSPI.h>
 #include <wtf/SoftLinking.h>
 
+SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, DataDetectorsCore);
+
 SOFT_LINK_CLASS_FOR_HEADER(PAL, DDScannerResult)
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm (295286 => 295287)


--- trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm	2022-06-06 14:34:46 UTC (rev 295286)
+++ trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm	2022-06-06 15:22:21 UTC (rev 295287)
@@ -30,7 +30,7 @@
 #include <pal/spi/cocoa/DataDetectorsCoreSPI.h>
 #include <wtf/SoftLinking.h>
 
-SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(PAL, DataDetectorsCore)
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectorsCore, PAL_EXPORT)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectorsCore, DDScannerResult, PAL_EXPORT)
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (295286 => 295287)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2022-06-06 14:34:46 UTC (rev 295286)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2022-06-06 15:22:21 UTC (rev 295287)
@@ -154,6 +154,10 @@
 #import <WebCore/CaptionUserPreferencesMediaAF.h>
 #endif
 
+#if ENABLE(DATA_DETECTION) && PLATFORM(IOS_FAMILY)
+#import <pal/spi/ios/DataDetectorsUISPI.h>
+#endif
+
 #import <WebCore/MediaAccessibilitySoftLink.h>
 #import <pal/cf/AudioToolboxSoftLink.h>
 #import <pal/cf/VideoToolboxSoftLink.h>
@@ -224,6 +228,16 @@
 }
 #endif
 
+static void softlinkDataDetectorsFrameworks()
+{
+#if ENABLE(DATA_DETECTION)
+    PAL::isDataDetectorsCoreFrameworkAvailable();
+#if PLATFORM(IOS_FAMILY)
+    DataDetectorsUILibrary();
+#endif // PLATFORM(IOS_FAMILY)
+#endif // ENABLE(DATA_DETECTION)
+}
+
 void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
     applyProcessCreationParameters(parameters.auxiliaryProcessParameters);
@@ -418,6 +432,10 @@
 
     if (!isParentProcessAFullWebBrowser(*this))
         disableURLSchemeCheckInDataDetectors();
+
+    // Soft link frameworks related to Data Detection before we disconnect from launchd because these frameworks connect to
+    // launchd temporarily at link time to register XPC services. See rdar://93598951 (my feature request to stop doing that)
+    softlinkDataDetectorsFrameworks();
 }
 
 void WebProcess::platformSetWebsiteDataStoreParameters(WebProcessDataStoreParameters&& parameters)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to