| 520 | } |
| 521 | |
| 522 | void AsyncReadableStream::destroy() |
| 523 | { |
| 524 | // Empty all queued buffers |
| 525 | Request request; |
| 526 | while (readQueue.popFront(request)) |
| 527 | { |
| 528 | buffers->unrefBuffer(request.bufferID); // 1b. refBuffer in push |
| 529 | } |
| 530 | switch (state) |
| 531 | { |
| 532 | case State::CanRead: |
| 533 | case State::SyncPushing: |
| 534 | case State::SyncReadMore: |
| 535 | case State::Paused: |
| 536 | case State::Pausing: |
| 537 | case State::Reading: |
| 538 | case State::AsyncPushing: |
| 539 | case State::AsyncReading: |
| 540 | case State::Stopped: |
| 541 | case State::Ended: { |
| 542 | state = State::Destroying; |
| 543 | Result res = asyncDestroyReadable(); |
| 544 | if (not res) |
| 545 | { |
| 546 | state = State::Errored; |
| 547 | eventError.emit(res); |
| 548 | } |
| 549 | break; |
| 550 | } |
| 551 | case State::Destroying: |
| 552 | case State::Errored: break; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | Result AsyncReadableStream::finishedDestroyingReadable() |
| 557 | { |
nothing calls this directly
no test coverage detected