| 1336 | asyncWriteWritable(bufferID, *readable, *transform); |
| 1337 | } |
| 1338 | |
| 1339 | Result AsyncPipeline::chainTransforms(AsyncReadableStream*& readable) |
| 1340 | { |
| 1341 | for (size_t idx = 0; idx < MaxTransforms; ++idx) |
| 1342 | { |
| 1343 | AsyncDuplexStream* transform = transforms[idx]; |
| 1344 | if (transform == nullptr) |
| 1345 | { |
| 1346 | break; |
| 1347 | } |
| 1348 | transformInputs[idx] = readable; |
| 1349 | bool res; |
| 1350 | res = listenToEventData(*readable, *transform, true); |
| 1351 | SC_TRY_MSG(res, "AsyncPipeline::chainTransforms run out of eventData"); |
| 1352 | AsyncWritableStream& writable = *transform; |
| 1353 | res = readable->eventClose.addListener<AsyncWritableStream, &AsyncWritableStream::end>(writable); |
| 1354 | SC_TRY_MSG(res, "AsyncPipeline::chainTransforms run out of eventClose"); |
| 1355 | res = readable->eventError.addListener<AsyncPipeline, &AsyncPipeline::emitError>(*this); |
| 1356 | SC_TRY_MSG(res, "AsyncPipeline::chainTransforms run out of eventError"); |
| 1357 | |
| 1358 | readable = transform; |
| 1359 | |
| 1360 | res = transform->AsyncReadableStream::eventError.addListener<AsyncPipeline, &AsyncPipeline::emitError>(*this); |
| 1361 | SC_TRY_MSG(res, "AsyncPipeline::chainTransforms run out of eventError"); |
| 1362 | |
| 1363 | res = transform->AsyncWritableStream::eventError.addListener<AsyncPipeline, &AsyncPipeline::emitError>(*this); |
| 1364 | SC_TRY_MSG(res, "AsyncPipeline::chainTransforms run out of eventError"); |
| 1365 | } |
| 1366 | return Result(true); |
| 1367 | } |
| 1368 | |
| 1369 | void AsyncPipeline::asyncWriteWritable(AsyncBufferView::ID bufferID, AsyncReadableStream& readable, |