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

Deprecate WritableStream::removeSink #2064

Merged
merged 1 commit into from
May 2, 2024
Merged

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Apr 26, 2024

removeSink is used to extract the WritableStreamSink that is owned by a WritableStream using the original implementation. It is currently used in only three places in the codebase, two of which are unnecessary. There are two pending changes refactoring those two places to avoid using removeSink() as currently defined. Replacing the version of removeSink that returns the WritableStreamSink with a detach() method that returns nothing covers the sockets use case where we call the method then immediately throw away the sink.

Opening this to broadcast the intent in case folks have reason to keep removeSink around.

Once this and the two other PRs land, we hopefully move towards removing removeSink entirely. Note that ultimately the goal is to entirely eliminate the need for (and remove entirely) the WritableStreamInternalController as a separate implementation, making it such that all WritableStream use cases can be served by the WritableStreamJsController implementation. This, however, raises an issue with the JSRPC implementation which uses removeSink() in the implementation of WritableStream::serialize(). JS-backed WritableStreams are currently not supported by JSRPC. We will need to address that limitation before being able to proceed here. FWIW, the use of removeSink() in JSRPC does not actually require the public method on WritableStream to work, so that's not a blocker.

Refs: #2061
Refs: #2050

@jasnell jasnell requested review from a team as code owners April 26, 2024 19:48
@jasnell jasnell requested review from dom96 and vickykont April 26, 2024 19:48
@jasnell jasnell force-pushed the jsnell/deprecate-removeSink branch from 9a44262 to cbba751 Compare April 26, 2024 20:03
@jasnell jasnell requested a review from kentonv April 26, 2024 20:11
@jasnell jasnell added the api label Apr 26, 2024
@kentonv
Copy link
Member

kentonv commented Apr 29, 2024

FWIW, the use of removeSink() in JSRPC does not actually require the public method on WritableStream to work, so that's not a blocker.

How so? It does call that method. With this PR, doesn't it now raise a warning?

@jasnell
Copy link
Member Author

jasnell commented Apr 29, 2024

The WritableStream::Serialize can use the internal version of removeSink() that is on WritableStreamController (which this PR deprecates currently deprecates but doesn't need to). It's really just the one on WritableStream that really ought to be gone.

removeSink is used to extract the WritableStreamSink that is owned by
a WritableStream using the original implementation. It is currently
used in only a few places in the codebase, none of which are necessary.
There are two pending changes refactoring those two places to avoid
using `removeSink()` as currently defined. Replacing the version of
`removeSink` that returns the `WritableStreamSink` with a `detach()`
method that returns nothing covers the sockets use case where we call
the method then immediately throw away the sink.

Once this and the other PRs land, we can safely remove removeSink
entirely.

Refs: #2061
Refs: #2050
Refs: #2066
@jasnell jasnell force-pushed the jsnell/deprecate-removeSink branch from cbba751 to 079aba1 Compare May 1, 2024 23:02
@jasnell jasnell merged commit 9b385aa into main May 2, 2024
10 checks passed
@jasnell jasnell deleted the jsnell/deprecate-removeSink branch May 2, 2024 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants