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

Use ResetQueue in WritableStreamDefaultControllerProcessWrite #704

Closed
wants to merge 2 commits into from

Conversation

ricea
Copy link
Collaborator

@ricea ricea commented Mar 24, 2017

WritableStreamDefaultControllerProcessWrite contained the line "If wasErrored is
false, set controller.[[queue]] to an empty List."

Generally it is better to use ResetQueue() to keep the [[queue]] and
[[queueTotalSize]] slots in sink. Do that instead.

WritableStreamDefaultControllerProcessWrite contained the line "If wasErrored is
false, set controller.[[queue]] to an empty List."

Generally it is better to use ResetQueue() to keep the [[queue]] and
[[queueTotalSize]] slots in sink. Do that instead.
@ricea
Copy link
Collaborator Author

ricea commented Mar 24, 2017

I'm only 90% sure this is right, so please review carefully.

@domenic domenic closed this in be4dd38 Mar 27, 2017
domenic added a commit that referenced this pull request Mar 27, 2017
The main motivation for this change is to centralize the erroring of a writable stream into a single abstract operation, WritableStreamError(), which takes care of all the relevant operations together, instead of sprinkling them through separate state transitions. This closes #704 by subsuming it; now ResetQueue() is always called when erroring the stream, no matter the code path.

The effort to do this revealed a semantic mismatch wherein we deciding abort()ing during an in-flight close should error the stream, but the abort should suceed. This was not a good decision, in retrospect; it makes this particular instance of erroring the stream very unusual. And we recognized that it was weird, because we made abort() return a fulfilled promise. Instead we should treat this as a success and close the stream, reflected in both the return value of abort() and in the stream's state.

This also introduces internal methods to writable stream controllers, paralleling the structure already in place for readable stream controllers. These methods were already there, disguised as abstract operations; since this change introduces a third such hook, it was time to properly pull them out as internal methods.
@tyoshino
Copy link
Member

lgtm

@ricea ricea deleted the writable-stream-use-reset-queue branch August 22, 2017 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants