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/compilers/wasm.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/compilers/wasm.rs')
-rw-r--r-- | cli/compilers/wasm.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/cli/compilers/wasm.rs b/cli/compilers/wasm.rs index e2a293f18..637fc7687 100644 --- a/cli/compilers/wasm.rs +++ b/cli/compilers/wasm.rs @@ -1,11 +1,11 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +use super::compiler_worker::CompilerWorker; use crate::compilers::CompiledModule; use crate::compilers::CompiledModuleFuture; use crate::file_fetcher::SourceFile; use crate::global_state::ThreadSafeGlobalState; use crate::startup_data; use crate::state::*; -use crate::worker::Worker; use futures::FutureExt; use serde_derive::Deserialize; use serde_json; @@ -42,7 +42,7 @@ pub struct WasmCompiler { impl WasmCompiler { /// Create a new V8 worker with snapshot of WASM compiler and setup compiler's runtime. - fn setup_worker(global_state: ThreadSafeGlobalState) -> Worker { + fn setup_worker(global_state: ThreadSafeGlobalState) -> CompilerWorker { let (int, ext) = ThreadSafeState::create_channels(); let worker_state = ThreadSafeState::new(global_state.clone(), None, None, int) @@ -54,7 +54,7 @@ impl WasmCompiler { .compiler_starts .fetch_add(1, Ordering::SeqCst); - let mut worker = Worker::new( + let mut worker = CompilerWorker::new( "WASM".to_string(), startup_data::compiler_isolate_init(), worker_state, @@ -100,10 +100,9 @@ impl WasmCompiler { std::process::exit(1); } debug!("Sent message to worker"); - let maybe_msg = worker_.get_message().await.expect("not handled"); + let json_msg = worker_.get_message().await.expect("not handled"); debug!("Received message from worker"); - let json_msg = maybe_msg.unwrap(); let module_info: WasmModuleInfo = serde_json::from_slice(&json_msg).unwrap(); debug!("WASM module info: {:#?}", &module_info); |