#include <v8-snapshot.h>
Public Types | |
enum class | FunctionCodeHandling { kClear , kKeep } |
Friends | |
class | internal::SnapshotCreatorImpl |
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.
|
strong |
|
explicit |
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. |
owns_isolate | whether this SnapshotCreator should call v8::Isolate::Dispose() during its destructor. |
|
explicit |
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. |
|
explicit |
Creates an Isolate for serialization and enters it. The creator fully owns the Isolate and will invoke v8::Isolate::Dispose()
during destruction.
params | The parameters to initialize the Isolate for. Details:
|
v8::SnapshotCreator::SnapshotCreator | ( | v8::Isolate * | isolate, |
const v8::Isolate::CreateParams & | params | ||
) |
Initializes an Isolate for serialization and enters it. The creator does not own the Isolate but merely initialize it properly.
isolate | The isolate that was allocated by `Isolate::Allocate()~. |
params | The parameters to initialize the Isolate for. Details:
|
v8::SnapshotCreator::~SnapshotCreator | ( | ) |
Destroy the snapshot creator, and exit and dispose of the Isolate associated with it.
|
delete |
size_t v8::SnapshotCreator::AddContext | ( | Local< Context > | context, |
SerializeInternalFieldsCallback | internal_fields_serializer = SerializeInternalFieldsCallback() , |
||
SerializeContextDataCallback | context_data_serializer = SerializeContextDataCallback() , |
||
SerializeAPIWrapperCallback | api_wrapper_serializer = SerializeAPIWrapperCallback() |
||
) |
Add additional context to be included in the snapshot blob. The snapshot will include the global proxy.
internal_fields_serializer | Similar to internal_fields_serializer in SetDefaultContext() but only applies to the context being added. |
context_data_serializer | Similar to context_data_serializer in SetDefaultContext() but only applies to the context being added. |
api_wrapper_serializer | Similar to api_wrapper_serializer in SetDefaultContext() but only applies to the context being added. |
|
inline |
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.
|
inline |
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.
StartupData v8::SnapshotCreator::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 * v8::SnapshotCreator::GetIsolate | ( | ) |
|
delete |
void v8::SnapshotCreator::SetDefaultContext | ( | Local< Context > | context, |
SerializeInternalFieldsCallback | internal_fields_serializer = SerializeInternalFieldsCallback() , |
||
SerializeContextDataCallback | context_data_serializer = SerializeContextDataCallback() , |
||
SerializeAPIWrapperCallback | api_wrapper_serializer = SerializeAPIWrapperCallback() |
||
) |
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.
internal_fields_serializer | An optional callback used to serialize internal pointer fields set by v8::Object::SetAlignedPointerInInternalField(). |
context_data_serializer | An optional callback used to serialize context embedder data set by v8::Context::SetAlignedPointerInEmbedderData(). |
api_wrapper_serializer | An optional callback used to serialize API wrapper references set via v8::Object::Wrap() . |
|
friend |