diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-04-19 23:54:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-19 23:54:46 -0400 |
commit | c1ec042a0011eeba2480b892a335ca7804c59180 (patch) | |
tree | 02d9595a3a6be9fb646171be29f59a3c0f74f12f /cli/ops/dispatch_json.rs | |
parent | 4e3532fe7b61a1050b00611081cc83af8b02de70 (diff) |
Modify op dispatcher to include &mut Isolate argument (#4821)
- Removes unnecessary RwLock and Rc around the op registry table
- Preparation to move resource_table to deno_core::Isolate.
- Towards #3453, #4222
Diffstat (limited to 'cli/ops/dispatch_json.rs')
-rw-r--r-- | cli/ops/dispatch_json.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cli/ops/dispatch_json.rs b/cli/ops/dispatch_json.rs index b1a7bc723..bfffd6d09 100644 --- a/cli/ops/dispatch_json.rs +++ b/cli/ops/dispatch_json.rs @@ -41,11 +41,19 @@ struct AsyncArgs { promise_id: Option<u64>, } -pub fn json_op<D>(d: D) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> Op +pub fn json_op<D>( + d: D, +) -> impl Fn(&mut deno_core::Isolate, &[u8], Option<ZeroCopyBuf>) -> Op where - D: Fn(Value, Option<ZeroCopyBuf>) -> Result<JsonOp, OpError>, + D: Fn( + &mut deno_core::Isolate, + Value, + Option<ZeroCopyBuf>, + ) -> Result<JsonOp, OpError>, { - move |control: &[u8], zero_copy: Option<ZeroCopyBuf>| { + move |isolate: &mut deno_core::Isolate, + control: &[u8], + zero_copy: Option<ZeroCopyBuf>| { let async_args: AsyncArgs = match serde_json::from_slice(control) { Ok(args) => args, Err(e) => { @@ -58,7 +66,7 @@ where let result = serde_json::from_slice(control) .map_err(OpError::from) - .and_then(|args| d(args, zero_copy)); + .and_then(|args| d(isolate, args, zero_copy)); // Convert to Op match result { |