For the main application it works fine already (in one direction by passing the process id as an argument, in the other by sending it in a message after starting). Now my problem is creating the connection between WebProcess and NetworkProcess.
What webkit tries to do is:
- main process creates both of these
- it sends a message to NetworkProcess, telling it to create a new connection channel
- networkprocess replies with an identifier for the channel (in our case this contains networkprocess pid)
- main process forwards this identifier to webprocess
In this scenario, NetworkProcess never gets to know the webprocess id so it cannot initiate the communication with it. I think the simplest way to handle this is to modify the message sent from the main Process to include the process id.
It used to be simpler to do this in older versions of webkit because more of the code was platform-specific, but now they have factorized some parts of it which means a little less flexibility (or modifying cross platform code as needed)