v8  9.4.146 (node 16.13.0)
V8 is Google's open source JavaScript engine
WasmStreaming Class Referencefinal

#include <v8.h>

Data Structures

class  Client
 

Public Member Functions

 WasmStreaming (std::unique_ptr< WasmStreamingImpl > impl)
 
 ~WasmStreaming ()
 
void OnBytesReceived (const uint8_t *bytes, size_t size)
 
void Finish ()
 
void Abort (MaybeLocal< Value > exception)
 
bool SetCompiledModuleBytes (const uint8_t *bytes, size_t size)
 
void SetClient (std::shared_ptr< Client > client)
 
void SetUrl (const char *url, size_t length)
 

Static Public Member Functions

static std::shared_ptr< WasmStreamingUnpack (Isolate *isolate, Local< Value > value)
 

Detailed Description

The V8 interface for WebAssembly streaming compilation. When streaming compilation is initiated, V8 passes a {WasmStreaming} object to the embedder such that the embedder can pass the input bytes for streaming compilation to V8.

Definition at line 5150 of file v8.h.

Constructor & Destructor Documentation

◆ WasmStreaming()

WasmStreaming ( std::unique_ptr< WasmStreamingImpl >  impl)
explicit

◆ ~WasmStreaming()

Member Function Documentation

◆ Abort()

void Abort ( MaybeLocal< Value exception)

Abort streaming compilation. If {exception} has a value, then the promise associated with streaming compilation is rejected with that value. If {exception} does not have value, the promise does not get rejected.

◆ Finish()

void Finish ( )

{Finish} should be called after all received bytes where passed to {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish} does not have to be called after {Abort} has been called already.

◆ OnBytesReceived()

void OnBytesReceived ( const uint8_t *  bytes,
size_t  size 
)

Pass a new chunk of bytes to WebAssembly streaming compilation. The buffer passed into {OnBytesReceived} is owned by the caller.

◆ SetClient()

void SetClient ( std::shared_ptr< Client client)

Sets the client object that will receive streaming event notifications. This must be called before {OnBytesReceived}, {Finish}, or {Abort}.

◆ SetCompiledModuleBytes()

bool SetCompiledModuleBytes ( const uint8_t *  bytes,
size_t  size 
)

Passes previously compiled module bytes. This must be called before {OnBytesReceived}, {Finish}, or {Abort}. Returns true if the module bytes can be used, false otherwise. The buffer passed via {bytes} and {size} is owned by the caller. If {SetCompiledModuleBytes} returns true, the buffer must remain valid until either {Finish} or {Abort} completes.

◆ SetUrl()

void SetUrl ( const char *  url,
size_t  length 
)

◆ Unpack()

static std::shared_ptr<WasmStreaming> Unpack ( Isolate isolate,
Local< Value value 
)
static

Unpacks a {WasmStreaming} object wrapped in a {Managed} for the embedder. Since the embedder is on the other side of the API, it cannot unpack the {Managed} itself.


The documentation for this class was generated from the following file: