MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / afterProcess

Method afterProcess

Libraries/AsyncStreams/AsyncStreams.cpp:956–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954 }
955}
956
957void AsyncTransformStream::afterProcess(Span<const char> inputAfter, Span<char> outputAfter)
958{
959 const size_t consumedOutput = outputData.sizeInBytes() - outputAfter.sizeInBytes();
960 if (consumedOutput > 0)
961 {
962 // Ignore whatever push returns because later on the stream is either finalizing or pausing either way
963 (void)AsyncReadableStream::push(outputBufferID, consumedOutput);
964 }
965 AsyncReadableStream::getBuffersPool().unrefBuffer(outputBufferID);
966 if (inputAfter.empty())
967 {
968 auto cb = move(inputCallback);
969 auto bufferID = inputBufferID;
970 inputCallback = {};
971 inputBufferID = {};
972 inputData = {};
973 outputBufferID = {};
974 outputData = {};
975 state = State::None;
976 AsyncWritableStream::finishedWriting(bufferID, move(cb), Result(true));
977 }
978 else
979 {
980 inputData = inputAfter;
981
982 state = State::Paused;
983 tryAsync(asyncWrite(inputBufferID, inputCallback));
984 }
985}
986
987void AsyncTransformStream::afterFinalize(Span<char> outputAfter, bool streamEnded)

Callers

nothing calls this directly

Calls 3

unrefBufferMethod · 0.80
ResultClass · 0.50
sizeInBytesMethod · 0.45

Tested by

no test coverage detected