Changeset 252083 in webkit


Ignore:
Timestamp:
Nov 5, 2019 2:22:17 PM (4 years ago)
Author:
pvollan@apple.com
Message:

Eliminate mach lookup to cfprefsd on process startup
https://bugs.webkit.org/show_bug.cgi?id=202866

Reviewed by Geoffrey Garen.

Currently, the WebContent and Networking process is calling CFBundleGetValueForInfoDictionaryKey on startup
to get the entry point function name into the WebKit bundle. This causes a mach lookup to cfprefsd which
should be avoided. Instead, we can send the service name as part of the bootstrap message when the UI process
is starting the process, and have the new process read this value from the message on startup to determine
the name of the entry point. This is possibly also an improvement in launch time, since we avoid reading a
value from Info.plist.

  • NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist:
  • NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist:
  • PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist:
  • Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:

(WebKit::XPCServiceEventHandler):

  • UIProcess/Launcher/mac/ProcessLauncherMac.mm:

(WebKit::ProcessLauncher::launchProcess):

  • WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist:
  • WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist:
Location:
trunk/Source/WebKit
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r252081 r252083  
     12019-11-05  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Eliminate mach lookup to cfprefsd on process startup
     4        https://bugs.webkit.org/show_bug.cgi?id=202866
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Currently, the WebContent and Networking process is calling CFBundleGetValueForInfoDictionaryKey on startup
     9        to get the entry point function name into the WebKit bundle. This causes a mach lookup to cfprefsd which
     10        should be avoided. Instead, we can send the service name as part of the bootstrap message when the UI process
     11        is starting the process, and have the new process read this value from the message on startup to determine
     12        the name of the entry point. This is possibly also an improvement in launch time, since we avoid reading a
     13        value from Info.plist.
     14
     15        * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist:
     16        * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist:
     17        * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist:
     18        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
     19        (WebKit::XPCServiceEventHandler):
     20        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
     21        (WebKit::ProcessLauncher::launchProcess):
     22        * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist:
     23        * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist:
     24
    1252019-11-05  Per Arne Vollan  <pvollan@apple.com>
    226
  • trunk/Source/WebKit/NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist

    r239568 r252083  
    2727        <key>NSPrincipalClass</key>
    2828        <string>NSApplication</string>
    29         <key>WebKitEntryPoint</key>
    30         <string>NetworkServiceInitializer</string>
    3129        <key>LSUIElement</key>
    3230        <true/>
  • trunk/Source/WebKit/NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist

    r239568 r252083  
    2727        <key>NSPrincipalClass</key>
    2828        <string>NSApplication</string>
    29         <key>WebKitEntryPoint</key>
    30         <string>NetworkServiceInitializer</string>
    3129        <key>LSUIElement</key>
    3230        <true/>
  • trunk/Source/WebKit/NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm

    r248862 r252083  
    5151using namespace WebKit;
    5252
    53 extern "C" WK_EXPORT void NetworkServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage);
     53extern "C" WK_EXPORT void NETWORK_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage);
    5454
    55 void NetworkServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
     55void NETWORK_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
    5656{
    5757    WTF::initializeMainThread();
  • trunk/Source/WebKit/PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist

    r239841 r252083  
    2727        <key>NSPrincipalClass</key>
    2828        <string>NSApplication</string>
    29         <key>WebKitEntryPoint</key>
    30         <string>PluginServiceInitializer</string>
    3129        <key>LSUIElement</key>
    3230        <true/>
  • trunk/Source/WebKit/PluginProcess/EntryPoint/Cocoa/XPCService/PluginServiceEntryPoint.mm

    r248862 r252083  
    7070#endif // ENABLE(NETSCAPE_PLUGIN_API)
    7171
    72 extern "C" WK_EXPORT void PluginServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage);
     72extern "C" WK_EXPORT void PLUGIN_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage);
    7373
    74 void PluginServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
     74void PLUGIN_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
    7575{
    7676#if ENABLE(NETSCAPE_PLUGIN_API)
  • trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h

    r249808 r252083  
    3939#endif
    4040#endif
     41
     42#define WEBCONTENT_SERVICE_INITIALIZER WebContentServiceInitializer
     43#define NETWORK_SERVICE_INITIALIZER NetworkServiceInitializer
     44#define PLUGIN_SERVICE_INITIALIZER PluginServiceInitializer
    4145
    4246namespace WebKit {
  • trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm

    r248862 r252083  
    5656            if (!strcmp(xpc_dictionary_get_string(event, "message-name"), "bootstrap")) {
    5757                CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit"));
    58                 CFStringRef entryPointFunctionName = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("WebKitEntryPoint"));
    5958
     59                const char* serviceName = xpc_dictionary_get_string(event, "service-name");
     60                CFStringRef entryPointFunctionName = nullptr;
     61                if (!strcmp(serviceName, "com.apple.WebKit.WebContent") || !strcmp(serviceName, "com.apple.WebKit.WebContent.Development"))
     62                    entryPointFunctionName = CFSTR(STRINGIZE_VALUE_OF(WEBCONTENT_SERVICE_INITIALIZER));
     63                else if (!strcmp(serviceName, "com.apple.WebKit.Networking"))
     64                    entryPointFunctionName = CFSTR(STRINGIZE_VALUE_OF(NETWORK_SERVICE_INITIALIZER));
     65                else if (!strcmp(serviceName, "com.apple.WebKit.Plugin.64"))
     66                    entryPointFunctionName = CFSTR(STRINGIZE_VALUE_OF(PLUGIN_SERVICE_INITIALIZER));
     67                else
     68                    RELEASE_ASSERT_NOT_REACHED();
     69
     70               
    6071                typedef void (*InitializerFunction)(xpc_connection_t, xpc_object_t, xpc_object_t);
    6172                InitializerFunction initializerFunctionPtr = reinterpret_cast<InitializerFunction>(CFBundleGetFunctionPointerForName(webKitBundle, entryPointFunctionName));
  • trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm

    r250186 r252083  
    190190    xpc_dictionary_set_string(bootstrapMessage.get(), "process-identifier", String::number(m_launchOptions.processIdentifier.toUInt64()).utf8().data());
    191191    xpc_dictionary_set_string(bootstrapMessage.get(), "ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String]);
     192    xpc_dictionary_set_string(bootstrapMessage.get(), "service-name", name);
    192193
    193194    bool isWebKitDevelopmentBuild = ![[[[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] bundlePath] stringByDeletingLastPathComponent] hasPrefix:systemDirectoryPath()];
  • trunk/Source/WebKit/WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist

    r239568 r252083  
    2929        <key>NSPrincipalClass</key>
    3030        <string>NSApplication</string>
    31         <key>WebKitEntryPoint</key>
    32         <string>WebContentServiceInitializer</string>
    3331        <key>LSUIElement</key>
    3432        <true/>
  • trunk/Source/WebKit/WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist

    r239568 r252083  
    2727        <key>LSFileQuarantineEnabled</key>
    2828        <true/>
    29         <key>WebKitEntryPoint</key>
    30         <string>WebContentServiceInitializer</string>
    3129        <key>XPCService</key>
    3230        <dict>
  • trunk/Source/WebKit/WebProcess/EntryPoint/Cocoa/XPCService/WebContentServiceEntryPoint.mm

    r248862 r252083  
    3636#endif
    3737
    38 extern "C" WK_EXPORT void WebContentServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage);
     38extern "C" WK_EXPORT void WEBCONTENT_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage);
    3939
    40 void WebContentServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
     40void WEBCONTENT_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
    4141{
    4242    WTF::initializeMainThread();
Note: See TracChangeset for help on using the changeset viewer.