Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 9 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down