DescriptionMojo JS bindings: draining a DataPipe
Add a drainData(dataPipeHandle) utility function to the Mojo JS core module.
The drainData() function asynchronously reads from the data pipe until the remote handle is closed or an error occurs. A Promise is returned whose settled value is an object like this: {result: core.RESULT_OK, buffer: dataArrayBuffer}. If the read failed, then the result will be the actual error code and the buffer will contain whatever was read before the error occurred. The drainData dataPipeHandle argument is closed automatically.
BUG=414338
Committed: https://crrev.com/5a5cb9e791961a2491c4269fc0f2144f385dc173
Cr-Commit-Position: refs/heads/master@{#296750}
Patch Set 1 #Patch Set 2 : Added async DataPipe reader to the demo content #Patch Set 3 : Flattened the promise chain in main.js #Patch Set 4 : Non-working C++ version of drainData() #Patch Set 5 : Added a HCTB CHECK in GetPromise() #Patch Set 6 : Enable v8 microtask execution #Patch Set 7 : Revised the way the TaskObserver is managed #
Total comments: 19
Patch Set 8 : Reduce data buffer copying, add some documentation #
Total comments: 6
Patch Set 9 : Whitespace fixes #Patch Set 10 : Use size_t for total data buffer size #Patch Set 11 : More size_t #
Messages
Total messages: 19 (7 generated)
|