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

Consider moving stuff into ReadableStreamController #364

Closed
domenic opened this issue Jun 16, 2015 · 5 comments
Closed

Consider moving stuff into ReadableStreamController #364

domenic opened this issue Jun 16, 2015 · 5 comments
Assignees

Comments

@domenic
Copy link
Member

domenic commented Jun 16, 2015

See #361 (comment) where @tyoshino does this for ReadableByteStream and it seems to work out well.

@domenic
Copy link
Member Author

domenic commented Oct 14, 2015

I started working on this in the refactor innards branch. However, I got stuck, as there were a few state variables that I wasn't sure where they should go (reader, controller, or stream):

  • disturbed is a property of the stream but is modified by stream.cancel(), reader.cancel(), and reader.read()
  • state is used for some checks inside the stream, and it seems good to enforce those checks no matter what the controller implementation is. But it is mostly modified and consulted by the controller, sometimes by the reader too.
  • storedError is similar to state.

In the end these are not insurmountable problems. We would just need to define some kind of contract for all of the shared properties, e.g. "ReadableStreamController can be implemented in any way as long as it has state and storedError slots" or "ReadableStreamController can have a pointer back to its owner readable stream in order to modify its state and storedError slots." But it was not as straightforward as I'd hoped so I'm probably going to set this aside for a bit longer.

@tyoshino
Copy link
Member

I was taking some of the abstract operations as representation of the contracts. For example, [[state]] is altered only via ErrorReadableStream and FinishClosingReadableStream. These operations would form an internal interface.

[[disturbed]] should stay in ReadableStream, I agree.

Ah, I didn't mean moving such a lot from Stream to Controller. I thought queuing details would fit int Controller and moved them. state, etc. should fit in Stream, I think.

@tyoshino
Copy link
Member

tyoshino commented Dec 8, 2015

I'll take over https://github.com/whatwg/streams/tree/refactor-innards to do what we know we can for now.

@tyoshino
Copy link
Member

Created: #418

tyoshino added a commit that referenced this issue Dec 17, 2015
This includes ReadableByteStreamController's close() method, and all abstract opreations it depends on (transitively). This is a start at speccing out ReadableByteStream, using the new controller-centric design discussed in #364, #379, and #418.
@tyoshino
Copy link
Member

#379 is updated to point #418. Closing this issue as it has taken over this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants