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 support for JS-backed WritableStreams in JSRPC #2066

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Apr 26, 2024

First pass at implementing support for JS-backed WritableStreams with JSRPC.

Provides an alternative adapter that will acquire the isolate lock on each write/close call, passing the operation off to the JS interface. This is obviously not as efficient as the original adapter used for WritableStreamSink but not yet sure if there's a better approach.

@jasnell jasnell requested a review from kentonv April 26, 2024 22:07
@jasnell jasnell added the api label Apr 26, 2024
src/workerd/api/streams/writable.c++ Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Show resolved Hide resolved
jasnell added a commit that referenced this pull request May 1, 2024
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/support-js-writablestream-jsrpc branch 2 times, most recently from 58cbfec to ad36a3d Compare May 3, 2024 21:31
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
@jasnell jasnell force-pushed the jsnell/support-js-writablestream-jsrpc branch from ad36a3d to 5c6a775 Compare May 6, 2024 17:36
@jasnell jasnell marked this pull request as ready for review May 6, 2024 18:04
@jasnell jasnell requested review from a team as code owners May 6, 2024 18:04
@jasnell jasnell requested review from dom96 and a-robinson May 6, 2024 18:04
@jasnell
Copy link
Member Author

jasnell commented May 6, 2024

@kentonv ...this should be ready for review!

@jasnell jasnell added the jsrpc label May 21, 2024
Copy link
Member

@kentonv kentonv left a comment

Choose a reason for hiding this comment

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

Sorry for slow review, this slipped past my inbox somehow.

src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
src/workerd/api/streams/writable.c++ Outdated Show resolved Hide resolved
@jasnell jasnell force-pushed the jsnell/support-js-writablestream-jsrpc branch 2 times, most recently from 9a34e23 to 4a8a2bb Compare May 23, 2024 19:47
@jasnell jasnell force-pushed the jsnell/support-js-writablestream-jsrpc branch from 4a8a2bb to 3c989ac Compare May 23, 2024 19:49
@jasnell jasnell requested a review from kentonv May 23, 2024 19:50
@kentonv
Copy link
Member

kentonv commented May 24, 2024

Reminder that GitHub loses information about force-pushes when you do two in a row which makes it hard to incrementally review. I think I've figured out that this diff represents the changes since I last reviewed, but in the future can you please post a list of fixup commits? The fixup.sh script in the internal repo generates such a list automatically if you use it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants