• rockot's avatar
    Support early associated interface binding on ChannelMojo · 0e4de5f9
    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
    
    Committed: https://crrev.com/e1037f997da9e1d44ca3b09d4ff32f0465673091
    Committed: https://crrev.com/508da24622f957a01b076ccd058bfdccc79068a4
    Review-Url: https://codereview.chromium.org/2163633003
    Cr-Original-Original-Commit-Position: refs/heads/master@{#406720}
    Cr-Original-Commit-Position: refs/heads/master@{#407050}
    Cr-Commit-Position: refs/heads/master@{#407264}
    0e4de5f9
ipc_channel_mojo.cc 15.8 KB