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

Have each of the stream and reader hold promises #277

Closed
wants to merge 11 commits into from

Conversation

tyoshino
Copy link
Member

@tyoshino tyoshino commented Feb 4, 2015

No description provided.

@@ -118,19 +182,11 @@ export function CreateReadableStreamEnqueueFunction(stream) {

export function CreateReadableStreamErrorFunction(stream) {
return e => {
if (stream._state === 'waiting') {
stream._resolveReadyPromise(undefined);
}
if (stream._state === 'readable') {
stream._queue = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to move this to ErrorReadableStream?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Moving everything to ErrorReadableStream.

BTW, I'm trying to have some border between the code that is specific to the ReadableStream subclass implementation and one that is common to ReadableStream and all of its subclasses. Do you have any ideas about that?

@domenic
Copy link
Member

domenic commented Feb 4, 2015

This looks really excellent. Thank you for taking the time. Much better than the mess I was getting myself in to.

I left a few minor comments but overall am very happy with this. Do you want to do the spec portion or shall I?

@tyoshino
Copy link
Member Author

tyoshino commented Feb 6, 2015

Done addressing Domenic's comments.

I also removed export from some functions in the -abstract-ops file which are not used by any other file. And, added some identity tests. May I copy the tests from your patch https://github.com/whatwg/streams/compare/cache-promises? I'm also fine if you could just commit them after mine.

spec portion

I'll do but may not be able to finish today. I'll push wip one then. Please take over it.

@tyoshino
Copy link
Member Author

tyoshino commented Feb 6, 2015

OK. Done updating the spec text. Ready for review.

@@ -11,17 +12,17 @@ export default class ExclusiveStreamReader {
throw new TypeError('This stream has already been locked for exclusive reading by another reader');
}

stream._readableStreamReader = this;
AttachExclusiveStreamReader(stream, this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to inline this? It seems to be only used in one place. Same with detach. I don't feel strongly though so if you think it's clearer we can keep it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it its own operation name for readability. But maybe just adding comments is fine. Reverted.

@domenic
Copy link
Member

domenic commented Feb 6, 2015

Mostly looks good. Just a few comments, and also need to rebase on master. And yeah feel free to pull the tests, no need to keep them in a separate commit.

@tyoshino tyoshino force-pushed the updateBothStreamAndReader branch from 0f05249 to 0220345 Compare February 9, 2015 09:01
@tyoshino
Copy link
Member Author

tyoshino commented Feb 9, 2015

OK. Addressed the comments and merged the tests. Please check diff between 1fbebb5 b488805 for change since your comments.

<li> Let <var>sourceCancelPromise</var> be PromiseInvokeOrNoop(<b>this</b>@\[[underlyingSource]],
<code>"cancel"</code>, (<var>reason</var>)).
<li> Return the result of transforming <var>sourceCancelPromise</var> by a fulfillment handler that returns <b>undefined</b>.
<li> Call-with-rethrow CancelReadableStream(<b>this</b>, <var>reason</var>).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Call-with-rethrow/return

@domenic
Copy link
Member

domenic commented Feb 9, 2015

Great! Fixed a few nits and merged as 9ec484b.

@domenic domenic closed this Feb 9, 2015
@tyoshino
Copy link
Member Author

Thanks for committing.

@tyoshino tyoshino deleted the updateBothStreamAndReader branch February 10, 2015 03:32
@tyoshino tyoshino mentioned this pull request Jan 5, 2016
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.

2 participants