summaryrefslogtreecommitdiff
path: root/cli/compilers/compiler_worker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/compilers/compiler_worker.rs')
-rw-r--r--cli/compilers/compiler_worker.rs43
1 files changed, 12 insertions, 31 deletions
diff --git a/cli/compilers/compiler_worker.rs b/cli/compilers/compiler_worker.rs
index 99138bcf0..87144c1d0 100644
--- a/cli/compilers/compiler_worker.rs
+++ b/cli/compilers/compiler_worker.rs
@@ -4,15 +4,9 @@ use crate::state::ThreadSafeState;
use crate::worker::Worker;
use crate::worker::WorkerChannels;
use deno_core;
-use deno_core::ErrBox;
use deno_core::StartupData;
-use futures::future::FutureExt;
-use std::future::Future;
use std::ops::Deref;
use std::ops::DerefMut;
-use std::pin::Pin;
-use std::task::Context;
-use std::task::Poll;
/// This worker is used to host TypeScript and WASM compilers.
///
@@ -27,7 +21,6 @@ use std::task::Poll;
///
/// TODO(bartlomieju): add support to reuse the worker - or in other
/// words support stateful TS compiler
-#[derive(Clone)]
pub struct CompilerWorker(Worker);
impl CompilerWorker {
@@ -38,27 +31,24 @@ impl CompilerWorker {
external_channels: WorkerChannels,
) -> Self {
let state_ = state.clone();
- let worker = Worker::new(name, startup_data, state_, external_channels);
+ let mut worker = Worker::new(name, startup_data, state_, external_channels);
{
- let mut isolate = worker.isolate.try_lock().unwrap();
- ops::runtime::init(&mut isolate, &state);
- ops::compiler::init(&mut isolate, &state);
- ops::web_worker::init(&mut isolate, &state);
- ops::errors::init(&mut isolate, &state);
-
+ let isolate = &mut worker.isolate;
+ ops::runtime::init(isolate, &state);
+ ops::compiler::init(isolate, &state);
+ ops::web_worker::init(isolate, &state);
+ ops::errors::init(isolate, &state);
// for compatibility with Worker scope, though unused at
// the moment
- ops::timers::init(&mut isolate, &state);
- ops::fetch::init(&mut isolate, &state);
-
+ ops::timers::init(isolate, &state);
+ ops::fetch::init(isolate, &state);
// TODO(bartlomieju): CompilerWorker should not
// depend on those ops
- ops::os::init(&mut isolate, &state);
- ops::files::init(&mut isolate, &state);
- ops::fs::init(&mut isolate, &state);
- ops::io::init(&mut isolate, &state);
+ ops::os::init(isolate, &state);
+ ops::files::init(isolate, &state);
+ ops::fs::init(isolate, &state);
+ ops::io::init(isolate, &state);
}
-
Self(worker)
}
}
@@ -75,12 +65,3 @@ impl DerefMut for CompilerWorker {
&mut self.0
}
}
-
-impl Future for CompilerWorker {
- type Output = Result<(), ErrBox>;
-
- fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
- let inner = self.get_mut();
- inner.0.poll_unpin(cx)
- }
-}