Right now, informing the EDK of process launch means generating a GUID to identify the potential new process, and eventually notifying the EDK of launch success or failure. The latter event is required to finalize some internal state, and if not done can lead to leaks.
This is generally unsafe because it's easy to get wrong, as evidenced by all the times people have gotten it wrong.
We should replace the dumb child token string with a scoped object and improve the EDK API accordingly.
Comment 1 by roc...@chromium.org
, Jan 19 2017API might look something like // mojo::edk:: class ScopedChildProcessRegistration { public: ScopedChildProcessRegistration() // generates a GUID internally ~ScopedChildProcessRegistration() // invokes OnLaunchFailed if necessary // replaces ChildProcessLaunched() void OnLaunched(ProcessHandle); // replaces ChildProcessLaunchFailed void OnLaunchFailed(); // Replaces CreateParentMessagePipe ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token); }; // Must be called before parent pipes can be created ScopedChildProcessRegistration PrepareToLaunchChildProcess(); CreateChildMessagePipe can continue to work as-is.