Skip to content

Commit

Permalink
Second pass at async read design
Browse files Browse the repository at this point in the history
Based on discussions in #253. The key differences here from the previous async read() commits are:

- ReadableStreams no longer have read() methods directly; those only exist on readers. This drastically simplifies the stream/reader interaction, and also allows the possibility of different types of readers which have different reading behavior.
- read() promises fulfill with { value, done } instead of using an EOS sentinel value. This avoids a number of problems, and also provides a mechanism by which readable byte streams can smuggle out "unused" buffers given to them (using { value: zeroLengthViewOntoBuffer, done: true }).

Another new semantic worth mentioning is that you cannot release a reader if the reader has read()s pending; doing so will throw. This slightly complicates the pipe algorithm in the { preventCancel: true } case.

This commit also adds some new infrastructure for _templated tests_, and ports some portion of the existing tests there. This is our solution for #217 and #264.

Finally, we re-merge all related code into a single readable-stream.js file, as the setup with the three separate files (readable-stream.js, exclusive-stream-reader.js, and readable-stream-abstract-ops.js) was problematic in causing circular dependencies.
  • Loading branch information
domenic committed Mar 12, 2015
1 parent 35c3e5b commit 1a5c51b
Show file tree
Hide file tree
Showing 25 changed files with 1,861 additions and 1,168 deletions.
233 changes: 0 additions & 233 deletions reference-implementation/lib/readable-stream-abstract-ops.js

This file was deleted.

Loading

0 comments on commit 1a5c51b

Please sign in to comment.