v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::ValueSerializer Class Reference

#include <v8-value-serializer.h>

Collaboration diagram for v8::ValueSerializer:

Classes

class  Delegate
 
struct  PrivateData
 

Public Member Functions

 ValueSerializer (Isolate *isolate)
 
 ValueSerializer (Isolate *isolate, Delegate *delegate)
 
 ~ValueSerializer ()
 
void WriteHeader ()
 
V8_WARN_UNUSED_RESULT Maybe< bool > WriteValue (Local< Context > context, Local< Value > value)
 
V8_WARN_UNUSED_RESULT std::pair< uint8_t *, size_t > Release ()
 
void TransferArrayBuffer (uint32_t transfer_id, Local< ArrayBuffer > array_buffer)
 
void SetTreatArrayBufferViewsAsHostObjects (bool mode)
 
void WriteUint32 (uint32_t value)
 
void WriteUint64 (uint64_t value)
 
void WriteDouble (double value)
 
void WriteRawBytes (const void *source, size_t length)
 
 ValueSerializer (const ValueSerializer &)=delete
 
void operator= (const ValueSerializer &)=delete
 

Private Attributes

PrivateDataprivate_
 

Detailed Description

Value serialization compatible with the HTML structured clone algorithm. The format is backward-compatible (i.e. safe to store to disk).

Definition at line 65 of file v8-value-serializer.h.

Constructor & Destructor Documentation

◆ ValueSerializer() [1/3]

v8::ValueSerializer::ValueSerializer ( Isolate * isolate)
explicit

Definition at line 3294 of file api.cc.

◆ ValueSerializer() [2/3]

v8::ValueSerializer::ValueSerializer ( Isolate * isolate,
Delegate * delegate )

Definition at line 3297 of file api.cc.

◆ ~ValueSerializer()

v8::ValueSerializer::~ValueSerializer ( )

Definition at line 3301 of file api.cc.

◆ ValueSerializer() [3/3]

v8::ValueSerializer::ValueSerializer ( const ValueSerializer & )
delete

Member Function Documentation

◆ operator=()

void v8::ValueSerializer::operator= ( const ValueSerializer & )
delete

◆ Release()

std::pair< uint8_t *, size_t > v8::ValueSerializer::Release ( )

Returns the stored data (allocated using the delegate's ReallocateBufferMemory) and its size. This serializer should not be used once the buffer is released. The contents are undefined if a previous write has failed. Ownership of the buffer is transferred to the caller.

Definition at line 3320 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTreatArrayBufferViewsAsHostObjects()

void v8::ValueSerializer::SetTreatArrayBufferViewsAsHostObjects ( bool mode)

Indicate whether to treat ArrayBufferView objects as host objects, i.e. pass them to Delegate::WriteHostObject. This should not be called when no Delegate was passed.

The default is not to treat ArrayBufferViews as host objects.

Definition at line 3305 of file api.cc.

Here is the call graph for this function:

◆ TransferArrayBuffer()

void v8::ValueSerializer::TransferArrayBuffer ( uint32_t transfer_id,
Local< ArrayBuffer > array_buffer )

Marks an ArrayBuffer as havings its contents transferred out of band. Pass the corresponding ArrayBuffer in the deserializing context to ValueDeserializer::TransferArrayBuffer.

Definition at line 3324 of file api.cc.

Here is the call graph for this function:

◆ WriteDouble()

void v8::ValueSerializer::WriteDouble ( double value)

Definition at line 3338 of file api.cc.

Here is the call graph for this function:

◆ WriteHeader()

void v8::ValueSerializer::WriteHeader ( )

Writes out a header, which includes the format version.

Definition at line 3303 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteRawBytes()

void v8::ValueSerializer::WriteRawBytes ( const void * source,
size_t length )

Definition at line 3342 of file api.cc.

Here is the call graph for this function:

◆ WriteUint32()

void v8::ValueSerializer::WriteUint32 ( uint32_t value)

Write raw data in various common formats to the buffer. Note that integer types are written in base-128 varint format, not with a binary copy. For use during an override of Delegate::WriteHostObject.

Definition at line 3330 of file api.cc.

Here is the call graph for this function:

◆ WriteUint64()

void v8::ValueSerializer::WriteUint64 ( uint64_t value)

Definition at line 3334 of file api.cc.

Here is the call graph for this function:

◆ WriteValue()

Maybe< bool > v8::ValueSerializer::WriteValue ( Local< Context > context,
Local< Value > value )

Serializes a JavaScript value into the buffer.

Definition at line 3309 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ private_

PrivateData* v8::ValueSerializer::private_
private

Definition at line 208 of file v8-value-serializer.h.


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