Files
node/lib
Matteo Collina b113d09c71 stream: create write request objects lazily
Every stream write created a WriteWrap JS object up front, even though
most writes complete synchronously via uv_try_write() and never use it.

Let stream_base_commons pass null instead of a request object.
StreamBase::Write() already creates the wrap object only when the write
does not complete synchronously; return that object to JS (which
attaches oncomplete/callback to it) and a plain error code otherwise.

Writes that complete synchronously now cross the JS/C++ boundary once
and allocate nothing. Callers that pass in a request object
(child_process IPC, webstreams adapters) behave as before.

Since Http2Stream::DoWrite() can invoke the completion callback
synchronously - before JS has attached oncomplete - such completions
are now recorded on the request object's writeStatus field and replayed
by stream_base_commons after dispatch. This also replaces a Has() plus
name-based MakeCallback() pair with a single Get().

Also pre-create the JS fields of WriteWrap instances in the object
template, as was already done for ShutdownWrap, so that they are
in-object properties.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/64455
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2026-09-07 14:49:11 +00:00
..
2026-09-03 15:37:21 +00:00
…
…
…
…
…
…
…
…
2026-09-05 02:49:02 +00:00
2026-08-29 00:58:18 +02:00
…
…
2026-09-03 11:40:52 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2026-09-07 11:42:09 +00:00
2026-09-03 11:48:46 +02:00
2026-09-02 07:27:11 +00:00
…
…
…