diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-01-21 17:50:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-21 17:50:06 +0100 |
commit | ecd1d3abb0cae9c7cbc1330cbaa035a5786e94d7 (patch) | |
tree | 73d4b12a06f5f6a6bc0e7168e0021efc3a2eda7c /cli/lib.rs | |
parent | 229eb292f83dedbc32dc24f912841caf79a53e9c (diff) |
refactor: split cli::Worker (#3735)
* cli::Worker is base struct to create specialized workers
* add MainWorker
* add CompilerWorker
* refactor WebWorker to use Worker
Diffstat (limited to 'cli/lib.rs')
-rw-r--r-- | cli/lib.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cli/lib.rs b/cli/lib.rs index c0ad84c85..53dac1ea9 100644 --- a/cli/lib.rs +++ b/cli/lib.rs @@ -60,7 +60,7 @@ use crate::global_state::ThreadSafeGlobalState; use crate::ops::io::get_stdio; use crate::progress::Progress; use crate::state::ThreadSafeState; -use crate::worker::Worker; +use crate::worker::MainWorker; use deno_core::v8_set_flags; use deno_core::ErrBox; use deno_core::ModuleSpecifier; @@ -97,7 +97,7 @@ impl log::Log for Logger { fn create_worker_and_state( flags: DenoFlags, -) -> (Worker, ThreadSafeGlobalState) { +) -> (MainWorker, ThreadSafeGlobalState) { use crate::shell::Shell; use std::sync::Arc; use std::sync::Mutex; @@ -135,7 +135,7 @@ fn create_worker_and_state( resource_table.add("stderr", Box::new(stderr)); } - let worker = Worker::new( + let worker = MainWorker::new( "main".to_string(), startup_data::deno_isolate_init(), state, @@ -150,7 +150,7 @@ fn types_command() { println!("{}", content); } -fn print_cache_info(worker: Worker) { +fn print_cache_info(worker: MainWorker) { let state = &worker.state.global_state; println!( @@ -170,7 +170,10 @@ fn print_cache_info(worker: Worker) { ); } -async fn print_file_info(worker: Worker, module_specifier: ModuleSpecifier) { +async fn print_file_info( + worker: MainWorker, + module_specifier: ModuleSpecifier, +) { let global_state_ = &worker.state.global_state; let maybe_source_file = global_state_ |