[webkit-help] Understanding WebKit's XPC Architecture

Kenny Carruthers kennycarruthers at gmail.com
Mon Jun 25 05:21:14 PDT 2018


Hello,

I'm attempting to better understand WebKit's XPC architecture. Each tab has its own XPC service that is named after the domain of the currently loaded page. The XPC service appears to get killed and a new XPC service is launched when the domain changes. How is WebKit able to launch multiple XPC sessions in such a fashion? 

I've noticed the following: 

- xpc_connection_kill() is defined in XPCSPI.h and used in a few areas related to process launching. This method is not documented in the XPC man pages, but using it in a test application produces the result one would expect. This was discussed in https://trac.webkit.org/changeset/168585/webkit

- The key "_MultipleInstances" is defined in various Info.plists under the XPCService section. The leading underscore suggests this is a private flag. Defining that key in a test macOS application is not enough to get the test application to launch multiple instances of the XPC service, at least when the XPC connection is created with xpc_connection_create().

What other flags or APIs does WebKit make use of that allows it to launch a new XPC service for each tab (and give it a unique name)? This is of personal interest to me and not for use in any sandboxed application or any application destined for the macOS or iOS App Stores. 

Thank you,
Kenny


More information about the webkit-help mailing list