mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-21 15:04:33 -05:00
Add v8::Context::set_embedder_data
This commit is contained in:
parent
89fbf2a051
commit
2bca1d89bf
2 changed files with 14 additions and 0 deletions
|
@ -1853,6 +1853,11 @@ void v8__Context__SetAlignedPointerInEmbedderData(v8::Context& self, int index,
|
|||
ptr_to_local(&self)->SetAlignedPointerInEmbedderData(index, value);
|
||||
}
|
||||
|
||||
void v8__Context__SetEmbedderData(v8::Context& self, int index,
|
||||
const v8::Value* value) {
|
||||
ptr_to_local(&self)->SetEmbedderData(index, ptr_to_local(value));
|
||||
}
|
||||
|
||||
const v8::Data* v8__Context__GetDataFromSnapshotOnce(v8::Context& self,
|
||||
size_t index) {
|
||||
return maybe_local_to_ptr(
|
||||
|
|
|
@ -37,6 +37,11 @@ extern "C" {
|
|||
index: int,
|
||||
value: *mut c_void,
|
||||
);
|
||||
fn v8__Context__SetEmbedderData(
|
||||
this: *const Context,
|
||||
slot: int,
|
||||
data: *const Value,
|
||||
);
|
||||
fn v8__Context__FromSnapshot(
|
||||
isolate: *mut Isolate,
|
||||
context_snapshot_index: usize,
|
||||
|
@ -329,6 +334,10 @@ impl Context {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn set_embedder_data(&self, slot: i32, data: Local<Value>) {
|
||||
unsafe { v8__Context__SetEmbedderData(self, slot, &*data) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_aligned_pointer_from_embedder_data(
|
||||
&self,
|
||||
|
|
Loading…
Reference in a new issue