File tree Expand file tree Collapse file tree 2 files changed +26
-26
lines changed Expand file tree Collapse file tree 2 files changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -1338,32 +1338,6 @@ DataQueueFeeder::DataQueueFeeder(Environment* env, Local<Object> object)
13381338 MakeWeak ();
13391339}
13401340
1341- void DataQueueFeeder::tryWakePulls () {
1342- if (!readFinish_.IsEmpty ()) {
1343- Local<Promise::Resolver> resolver = readFinish_.Get (env ()->isolate ());
1344- // I do not think, that this can error...
1345- (void )resolver->Resolve (env ()->context (), v8::True (env ()->isolate ()));
1346- readFinish_.Reset ();
1347- }
1348- }
1349-
1350- void DataQueueFeeder::DrainAndClose () {
1351- if (done) return ;
1352- done = true ;
1353- // do not do this several time, and note,
1354- // it may be called several times.
1355- while (!pendingPulls_.empty ()) {
1356- auto & pending = pendingPulls_.front ();
1357- auto pop = OnScopeLeave ([this ] { pendingPulls_.pop_front (); });
1358- pending.next (bob::STATUS_EOS, nullptr , 0 , [](uint64_t ) {});
1359- }
1360- if (!readFinish_.IsEmpty ()) {
1361- Local<Promise::Resolver> resolver = readFinish_.Get (env ()->isolate ());
1362- (void )resolver->Resolve (env ()->context (), v8::False (env ()->isolate ()));
1363- readFinish_.Reset ();
1364- }
1365- }
1366-
13671341JS_METHOD_IMPL (DataQueueFeeder::New) {
13681342 DCHECK (args.IsConstructCall ());
13691343 auto env = Environment::GetCurrent (args);
Original file line number Diff line number Diff line change @@ -436,6 +436,32 @@ class DataQueueFeeder final : public AsyncWrap {
436436 bool done = false ;
437437};
438438
439+ void DataQueueFeeder::tryWakePulls () {
440+ if (!readFinish_.IsEmpty ()) {
441+ Local<Promise::Resolver> resolver = readFinish_.Get (env ()->isolate ());
442+ // I do not think, that this can error...
443+ (void )resolver->Resolve (env ()->context (), v8::True (env ()->isolate ()));
444+ readFinish_.Reset ();
445+ }
446+ }
447+
448+ void DataQueueFeeder::DrainAndClose () {
449+ if (done) return ;
450+ done = true ;
451+ // do not do this several time, and note,
452+ // it may be called several times.
453+ while (!pendingPulls_.empty ()) {
454+ auto & pending = pendingPulls_.front ();
455+ auto pop = OnScopeLeave ([this ] { pendingPulls_.pop_front (); });
456+ pending.next (bob::STATUS_EOS, nullptr , 0 , [](uint64_t ) {});
457+ }
458+ if (!readFinish_.IsEmpty ()) {
459+ Local<Promise::Resolver> resolver = readFinish_.Get (env ()->isolate ());
460+ (void )resolver->Resolve (env ()->context (), v8::False (env ()->isolate ()));
461+ readFinish_.Reset ();
462+ }
463+ }
464+
439465} // namespace node
440466
441467#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
You can’t perform that action at this time.
0 commit comments