Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement teeing, plus a bunch of stage-setting tweaks #311

Merged
merged 7 commits into from
Apr 6, 2015
Merged

Commits on Apr 6, 2015

  1. Factor out a new CloseReadableStream abstract operation

    For the tee algorithm being drafted in #302, it's important to have an abstract operation CloseReadableStream that does all the things that ReadableStreamController.prototype.close does. So, we factor that out. The old CloseReadableStream is renamed to "FinishClosingReadableStream".
    domenic committed Apr 6, 2015
    Configuration menu
    Copy the full SHA
    fee2191 View commit details
    Browse the repository at this point in the history
  2. Factor out a new EnqueueInReadableStream abstract operation

    Similarly to the previous commit, we want this for defining the tee algorithm (and potentially others, e.g. from other specifications).
    domenic committed Apr 6, 2015
    Configuration menu
    Copy the full SHA
    90c0a9b View commit details
    Browse the repository at this point in the history
  3. Tidy up precondition checking in ErrorReadableStream

    Following the established pattern, public API methods should throw if preconditions are violated, whereas abstract operations should assert that they are not.
    domenic committed Apr 6, 2015
    Configuration menu
    Copy the full SHA
    4b362dd View commit details
    Browse the repository at this point in the history
  4. Add and update notes on using abstract ops from other specs

    In particular, https://github.com/yutakahirano/fetch-with-streams is an obvious client for all of the ones noted.
    domenic committed Apr 6, 2015
    Configuration menu
    Copy the full SHA
    62b8a68 View commit details
    Browse the repository at this point in the history
  5. Factor out ReadFromReadableStreamReader abstract operation

    Again, needed for formalizing the tee algorithm from #302.
    domenic committed Apr 6, 2015
    Configuration menu
    Copy the full SHA
    05674df View commit details
    Browse the repository at this point in the history
  6. Tweak spec mechanics of WritableStream Error Functions

    Instead of creating a closure in the constructor, storing it on the stream, and calling this@[[error]] all the time, we can instead abstract out an ErrorWritableStream(stream, e) abstract operation and call that when appropriate. Then, the WritableStream error functions just delegate to this abstract operation.
    
    The big upside of this is that, if the error function ends up not being used by the underlying sink (e.g. the underlying sink relies on returning rejected promises instead), we can immediately garbage-collect it, instead of carrying it around for the lifetime of the stream.
    
    While doing so, make the editorial move to ES-spec-style closures, with internal slots, instead of using the "closing over" technique. It turns out that when you try to extend the "closing over" language to more complicated situations (as we will do for teeing), it falls over, becoming very confusing. The ES-spec version of closures is obtuse, but works.
    
    Finally, we now put the definitions of closures underneath the place that creates them (in this case the constructor), instead of creating a whole new CreateWritableStreamErrorFunction abstract operation, defined some distance from the relevant function. This will serve us well for tee and pipe.
    domenic committed Apr 6, 2015
    Configuration menu
    Copy the full SHA
    cde727e View commit details
    Browse the repository at this point in the history
  7. Implement readable stream teeing

    Closes #271; supercedes #302.
    
    Includes an abstract operation, TeeReadableStream(stream, shouldClone) which is meant for use by other specs, plus a method ReadableStream.prototype.tee() (which does no cloning).
    domenic committed Apr 6, 2015
    Configuration menu
    Copy the full SHA
    3ed32a5 View commit details
    Browse the repository at this point in the history