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 /deno_typescript/lib.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 'deno_typescript/lib.rs')
-rw-r--r-- | deno_typescript/lib.rs | 14 |
1 files changed, 10 insertions, 4 deletions
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<D>( ts_state: Arc<Mutex<TSState>>, dispatcher: D, -) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> Op +) -> impl Fn(&mut deno_core::Isolate, &[u8], Option<ZeroCopyBuf>) -> Op where D: Fn(&mut TSState, &[u8]) -> Op, { - move |control: &[u8], zero_copy_buf: Option<ZeroCopyBuf>| -> Op { + move |_isolate: &mut deno_core::Isolate, + control: &[u8], + zero_copy_buf: Option<ZeroCopyBuf>| + -> 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<S: ::std::hash::BuildHasher>( custom_assets: HashMap<String, PathBuf, S>, -) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> Op { +) -> impl Fn(&mut deno_core::Isolate, &[u8], Option<ZeroCopyBuf>) -> Op { for (_, path) in custom_assets.iter() { println!("cargo:rerun-if-changed={}", path.display()); } - move |control: &[u8], zero_copy_buf: Option<ZeroCopyBuf>| -> Op { + move |_isolate: &mut deno_core::Isolate, + control: &[u8], + zero_copy_buf: Option<ZeroCopyBuf>| + -> Op { assert!(zero_copy_buf.is_none()); // zero_copy_buf unused in this op. let name = std::str::from_utf8(control).unwrap(); |