summaryrefslogtreecommitdiff
path: root/core/core_isolate.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-08-12 10:44:58 -0400
committerGitHub <noreply@github.com>2020-08-12 16:44:58 +0200
commitf5a4f1fdc04b24cdfbef83842b9c42b5032c4059 (patch)
treef0ead2884b3b69b287a05a82885e30a541116063 /core/core_isolate.rs
parent6706eb551532ee6c84ad013377ac2cd91681424a (diff)
Undo JsonOpDispatcher and OpDispatcher traits (#7023)
This reverts commit f83d672ffad7afb1473bd4f9b9c645539064c620. This reverts commit d51972377c1325076704d9faec2eee6f0e024496.
Diffstat (limited to 'core/core_isolate.rs')
-rw-r--r--core/core_isolate.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/core_isolate.rs b/core/core_isolate.rs
index 17345e14c..199bbd832 100644
--- a/core/core_isolate.rs
+++ b/core/core_isolate.rs
@@ -419,11 +419,10 @@ impl CoreIsolate {
/// corresponds to the second argument of Deno.core.dispatch().
///
/// Requires runtime to explicitly ask for op ids before using any of the ops.
- pub fn register_op(
- &mut self,
- name: &str,
- op: impl OpDispatcher + 'static,
- ) -> OpId {
+ pub fn register_op<F>(&mut self, name: &str, op: F) -> OpId
+ where
+ F: Fn(&mut CoreIsolateState, &mut [ZeroCopyBuf]) -> Op + 'static,
+ {
let state_rc = Self::state(self);
let mut state = state_rc.borrow_mut();
state.op_registry.register(name, op)
@@ -590,7 +589,7 @@ impl CoreIsolateState {
/// Requires runtime to explicitly ask for op ids before using any of the ops.
pub fn register_op<F>(&mut self, name: &str, op: F) -> OpId
where
- F: OpDispatcher + 'static,
+ F: Fn(&mut CoreIsolateState, &mut [ZeroCopyBuf]) -> Op + 'static,
{
self.op_registry.register(name, op)
}
@@ -612,7 +611,7 @@ impl CoreIsolateState {
zero_copy_bufs: &mut [ZeroCopyBuf],
) -> Option<(OpId, Box<[u8]>)> {
let op = if let Some(dispatcher) = self.op_registry.get(op_id) {
- dispatcher.dispatch(self, zero_copy_bufs)
+ dispatcher(self, zero_copy_bufs)
} else {
let message =
v8::String::new(scope, &format!("Unknown op id: {}", op_id)).unwrap();