mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-28 16:21:04 -05:00
SnapshotCreator::add_context
This commit is contained in:
parent
25b6329bf5
commit
bc41fd3b0d
2 changed files with 17 additions and 0 deletions
|
@ -2364,6 +2364,11 @@ void v8__SnapshotCreator__SetDefaultContext(v8::SnapshotCreator* self,
|
||||||
self->SetDefaultContext(ptr_to_local(&context), SerializeInternalFields);
|
self->SetDefaultContext(ptr_to_local(&context), SerializeInternalFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t v8__SnapshotCreator__AddContext(v8::SnapshotCreator* self,
|
||||||
|
const v8::Context& context) {
|
||||||
|
return self->AddContext(ptr_to_local(&context), SerializeInternalFields);
|
||||||
|
}
|
||||||
|
|
||||||
size_t v8__SnapshotCreator__AddData_to_isolate(v8::SnapshotCreator* self,
|
size_t v8__SnapshotCreator__AddData_to_isolate(v8::SnapshotCreator* self,
|
||||||
const v8::Data& data) {
|
const v8::Data& data) {
|
||||||
return self->AddData(ptr_to_local(&data));
|
return self->AddData(ptr_to_local(&data));
|
||||||
|
|
|
@ -32,6 +32,10 @@ extern "C" {
|
||||||
this: *mut SnapshotCreator,
|
this: *mut SnapshotCreator,
|
||||||
context: *const Context,
|
context: *const Context,
|
||||||
);
|
);
|
||||||
|
fn v8__SnapshotCreator__AddContext(
|
||||||
|
this: *mut SnapshotCreator,
|
||||||
|
context: *const Context,
|
||||||
|
) -> usize;
|
||||||
fn v8__SnapshotCreator__AddData_to_isolate(
|
fn v8__SnapshotCreator__AddData_to_isolate(
|
||||||
this: *mut SnapshotCreator,
|
this: *mut SnapshotCreator,
|
||||||
data: *const Data,
|
data: *const Data,
|
||||||
|
@ -157,6 +161,14 @@ impl SnapshotCreator {
|
||||||
unsafe { v8__SnapshotCreator__SetDefaultContext(self, &*context) };
|
unsafe { v8__SnapshotCreator__SetDefaultContext(self, &*context) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add additional context to be included in the snapshot blob.
|
||||||
|
/// The snapshot will include the global proxy.
|
||||||
|
///
|
||||||
|
/// Returns the index of the context in the snapshot blob.
|
||||||
|
pub fn add_context(&mut self, context: Local<Context>) -> usize {
|
||||||
|
unsafe { v8__SnapshotCreator__AddContext(self, &*context) }
|
||||||
|
}
|
||||||
|
|
||||||
/// Attach arbitrary `v8::Data` to the isolate snapshot, which can be
|
/// Attach arbitrary `v8::Data` to the isolate snapshot, which can be
|
||||||
/// retrieved via `HandleScope::get_context_data_from_snapshot_once()` after
|
/// retrieved via `HandleScope::get_context_data_from_snapshot_once()` after
|
||||||
/// deserialization. This data does not survive when a new snapshot is created
|
/// deserialization. This data does not survive when a new snapshot is created
|
||||||
|
|
Loading…
Reference in a new issue