Previously, we added a `reader.closed()` promise reaction during every
`ReadableStreamPipeTo::process()` call, which meant allocating a new
reaction objects for every processed chunk and retaining all of them
until the stream closed. The same issue existed for `writer.closed()`
inside `ReadableStreamPipeTo::read_chunk()`.
This change registers a single shutdown handler for both the reader and
the writer in the ReadableStreamPipeTo constructor.
ReadableStreamPipeTo is used in fetching, and previously requests with
large bodies could lead to tens of thousands of pending write promises
being accumulated in `m_pending_writes`.
With this change, instead of accumulating all pending write promises up
until pipe shutdown, we only keep track of the last one and use it to
determine whether there are pending writes when we need to shut down the
pipe.
The main streams AO file has gotten very large, and is a bit difficult
to navigate. In an effort to improve DX, this migrates WritableStream
AOs to their own file.
The main streams AO file has gotten very large, and is a bit difficult
to navigate. In an effort to improve DX, this migrates ReadableStream
AOs to their own file. And the helper classes used for the tee and pipe-
to operations are also in their own files.