Skip to content

Commit

Permalink
Fixup gc visitation in streams readers and writers
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Feb 1, 2024
1 parent 9353d44 commit 8ed21a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/workerd/api/streams/internal.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ void WritableStreamInternalController::visitForGc(jsg::GcVisitor& visitor) {
for (auto& event : queue) {
KJ_SWITCH_ONEOF(event.event) {
KJ_CASE_ONEOF(write, Write) {
visitor.visit(write.promise, write.ref);
visitor.visit(write.promise);
}
KJ_CASE_ONEOF(close, Close) {
visitor.visit(close.promise);
Expand Down
1 change: 0 additions & 1 deletion src/workerd/api/streams/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ class WritableStreamInternalController: public WritableStreamController {
kj::Maybe<jsg::Promise<void>::Resolver> promise;
std::shared_ptr<v8::BackingStore> ownBytes;
kj::ArrayPtr<const kj::byte> bytes;
kj::Maybe<jsg::Ref<WritableStream>> ref;
};
struct Close {
kj::Maybe<jsg::Promise<void>::Resolver> promise;
Expand Down
3 changes: 3 additions & 0 deletions src/workerd/api/streams/readable.c++
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ void ReaderImpl::releaseLock(jsg::Lock& js) {
}

void ReaderImpl::visitForGc(jsg::GcVisitor& visitor) {
KJ_IF_SOME(readable, state.tryGet<Attached>()) {
visitor.visit(readable);
}
visitor.visit(closedPromise);
}

Expand Down
3 changes: 3 additions & 0 deletions src/workerd/api/streams/writable.c++
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ bool WritableStream::inspectExpectsBytes() {
}

void WritableStreamDefaultWriter::visitForGc(jsg::GcVisitor& visitor) {
KJ_IF_SOME(writable, state.tryGet<Attached>()) {
visitor.visit(writable);
}
visitor.visit(closedPromise, readyPromise);
}

Expand Down

0 comments on commit 8ed21a8

Please sign in to comment.