diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/metrics.rs | 13 | ||||
-rw-r--r-- | runtime/ops/plugin.rs | 3 | ||||
-rw-r--r-- | runtime/ops/web_worker.rs | 5 | ||||
-rw-r--r-- | runtime/ops/worker_host.rs | 2 |
4 files changed, 11 insertions, 12 deletions
diff --git a/runtime/metrics.rs b/runtime/metrics.rs index f3f48e55e..46e966fae 100644 --- a/runtime/metrics.rs +++ b/runtime/metrics.rs @@ -150,7 +150,7 @@ use deno_core::OpFn; use std::collections::HashMap; pub fn metrics_op(name: &'static str, op_fn: Box<OpFn>) -> Box<OpFn> { - Box::new(move |op_state, payload, buf| -> Op { + Box::new(move |op_state, payload| -> Op { // TODOs: // * The 'bytes' metrics seem pretty useless, especially now that the // distinction between 'control' and 'data' buffers has become blurry. @@ -160,12 +160,9 @@ pub fn metrics_op(name: &'static str, op_fn: Box<OpFn>) -> Box<OpFn> { // TODO: remove this, doesn't make a ton of sense let bytes_sent_control = 0; - let bytes_sent_data = match buf { - Some(ref b) => b.len(), - None => 0, - }; + let bytes_sent_data = 0; - let op = (op_fn)(op_state.clone(), payload, buf); + let op = (op_fn)(op_state.clone(), payload); let op_state_ = op_state.clone(); let mut s = op_state.borrow_mut(); @@ -181,9 +178,9 @@ pub fn metrics_op(name: &'static str, op_fn: Box<OpFn>) -> Box<OpFn> { use deno_core::futures::future::FutureExt; match op { - Op::Sync(buf) => { + Op::Sync(result) => { metrics.op_sync(bytes_sent_control, bytes_sent_data, 0); - Op::Sync(buf) + Op::Sync(result) } Op::Async(fut) => { metrics.op_dispatched_async(bytes_sent_control, bytes_sent_data); diff --git a/runtime/ops/plugin.rs b/runtime/ops/plugin.rs index 6892b66c3..17d39405f 100644 --- a/runtime/ops/plugin.rs +++ b/runtime/ops/plugin.rs @@ -104,9 +104,10 @@ impl<'a> plugin_api::Interface for PluginInterface<'a> { dispatch_op_fn: plugin_api::DispatchOpFn, ) -> OpId { let plugin_lib = self.plugin_lib.clone(); - let plugin_op_fn: Box<OpFn> = Box::new(move |state_rc, _payload, buf| { + let plugin_op_fn: Box<OpFn> = Box::new(move |state_rc, payload| { let mut state = state_rc.borrow_mut(); let mut interface = PluginInterface::new(&mut state, &plugin_lib); + let (_, buf): ((), Option<ZeroCopyBuf>) = payload.deserialize().unwrap(); let op = dispatch_op_fn(&mut interface, buf); match op { sync_op @ Op::Sync(..) => sync_op, diff --git a/runtime/ops/web_worker.rs b/runtime/ops/web_worker.rs index 17b72cb38..1689b2587 100644 --- a/runtime/ops/web_worker.rs +++ b/runtime/ops/web_worker.rs @@ -6,13 +6,14 @@ use deno_core::error::null_opbuf; use deno_core::futures::channel::mpsc; use deno_core::op_sync; use deno_core::Extension; +use deno_core::ZeroCopyBuf; pub fn init() -> Extension { Extension::builder() .ops(vec![ ( "op_worker_post_message", - op_sync(move |state, _args: (), buf| { + op_sync(move |state, _args: (), buf: Option<ZeroCopyBuf>| { let buf = buf.ok_or_else(null_opbuf)?; let msg_buf: Box<[u8]> = (*buf).into(); let mut sender = state.borrow::<mpsc::Sender<WorkerEvent>>().clone(); @@ -25,7 +26,7 @@ pub fn init() -> Extension { // Notify host that guest worker closes. ( "op_worker_close", - op_sync(move |state, _args: (), _bufs| { + op_sync(move |state, _: (), _: ()| { // Notify parent that we're finished let mut sender = state.borrow::<mpsc::Sender<WorkerEvent>>().clone(); sender.close_channel(); diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index 3a4554226..cd650c2c0 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -96,7 +96,7 @@ pub fn init( ("op_host_get_message", op_async(op_host_get_message)), ( "op_host_unhandled_error", - op_sync(move |state, message: String, _| { + op_sync(move |state, message: String, _: ()| { if is_main_worker { return Err(generic_error("Cannot be called from main worker.")); } |