mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
refactor: remove GlobalState::compile_lock (#7598)
This commit is contained in:
parent
0a9d7e4e39
commit
d1b88510cf
1 changed files with 0 additions and 17 deletions
|
@ -19,7 +19,6 @@ use std::env;
|
|||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use tokio::sync::Mutex as AsyncMutex;
|
||||
|
||||
pub fn exit_unstable(api_name: &str) {
|
||||
eprintln!(
|
||||
|
@ -43,7 +42,6 @@ pub struct GlobalState {
|
|||
pub lockfile: Option<Mutex<Lockfile>>,
|
||||
pub compiler_starts: AtomicUsize,
|
||||
pub maybe_import_map: Option<ImportMap>,
|
||||
compile_lock: AsyncMutex<()>,
|
||||
}
|
||||
|
||||
impl GlobalState {
|
||||
|
@ -96,7 +94,6 @@ impl GlobalState {
|
|||
lockfile,
|
||||
maybe_import_map,
|
||||
compiler_starts: AtomicUsize::new(0),
|
||||
compile_lock: AsyncMutex::new(()),
|
||||
};
|
||||
Ok(Arc::new(global_state))
|
||||
}
|
||||
|
@ -116,10 +113,6 @@ impl GlobalState {
|
|||
) -> Result<(), AnyError> {
|
||||
let module_specifier = module_specifier.clone();
|
||||
|
||||
// TODO(ry) Try to lift compile_lock as high up in the call stack for
|
||||
// sanity.
|
||||
let compile_lock = self.compile_lock.lock().await;
|
||||
|
||||
let mut module_graph_loader = ModuleGraphLoader::new(
|
||||
self.file_fetcher.clone(),
|
||||
maybe_import_map,
|
||||
|
@ -180,8 +173,6 @@ impl GlobalState {
|
|||
g.write()?;
|
||||
}
|
||||
|
||||
drop(compile_lock);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -195,17 +186,11 @@ impl GlobalState {
|
|||
module_specifier: ModuleSpecifier,
|
||||
_maybe_referrer: Option<ModuleSpecifier>,
|
||||
) -> Result<CompiledModule, AnyError> {
|
||||
let module_specifier = module_specifier.clone();
|
||||
|
||||
let out = self
|
||||
.file_fetcher
|
||||
.fetch_cached_source_file(&module_specifier, Permissions::allow_all())
|
||||
.expect("Cached source file doesn't exist");
|
||||
|
||||
// TODO(ry) Try to lift compile_lock as high up in the call stack for
|
||||
// sanity.
|
||||
let compile_lock = self.compile_lock.lock().await;
|
||||
|
||||
// Check if we need to compile files
|
||||
let was_compiled = match out.media_type {
|
||||
MediaType::TypeScript | MediaType::TSX | MediaType::JSX => true,
|
||||
|
@ -237,8 +222,6 @@ impl GlobalState {
|
|||
}
|
||||
};
|
||||
|
||||
drop(compile_lock);
|
||||
|
||||
Ok(compiled_module)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue