This introduces a new kind of asynchronous flushing API for Mojo
endpoints, allowing independent pipes to synchronize against each
others' message queue.
Remote and Receiver both introduce |FlushAsync()| methods for
initiating a flush of their peer's message queue. Such operations
are tied to a corresponding PendingFlush object which can be used
to remotely observe completion of the async flush.
Remote also introduces |PauseReceiverUntilFlushCompletes()| to pause
its receiver's message queue until a given PendingFlush observes
completion. Receiver introduces an analogous
|PauseRemoteCallbacksUntilFlushCompletes()| method for essentially
the same purpose, in the reverse direction.
Combined, these APIs allow arbitrary pipes to synchronize
against each other even across a process boundary. This
synchronization mechanism can be used in cases where associated
interfaces are impossible to use and may eventually serve as a
complete replacement for associated interfaces.
Bug: 1040226
Change-Id: I3f8aaa39dc0e25b2c2d460cd7be1dbc4a2c0b11d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1968240
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Darin Fisher <darin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730829}