diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-09-11 15:18:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 15:18:49 +0200 |
commit | 0d1f626edd7c574ff0e70438cdb678dcb5c91170 (patch) | |
tree | 8d80e4f32ba9535da4c387234b795385ee2f6492 /cli/web_worker.rs | |
parent | 7c2e7c660804afca823d60e6496aa853f75db16c (diff) |
refactor(core): JsRuntime initialization (#7415)
Removes:
- "deno_core::StartupData"
- "deno_core::Script"
- "deno_core::OwnedScript"
Changes to "JsRuntime":
- remove "new_with_loader()"
- remove "with_heap_limits()"
- rename "IsolateOptions" to "RuntimeOptions" and make public
- "JsRuntime::new()" takes "RuntimeOptions" as a single param
Diffstat (limited to 'cli/web_worker.rs')
-rw-r--r-- | cli/web_worker.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/cli/web_worker.rs b/cli/web_worker.rs index ebf8fa698..b0990d313 100644 --- a/cli/web_worker.rs +++ b/cli/web_worker.rs @@ -1,5 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +use crate::js; use crate::ops; use crate::state::State; use crate::worker::Worker; @@ -7,7 +8,6 @@ use crate::worker::WorkerEvent; use crate::worker::WorkerHandle; use deno_core::v8; use deno_core::ErrBox; -use deno_core::StartupData; use futures::channel::mpsc; use futures::future::FutureExt; use futures::stream::StreamExt; @@ -85,11 +85,10 @@ pub struct WebWorker { impl WebWorker { pub fn new( name: String, - startup_data: StartupData, state: &Rc<State>, has_deno_namespace: bool, ) -> Self { - let mut worker = Worker::new(name, startup_data, &state); + let mut worker = Worker::new(name, Some(js::deno_isolate_init()), &state); let terminated = Arc::new(AtomicBool::new(false)); let isolate_handle = worker.isolate.thread_safe_handle(); @@ -240,19 +239,13 @@ impl Future for WebWorker { #[cfg(test)] mod tests { use super::*; - use crate::startup_data; use crate::state::State; use crate::tokio_util; use crate::worker::WorkerEvent; fn create_test_worker() -> WebWorker { let state = State::mock("./hello.js"); - let mut worker = WebWorker::new( - "TEST".to_string(), - startup_data::deno_isolate_init(), - &state, - false, - ); + let mut worker = WebWorker::new("TEST".to_string(), &state, false); worker .execute("bootstrap.workerRuntime(\"TEST\", false)") .unwrap(); |