File tree 4 files changed +17
-4
lines changed
4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1838,7 +1838,7 @@ void WritableStreamInternalController::visitForGc(jsg::GcVisitor& visitor) {
1838
1838
for (auto & event : queue) {
1839
1839
KJ_SWITCH_ONEOF (event.event ) {
1840
1840
KJ_CASE_ONEOF (write , Write) {
1841
- visitor.visit (write .promise , write . ref );
1841
+ visitor.visit (write .promise );
1842
1842
}
1843
1843
KJ_CASE_ONEOF (close , Close) {
1844
1844
visitor.visit (close .promise );
Original file line number Diff line number Diff line change @@ -283,7 +283,6 @@ class WritableStreamInternalController: public WritableStreamController {
283
283
kj::Maybe<jsg::Promise<void >::Resolver> promise;
284
284
std::shared_ptr<v8::BackingStore> ownBytes;
285
285
kj::ArrayPtr<const kj::byte> bytes;
286
- kj::Maybe<jsg::Ref<WritableStream>> ref;
287
286
};
288
287
struct Close {
289
288
kj::Maybe<jsg::Promise<void >::Resolver> promise;
Original file line number Diff line number Diff line change @@ -155,7 +155,14 @@ void ReaderImpl::releaseLock(jsg::Lock& js) {
155
155
}
156
156
157
157
void ReaderImpl::visitForGc (jsg::GcVisitor& visitor) {
158
- visitor.visit (closedPromise);
158
+ KJ_IF_SOME (readable, state.tryGet <Attached>()) {
159
+ visitor.visit (readable);
160
+ } else {
161
+ // If the reader is attached, then visiting the readable should visit the
162
+ // closedPromise via visiting the associated resolver.
163
+ // Otherwise, we need to visit it directly if they are set.
164
+ visitor.visit (closedPromise);
165
+ }
159
166
}
160
167
161
168
// ======================================================================================
Original file line number Diff line number Diff line change @@ -197,7 +197,14 @@ bool WritableStream::inspectExpectsBytes() {
197
197
}
198
198
199
199
void WritableStreamDefaultWriter::visitForGc (jsg::GcVisitor& visitor) {
200
- visitor.visit (closedPromise, readyPromise);
200
+ KJ_IF_SOME (writable, state.tryGet <Attached>()) {
201
+ visitor.visit (writable);
202
+ } else {
203
+ // If the writer is attached, then visiting the writable should visit the
204
+ // closedPromise and readyPromise via visiting their associated resolvers.
205
+ // Otherwise, we need to visit those directly if they are set.
206
+ visitor.visit (closedPromise, readyPromise);
207
+ }
201
208
}
202
209
203
210
// ======================================================================================
You can’t perform that action at this time.
0 commit comments