diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/state.rs | 7 | ||||
-rw-r--r-- | cli/worker.rs | 12 |
2 files changed, 11 insertions, 8 deletions
diff --git a/cli/state.rs b/cli/state.rs index 808678b21..f10f3b7e0 100644 --- a/cli/state.rs +++ b/cli/state.rs @@ -10,7 +10,6 @@ use crate::resources::ResourceId; use crate::worker::Worker; use deno::deno_buf; use deno::Buf; -use deno::Dispatch; use deno::Op; use futures::future::Shared; use std; @@ -74,9 +73,9 @@ impl Deref for ThreadSafeState { } } -impl Dispatch for ThreadSafeState { - fn dispatch( - &mut self, +impl ThreadSafeState { + pub fn dispatch( + &self, control: &[u8], zero_copy: deno_buf, ) -> (bool, Box<Op>) { diff --git a/cli/worker.rs b/cli/worker.rs index 408bae1c6..8b420cef6 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -9,6 +9,7 @@ use crate::msg; use crate::state::ThreadSafeState; use crate::tokio_util; use deno; +use deno::Config; use deno::JSError; use deno::Loader; use deno::StartupData; @@ -21,7 +22,7 @@ use url::Url; /// Wraps deno::Isolate to provide source maps, ops for the CLI, and /// high-level module loading pub struct Worker { - inner: deno::Isolate<ThreadSafeState>, + inner: deno::Isolate, pub modules: deno::Modules, pub state: ThreadSafeState, } @@ -33,8 +34,12 @@ impl Worker { state: ThreadSafeState, ) -> Worker { let state_ = state.clone(); + let mut config = Config::default(); + config.dispatch(move |control_buf, zero_copy_buf| { + state_.dispatch(control_buf, zero_copy_buf) + }); Self { - inner: deno::Isolate::new(startup_data, state_), + inner: deno::Isolate::new(startup_data, config), modules: deno::Modules::new(), state, } @@ -154,7 +159,6 @@ pub fn root_specifier_to_url( } impl Loader for Worker { - type Dispatch = ThreadSafeState; type Error = DenoError; fn resolve(specifier: &str, referrer: &str) -> Result<String, Self::Error> { @@ -187,7 +191,7 @@ impl Loader for Worker { fn isolate_and_modules<'a: 'b + 'c, 'b, 'c>( &'a mut self, - ) -> (&'b mut deno::Isolate<Self::Dispatch>, &'c mut deno::Modules) { + ) -> (&'b mut deno::Isolate, &'c mut deno::Modules) { (&mut self.inner, &mut self.modules) } } |