From c1ec042a0011eeba2480b892a335ca7804c59180 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 19 Apr 2020 23:54:46 -0400 Subject: 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 --- deno_typescript/lib.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'deno_typescript/lib.rs') diff --git a/deno_typescript/lib.rs b/deno_typescript/lib.rs index cd843041e..24ecd6287 100644 --- a/deno_typescript/lib.rs +++ b/deno_typescript/lib.rs @@ -49,11 +49,14 @@ pub struct TSState { fn compiler_op( ts_state: Arc>, dispatcher: D, -) -> impl Fn(&[u8], Option) -> Op +) -> impl Fn(&mut deno_core::Isolate, &[u8], Option) -> Op where D: Fn(&mut TSState, &[u8]) -> Op, { - move |control: &[u8], zero_copy_buf: Option| -> Op { + move |_isolate: &mut deno_core::Isolate, + control: &[u8], + zero_copy_buf: Option| + -> Op { assert!(zero_copy_buf.is_none()); // zero_copy_buf unused in compiler. let mut s = ts_state.lock().unwrap(); dispatcher(&mut s, control) @@ -326,11 +329,14 @@ pub fn trace_serializer() { /// Isolate. pub fn op_fetch_asset( custom_assets: HashMap, -) -> impl Fn(&[u8], Option) -> Op { +) -> impl Fn(&mut deno_core::Isolate, &[u8], Option) -> Op { for (_, path) in custom_assets.iter() { println!("cargo:rerun-if-changed={}", path.display()); } - move |control: &[u8], zero_copy_buf: Option| -> Op { + move |_isolate: &mut deno_core::Isolate, + control: &[u8], + zero_copy_buf: Option| + -> Op { assert!(zero_copy_buf.is_none()); // zero_copy_buf unused in this op. let name = std::str::from_utf8(control).unwrap(); -- cgit v1.2.3