summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index 24397b6bf..3b09714d5 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -83,6 +83,15 @@ pub trait HmrRunner: Send + Sync {
async fn run(&mut self) -> Result<(), AnyError>;
}
+pub trait CliCodeCache: code_cache::CodeCache {
+ /// Gets if the code cache is still enabled.
+ fn enabled(&self) -> bool {
+ true
+ }
+
+ fn as_code_cache(self: Arc<Self>) -> Arc<dyn code_cache::CodeCache>;
+}
+
#[async_trait::async_trait(?Send)]
pub trait CoverageCollector: Send + Sync {
async fn start_collecting(&mut self) -> Result<(), AnyError>;
@@ -127,7 +136,7 @@ pub struct CliMainWorkerOptions {
struct SharedWorkerState {
blob_store: Arc<BlobStore>,
broadcast_channel: InMemoryBroadcastChannel,
- code_cache: Option<Arc<dyn code_cache::CodeCache>>,
+ code_cache: Option<Arc<dyn CliCodeCache>>,
compiled_wasm_module_store: CompiledWasmModuleStore,
feature_checker: Arc<FeatureChecker>,
fs: Arc<dyn deno_fs::FileSystem>,
@@ -393,7 +402,7 @@ impl CliMainWorkerFactory {
#[allow(clippy::too_many_arguments)]
pub fn new(
blob_store: Arc<BlobStore>,
- code_cache: Option<Arc<dyn code_cache::CodeCache>>,
+ code_cache: Option<Arc<dyn CliCodeCache>>,
feature_checker: Arc<FeatureChecker>,
fs: Arc<dyn deno_fs::FileSystem>,
maybe_file_watcher_communicator: Option<Arc<WatcherCommunicator>>,
@@ -554,7 +563,7 @@ impl CliMainWorkerFactory {
),
feature_checker,
permissions,
- v8_code_cache: shared.code_cache.clone(),
+ v8_code_cache: shared.code_cache.clone().map(|c| c.as_code_cache()),
};
let options = WorkerOptions {