V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
v8::ValueSerializer Class Reference

#include <v8.h>

Classes

class  Delegate
 
struct  PrivateData
 

Public Member Functions

 ValueSerializer (Isolate *isolate)
 
 ValueSerializer (Isolate *isolate, Delegate *delegate)
 
void WriteHeader ()
 
V8_WARN_UNUSED_RESULT Maybe< boolWriteValue (Local< Context > context, Local< Value > value)
 
 V8_DEPRECATED ("Use Release()", std::vector< uint8_t > ReleaseBuffer())
 
V8_WARN_UNUSED_RESULT std::pair< uint8_t *, size_tRelease ()
 
void TransferArrayBuffer (uint32_t transfer_id, Local< ArrayBuffer > array_buffer)
 
 V8_DEPRECATED ("Use Delegate::GetSharedArrayBufferId", void TransferSharedArrayBuffer(uint32_t transfer_id, Local< SharedArrayBuffer > shared_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)
 

Detailed Description

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

WARNING: This API is under development, and changes (including incompatible changes to the API or wire format) may occur without notice until this warning is removed.

Definition at line 1877 of file v8.h.

Member Function Documentation

◆ 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 3112 of file api.cc.

◆ 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 3092 of file api.cc.

◆ 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 3116 of file api.cc.

◆ V8_DEPRECATED() [1/2]

v8::ValueSerializer::V8_DEPRECATED ( "Use Release()"  ,
std::vector< uint8_t >   ReleaseBuffer() 
)

Returns the stored data. This serializer should not be used once the buffer is released. The contents are undefined if a previous write has failed.

◆ V8_DEPRECATED() [2/2]

v8::ValueSerializer::V8_DEPRECATED ( "Use Delegate::GetSharedArrayBufferId ,
void   TransferSharedArrayBufferuint32_t transfer_id, Local< SharedArrayBuffer > shared_array_buffer 
)

Similar to TransferArrayBuffer, but for SharedArrayBuffer.

◆ WriteHeader()

void v8::ValueSerializer::WriteHeader ( )

Writes out a header, which includes the format version.

Definition at line 3090 of file api.cc.

◆ 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 3128 of file api.cc.

◆ WriteValue()

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

Serializes a JavaScript value into the buffer.

Definition at line 3096 of file api.cc.


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