Skip to content

Replace raw ReadableStream& ref with jsg::WeakRef - #6936

Open
jasnell wants to merge 1 commit into
mainfrom
jasnell/pipe-writer-kj-ptr
Open

Replace raw ReadableStream& ref with jsg::WeakRef#6936
jasnell wants to merge 1 commit into
mainfrom
jasnell/pipe-writer-kj-ptr

Conversation

@jasnell

@jasnell jasnell commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: James M Snell <jsnell@cloudflare.com>
@jasnell
jasnell requested review from a team as code owners August 7, 2026 23:18
@ask-bonk

ask-bonk Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The change is well-reasoned and correct. Let me verify one more thing -- the old code used addRef() on a raw ReadableStream& which would always succeed, while tryAddRef() on a WeakRef can return kj::none. The callers already store the result in kj::Maybe<jsg::Ref<ReadableStream>> and use the ref purely as an RAII keep-alive guard, so a kj::none result is handled gracefully.

LGTM

github run

@codspeed-hq

This comment was marked as low quality.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant