V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
v8::DummySourceStream Class Reference
Inheritance diagram for v8::DummySourceStream:
v8::ScriptCompiler::ExternalSourceStream

Public Member Functions

 DummySourceStream (Local< String > source, Isolate *isolate)
 
size_t GetMoreData (const uint8_t **src) override
 
- Public Member Functions inherited from v8::ScriptCompiler::ExternalSourceStream
virtual bool SetBookmark ()
 
virtual void ResetToBookmark ()
 

Detailed Description

Definition at line 382 of file d8.cc.

Member Function Documentation

◆ GetMoreData()

size_t v8::DummySourceStream::GetMoreData ( const uint8_t **  src)
inlineoverridevirtual

V8 calls this to request the next chunk of data from the embedder. This function will be called on a background thread, so it's OK to block and wait for the data, if the embedder doesn't have data yet. Returns the length of the data returned. When the data ends, GetMoreData should return 0. Caller takes ownership of the data.

When streaming UTF-8 data, V8 handles multi-byte characters split between two data chunks, but doesn't handle multi-byte characters split between more than two data chunks. The embedder can avoid this problem by always returning at least 2 bytes of data.

When streaming UTF-16 data, V8 does not handle characters split between two data chunks. The embedder has to make sure that chunks have an even length.

If the embedder wants to cancel the streaming, they should make the next GetMoreData call return 0. V8 will interpret it as end of data (and most probably, parsing will fail). The streaming task will return as soon as V8 has parsed the data it received so far.

Implements v8::ScriptCompiler::ExternalSourceStream.

Definition at line 391 of file d8.cc.


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