Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
v8::SnapshotCreator Class Reference

#include <v8.h>

Public Types

enum class  FunctionCodeHandling { kClear , kKeep }
 

Public Member Functions

 SnapshotCreator (const intptr_t *external_references=nullptr, StartupData *existing_blob=nullptr)
 
 ~SnapshotCreator ()
 
IsolateGetIsolate ()
 
void SetDefaultContext (Local< Context > context, SerializeInternalFieldsCallback callback=SerializeInternalFieldsCallback())
 
size_t AddContext (Local< Context > context, SerializeInternalFieldsCallback callback=SerializeInternalFieldsCallback())
 
size_t AddTemplate (Local< Template > template_obj)
 
StartupData CreateBlob (FunctionCodeHandling function_code_handling)
 
 SnapshotCreator (const SnapshotCreator &)=delete
 
void operator= (const SnapshotCreator &)=delete
 

Detailed Description

Helper class to create a snapshot data blob.

Member Enumeration Documentation

◆ FunctionCodeHandling

Enumerator
kClear 
kKeep 

Constructor & Destructor Documentation

◆ SnapshotCreator() [1/2]

v8::SnapshotCreator::SnapshotCreator ( const intptr_t *  external_references = nullptr,
StartupData existing_blob = nullptr 
)

Create and enter an isolate, and set it up for serialization. The isolate is either created from scratch or from an existing snapshot. The caller keeps ownership of the argument snapshot.

Parameters
existing_blobexisting snapshot from which to create this one.
external_referencesa null-terminated array of external references that must be equivalent to CreateParams::external_references.

◆ ~SnapshotCreator()

v8::SnapshotCreator::~SnapshotCreator ( )

◆ SnapshotCreator() [2/2]

v8::SnapshotCreator::SnapshotCreator ( const SnapshotCreator )
delete

Member Function Documentation

◆ AddContext()

size_t v8::SnapshotCreator::AddContext ( Local< Context context,
SerializeInternalFieldsCallback  callback = SerializeInternalFieldsCallback() 
)

Add additional context to be included in the snapshot blob. The snapshot will include the global proxy.

Parameters
callbackoptional callback to serialize internal fields.
Returns
the index of the context in the snapshot blob.

◆ AddTemplate()

size_t v8::SnapshotCreator::AddTemplate ( Local< Template template_obj)

Add a template to be included in the snapshot blob.

Returns
the index of the template in the snapshot blob.

◆ CreateBlob()

StartupData v8::SnapshotCreator::CreateBlob ( FunctionCodeHandling  function_code_handling)

Created a snapshot data blob. This must not be called from within a handle scope.

Parameters
function_code_handlingwhether to include compiled function code in the snapshot.
Returns
{ nullptr, 0 } on failure, and a startup snapshot on success. The caller acquires ownership of the data array in the return value.

◆ GetIsolate()

Isolate * v8::SnapshotCreator::GetIsolate ( )
Returns
the isolate prepared by the snapshot creator.

◆ operator=()

void v8::SnapshotCreator::operator= ( const SnapshotCreator )
delete

◆ SetDefaultContext()

void v8::SnapshotCreator::SetDefaultContext ( Local< Context context,
SerializeInternalFieldsCallback  callback = SerializeInternalFieldsCallback() 
)

Set the default context to be included in the snapshot blob. The snapshot will not contain the global proxy, and we expect one or a global object template to create one, to be provided upon deserialization.

Parameters
callbackoptional callback to serialize internal fields.

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