Skip to content

Commit

Permalink
feat: add TransferSharedArrayBuffer (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek authored Sep 17, 2024
1 parent 42112f0 commit dd84fa3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3663,6 +3663,12 @@ void v8__ValueDeserializer__TransferArrayBuffer(
self->TransferArrayBuffer(transfer_id, array_buffer);
}

void v8__ValueDeserializer__TransferSharedArrayBuffer(
v8::ValueDeserializer* self, uint32_t transfer_id,
v8::Local<v8::SharedArrayBuffer> shared_array_buffer) {
self->TransferSharedArrayBuffer(transfer_id, shared_array_buffer);
}

void v8__ValueDeserializer__SetSupportsLegacyWireFormat(
v8::ValueDeserializer* self, bool supports_legacy_wire_format) {
self->SetSupportsLegacyWireFormat(supports_legacy_wire_format);
Expand Down
20 changes: 20 additions & 0 deletions src/value_deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ extern "C" {
array_buffer: Local<ArrayBuffer>,
);

fn v8__ValueDeserializer__TransferSharedArrayBuffer(
this: *mut CxxValueDeserializer,
transfer_id: u32,
array_buffer: Local<SharedArrayBuffer>,
);

fn v8__ValueDeserializer__SetSupportsLegacyWireFormat(
this: *mut CxxValueDeserializer,
supports_legacy_wire_format: bool,
Expand Down Expand Up @@ -336,6 +342,20 @@ pub trait ValueDeserializerHelper {
};
}

fn transfer_shared_array_buffer(
&self,
transfer_id: u32,
shared_array_buffer: Local<SharedArrayBuffer>,
) {
unsafe {
v8__ValueDeserializer__TransferSharedArrayBuffer(
cast_to_ptr(self.get_cxx_value_deserializer()),
transfer_id,
shared_array_buffer,
)
};
}

fn get_wire_format_version(&self) -> u32 {
unsafe {
v8__ValueDeserializer__GetWireFormatVersion(cast_to_ptr(
Expand Down

0 comments on commit dd84fa3

Please sign in to comment.