• Reilly Grant's avatar
    [serial] Make SerialPortClient interface non-associated · 8870d1be
    Reilly Grant authored
    The SerialPort.Open method originally took a SerialPortClient as an
    associated interface. This ensures the ordering of responses to
    SerialPort methods is synchronized with events on the SerialPortClient
    interface.
    
    This prevents SerialPort.Open from being used from the Mojo JS bindings
    because they do not support associated interfaces. Web tests for the
    Serial API implementation in Blink would like to use these bindings.
    
    Upon deeper investigation the only method for which ordering really
    matters is SerialPort.Open itself. This is because serial data is sent
    using a pair of data pipes and those do not have any ordering guarantee
    with either the SerialPort or SerialPortClient pipes.
    
    To avoid messages on the now-unassociated SerialPortClient interface
    from racing ahead of the reply to the SerialPort.Open method the
    SerialConnection class is modified to only create its client binding
    and start watchers on the data pipes after the reply to the Open method
    is received.
    
    Bug: 893334
    Change-Id: I511060d45c5d537af1edddaeccd0436e34c0b0f0
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1660603Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
    Commit-Queue: Reilly Grant <reillyg@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#669578}
    8870d1be
serial_connection.cc 23 KB