diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-09-28 12:14:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 12:14:11 +0200 |
commit | 45d4fd44c9444241a898d3075b99e8871fccdd65 (patch) | |
tree | c6ac6bb880023326e935f96d56ef23ba891f92d3 /cli/ops/worker_host.rs | |
parent | 8ceb165e5d1dc0c8d417e42ffc3a26e8f5a62a03 (diff) |
refactor: move op state registration to workers (#7696)
Diffstat (limited to 'cli/ops/worker_host.rs')
-rw-r--r-- | cli/ops/worker_host.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cli/ops/worker_host.rs b/cli/ops/worker_host.rs index 60262b4f6..9175ca0f1 100644 --- a/cli/ops/worker_host.rs +++ b/cli/ops/worker_host.rs @@ -5,8 +5,8 @@ use crate::global_state::GlobalState; use crate::ops::io::get_stdio; use crate::permissions::Permissions; use crate::tokio_util::create_basic_runtime; -use crate::web_worker::WebWorker; -use crate::web_worker::WebWorkerHandle; +use crate::worker::WebWorker; +use crate::worker::WebWorkerHandle; use crate::worker::WorkerEvent; use deno_core::error::AnyError; use deno_core::futures::future::FutureExt; @@ -26,6 +26,12 @@ use std::sync::Arc; use std::thread::JoinHandle; pub fn init(rt: &mut deno_core::JsRuntime) { + { + let op_state = rt.op_state(); + let mut state = op_state.borrow_mut(); + state.put::<WorkersTable>(WorkersTable::default()); + state.put::<WorkerId>(WorkerId::default()); + } super::reg_json_sync(rt, "op_create_worker", op_create_worker); super::reg_json_sync( rt, |