diff options
author | Marijn Kruisselbrink <mek@chromium.org> | 2017-07-07 14:11:48 +0900 |
---|---|---|
committer | Qijiang Fan <fqj@google.com> | 2020-06-05 06:36:21 +0900 |
commit | c1f020b31a8f4d4447e64402659aa83ffbfa6eea (patch) | |
tree | dbb10afc0a5013727ba2d68011546da9494eb32e /mojo/public/c | |
parent | b01a997e8f66993a804bd25dcafb7ca0712e61f6 (diff) | |
download | libchrome-c1f020b31a8f4d4447e64402659aa83ffbfa6eea.tar.gz |
Fix some issues around the two-phase DataPipe read API.
- The ALL_OR_NONE flag was never supported by the implementation, so make it
an error to pass it to BeginRead.
- It doesn't make sense to pass in how many bytes to read to
BeginReadData, so correctly document this as an out-only parameter.
- Update unit tests to no longer incorrectly attempt to use ALL_OR_NONE.
Change-Id: I23031d454bc157500664224d3658650ee77d7b22
Reviewed-on: https://chromium-review.googlesource.com/562518
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#484835}
CrOS-Libchrome-Original-Commit: 801d8de7fb0219622a9e653220a11a827ecbed8a
Diffstat (limited to 'mojo/public/c')
-rw-r--r-- | mojo/public/c/system/data_pipe.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/mojo/public/c/system/data_pipe.h b/mojo/public/c/system/data_pipe.h index f51e36cb2e..aaeafcf21e 100644 --- a/mojo/public/c/system/data_pipe.h +++ b/mojo/public/c/system/data_pipe.h @@ -78,10 +78,9 @@ const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_ALL_OR_NONE = 1 << 0; // // |MOJO_READ_DATA_FLAG_NONE| - No flags; default mode. // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| - Read (or discard) either the requested -// number of elements or none. NOTE: This flag is not currently supported -// by |MojoBeginReadData()|. +// number of elements or none. For use with |MojoReadData()| only. // |MOJO_READ_DATA_FLAG_DISCARD| - Discard (up to) the requested number of -// elements. +// elements. For use with |MojoReadData()| only. // |MOJO_READ_DATA_FLAG_QUERY| - Query the number of elements available to // read. For use with |MojoReadData()| only. Mutually exclusive with // |MOJO_READ_DATA_FLAG_DISCARD|, and |MOJO_READ_DATA_FLAG_ALL_OR_NONE| @@ -309,10 +308,10 @@ MOJO_SYSTEM_EXPORT MojoResult MojoReadData(MojoHandle data_pipe_consumer_handle, // |MOJO_RESULT_SHOULD_WAIT| if no data can currently be read (and the // producer is still open). MOJO_SYSTEM_EXPORT MojoResult - MojoBeginReadData(MojoHandle data_pipe_consumer_handle, - const void** buffer, // Out. - uint32_t* buffer_num_bytes, // In/out. - MojoReadDataFlags flags); +MojoBeginReadData(MojoHandle data_pipe_consumer_handle, + const void** buffer, // Out. + uint32_t* buffer_num_bytes, // Out. + MojoReadDataFlags flags); // Ends a two-phase read from the data pipe consumer given by // |data_pipe_consumer_handle| that was begun by a call to |MojoBeginReadData()| |