summaryrefslogtreecommitdiff
path: root/core/extensions.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-07-22 17:54:22 +0530
committerGitHub <noreply@github.com>2022-07-22 17:54:22 +0530
commit03dc3b8972f460e40d0b75fc3207cae9fe4f60da (patch)
tree410bc92530e34ca2eee8a154f705be85ae9641b3 /core/extensions.rs
parent244c00d95b7ec8f30a5e81b743b4b618049b6c37 (diff)
feat(ops): V8 Fast Calls (#15122)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'core/extensions.rs')
-rw-r--r--core/extensions.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/extensions.rs b/core/extensions.rs
index ce6957875..39b4471bf 100644
--- a/core/extensions.rs
+++ b/core/extensions.rs
@@ -2,6 +2,7 @@
use crate::OpState;
use anyhow::Error;
use std::{cell::RefCell, rc::Rc, task::Context};
+use v8::fast_api::FastFunction;
pub type SourcePair = (&'static str, &'static str);
pub type OpFnRef = v8::FunctionCallback;
@@ -9,14 +10,16 @@ pub type OpMiddlewareFn = dyn Fn(OpDecl) -> OpDecl;
pub type OpStateFn = dyn Fn(&mut OpState) -> Result<(), Error>;
pub type OpEventLoopFn = dyn Fn(Rc<RefCell<OpState>>, &mut Context) -> bool;
-#[derive(Clone, Copy)]
+pub trait FastFunctionSignature {}
+
pub struct OpDecl {
pub name: &'static str,
pub v8_fn_ptr: OpFnRef,
pub enabled: bool,
- pub is_async: bool, // TODO(@AaronO): enum sync/async/fast ?
+ pub is_async: bool,
pub is_unstable: bool,
pub is_v8: bool,
+ pub fast_fn: Option<Box<dyn FastFunction>>,
}
impl OpDecl {
@@ -32,7 +35,7 @@ impl OpDecl {
#[derive(Default)]
pub struct Extension {
js_files: Option<Vec<SourcePair>>,
- ops: Option<Vec<OpDecl>>,
+ pub ops: Option<Vec<OpDecl>>,
opstate_fn: Option<Box<OpStateFn>>,
middleware_fn: Option<Box<OpMiddlewareFn>>,
event_loop_middleware: Option<Box<OpEventLoopFn>>,