refactor(core): Turn the wasm_streaming_feed
binding into ops
#11985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Async WebAssembly compilation was implemented in #11200 by adding two bindings:
set_wasm_streaming_callback
, which registered a callback to be called whenever a streaming wasm compilation was started, andwasm_streaming_feed
, which let the JS callback modify the state of the v8 wasm compiler.set_wasm_streaming_callback
cannot currently be implemented as anything other than a binding, butwasm_streaming_feed
does not really need to use anything specific to bindings, and could indeed be implemented as one or more ops. This PR does that, resulting in a simplification of the relevant code.There are three operations on the state of the v8 wasm compiler that
wasm_streaming_feed
allowed: feeding new bytes into the compiler, letting it know that there are no more bytes coming from the network, and aborting the compilation. This PR providesop_wasm_streaming_feed
to feed new bytes into the compiler, andop_wasm_streaming_abort
to abort the compilation. It doesn't provide an op to let v8 know that the response is finished, but closing the resource withDeno.core.close()
will achieve that.