v8 10.2.154 (node 18.16.0)
V8 is Google's open source JavaScript engine
|
#include <v8-snapshot.h>
Public Types | |
enum class | FunctionCodeHandling { kClear , kKeep } |
Public Member Functions | |
SnapshotCreator (Isolate *isolate, const intptr_t *external_references=nullptr, StartupData *existing_blob=nullptr) | |
SnapshotCreator (const intptr_t *external_references=nullptr, StartupData *existing_blob=nullptr) | |
~SnapshotCreator () | |
Isolate * | GetIsolate () |
void | SetDefaultContext (Local< Context > context, SerializeInternalFieldsCallback callback=SerializeInternalFieldsCallback()) |
size_t | AddContext (Local< Context > context, SerializeInternalFieldsCallback callback=SerializeInternalFieldsCallback()) |
template<class T > | |
V8_INLINE size_t | AddData (Local< Context > context, Local< T > object) |
template<class T > | |
V8_INLINE size_t | AddData (Local< T > object) |
StartupData | CreateBlob (FunctionCodeHandling function_code_handling) |
SnapshotCreator (const SnapshotCreator &)=delete | |
void | operator= (const SnapshotCreator &)=delete |
template<class T > | |
size_t | AddData (Local< Context > context, Local< T > object) |
template<class T > | |
size_t | AddData (Local< T > object) |
Helper class to create a snapshot data blob.
The Isolate used by a SnapshotCreator is owned by it, and will be entered and exited by the constructor and destructor, respectively; The destructor will also destroy the Isolate. Experimental language features, including those available by default, are not available while creating a snapshot.
Definition at line 80 of file v8-snapshot.h.
|
strong |
Enumerator | |
---|---|
kClear | |
kKeep |
Definition at line 82 of file v8-snapshot.h.
SnapshotCreator | ( | Isolate * | isolate, |
const intptr_t * | external_references = nullptr , |
||
StartupData * | existing_blob = nullptr |
||
) |
Initialize 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.
existing_blob | existing snapshot from which to create this one. |
external_references | a null-terminated array of external references that must be equivalent to CreateParams::external_references. |
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.
existing_blob | existing snapshot from which to create this one. |
external_references | a null-terminated array of external references that must be equivalent to CreateParams::external_references. |
~SnapshotCreator | ( | ) |
Destroy the snapshot creator, and exit and dispose of the Isolate associated with it.
|
delete |
size_t AddContext | ( | Local< Context > | context, |
SerializeInternalFieldsCallback | callback = SerializeInternalFieldsCallback() |
||
) |
Add additional context to be included in the snapshot blob. The snapshot will include the global proxy.
callback | optional callback to serialize internal fields. |
Attach arbitrary V8::Data to the context snapshot, which can be retrieved via Context::GetDataFromSnapshotOnce after deserialization. This data does not survive when a new snapshot is created from an existing snapshot.
Referenced by SnapshotCreator::AddData(), and SnapshotCreator::AddData().
Definition at line 181 of file v8-snapshot.h.
References SnapshotCreator::AddData().
Attach arbitrary V8::Data to the isolate snapshot, which can be retrieved via Isolate::GetDataFromSnapshotOnce after deserialization. This data does not survive when a new snapshot is created from an existing snapshot.
size_t AddData | ( | Local< T > | object | ) |
Definition at line 188 of file v8-snapshot.h.
References SnapshotCreator::AddData().
StartupData CreateBlob | ( | FunctionCodeHandling | function_code_handling | ) |
Created a snapshot data blob. This must not be called from within a handle scope.
function_code_handling | whether to include compiled function code in the snapshot. |
Isolate * GetIsolate | ( | ) |
|
delete |
void 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.
callback | optional callback to serialize internal fields. |