summaryrefslogtreecommitdiff
path: root/ext/ffi/dlfcn.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-03-22 19:51:05 +0000
committerGitHub <noreply@github.com>2024-03-22 19:51:05 +0000
commit9c2f9f14e749e4dd63ad02e3ca8af5fc8bd112ee (patch)
treec241d199956bb7ff7dfd76077756de6d53b6c090 /ext/ffi/dlfcn.rs
parent2d59372e7a605360e084c40c5c14cdc52f7d570b (diff)
refactor(ext/ffi): use v8::Value instead of serde_v8::Value (#23035)
Follow up to https://github.com/denoland/deno/pull/23034 that removes another usage of `serde_v8::Value`.
Diffstat (limited to 'ext/ffi/dlfcn.rs')
-rw-r--r--ext/ffi/dlfcn.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/ext/ffi/dlfcn.rs b/ext/ffi/dlfcn.rs
index f1c47b1d3..ad287b9d0 100644
--- a/ext/ffi/dlfcn.rs
+++ b/ext/ffi/dlfcn.rs
@@ -9,11 +9,9 @@ use crate::FfiPermissions;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::op2;
-use deno_core::serde_v8;
use deno_core::v8;
use deno_core::OpState;
use deno_core::Resource;
-use deno_core::ResourceId;
use dlopen2::raw::Library;
use serde::Deserialize;
use serde_value::ValueDeserializer;
@@ -132,12 +130,11 @@ pub struct FfiLoadArgs {
}
#[op2]
-#[serde]
pub fn op_ffi_load<'scope, FP>(
scope: &mut v8::HandleScope<'scope>,
state: &mut OpState,
#[serde] args: FfiLoadArgs,
-) -> Result<(ResourceId, serde_v8::Value<'scope>), AnyError>
+) -> Result<v8::Local<'scope, v8::Value>, AnyError>
where
FP: FfiPermissions + 'static,
{
@@ -222,13 +219,12 @@ where
}
}
+ let out = v8::Array::new(scope, 2);
let rid = state.resource_table.add(resource);
- Ok((
- rid,
- serde_v8::Value {
- v8_value: obj.into(),
- },
- ))
+ let rid_v8 = v8::Integer::new_from_unsigned(scope, rid);
+ out.set_index(scope, 0, rid_v8.into());
+ out.set_index(scope, 1, obj.into());
+ Ok(out.into())
}
// Create a JavaScript function for synchronous FFI call to