From d4b05dd89e94ed1bba5b24c683da0a895f2ce597 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 29 May 2020 17:41:39 -0400 Subject: refactor: Split isolate and state using safe get_slot() (#5929) --- cli/ops/dispatch_json.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'cli/ops/dispatch_json.rs') diff --git a/cli/ops/dispatch_json.rs b/cli/ops/dispatch_json.rs index 6125ea39b..c2c103f69 100644 --- a/cli/ops/dispatch_json.rs +++ b/cli/ops/dispatch_json.rs @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use crate::op_error::OpError; use deno_core::Buf; -use deno_core::CoreIsolate; +use deno_core::CoreIsolateState; use deno_core::Op; use deno_core::ZeroCopyBuf; use futures::future::FutureExt; @@ -46,12 +46,15 @@ struct AsyncArgs { pub fn json_op( d: D, -) -> impl Fn(&mut CoreIsolate, &[u8], Option) -> Op +) -> impl Fn(&mut CoreIsolateState, &[u8], Option) -> Op where - D: - Fn(&mut CoreIsolate, Value, Option) -> Result, + D: Fn( + &mut CoreIsolateState, + Value, + Option, + ) -> Result, { - move |isolate: &mut CoreIsolate, + move |isolate_state: &mut CoreIsolateState, control: &[u8], zero_copy: Option| { let async_args: AsyncArgs = match serde_json::from_slice(control) { @@ -66,7 +69,7 @@ where let result = serde_json::from_slice(control) .map_err(OpError::from) - .and_then(|args| d(isolate, args, zero_copy)); + .and_then(|args| d(isolate_state, args, zero_copy)); // Convert to Op match result { -- cgit v1.2.3