Refactor mojo::Channel to support record-oriented implementations.

mojo::Channel is geared towards implementations that use stream-based
communication, so it provides an underlying buffer into which bytes can
be read, and then a way to notify it that a read is complete.

With an upcoming ChannelMac implementation, the underlying communication
primitive is record-oriented instead of stream-oriented, which makes
using Channel's buffer implementation difficult. This change makes
the buffer management optional, and it provides a new method to parse
and dispatch messages with an un-owned span of a buffer.

Bug: 932175
Change-Id: Ie02412d3cd5c2a2cf21151ac8e0fc5dd4b6d32c7
Commit-Queue: Robert Sesek <>
Reviewed-by: Ken Rockot <>
Cr-Commit-Position: refs/heads/master@{#639676}
2 files changed