• rockot's avatar
    Support early associated interface binding on ChannelMojo · e1037f99
    rockot authored
    Changes the associated bindings implementation for ChannelMojo
    such that remote interfaces can be acquired immediately upon
    ChannelMojo construction rather than having to wait for connection
    on the IO thread.
    
    Simplifies the Channel bootstrapping process, removing a round-trip
    Init message (and in fact the entire IPC::mojom::Boostrap interface)
    since there's no need to actually exchange associated interface handles
    over the pipe. Instead both sides can assume the other will use a fixed,
    reserved endpoint ID for their IPC::mojom::Channel interface.
    
    This also removes the restriction that associated interfaces must be
    added to a Channel after Init. Instead the same constraints apply as
    with AddFilter: an associated interface, like a filter, may be added
    at any time as long as either Init hasn't been called OR the remote
    process hasn't been launched.
    
    The result of this CL is that any place it's safe to AddFilter,
    it's also safe to AddAssociatedInterface; and any place it's safe to
    Send, it's also safe to GetRemoteAssociatedInterface and begin using
    any such remote interface immediately.
    
    Remote interface requests as well as all messages to remote interfaces
    retain FIFO with respect to any Send calls on the same thread. Local
    interface request dispatch as well as all messages on locally bound
    associated interfaces retain FIFO with respect to any OnMessageReceived
    calls on the same thread.
    
    BUG=612500,619202
    
    Review-Url: https://codereview.chromium.org/2163633003
    Cr-Commit-Position: refs/heads/master@{#406720}
    e1037f99
ipc_channel_mojo.cc 15.8 KB