summaryrefslogtreecommitdiff
path: root/runtime/web_worker.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-01-10 16:30:50 +0100
committerGitHub <noreply@github.com>2024-01-10 16:30:50 +0100
commitd4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (patch)
tree1a3c4936403dfaeed7c2b4c8711d75ba53ffb72e /runtime/web_worker.rs
parent0234eb23ddfe0a5ff9402610a2f3bd326c325ec6 (diff)
refactor: remove snapshotting from deno_runtime (#21794)
Closes https://github.com/denoland/deno/issues/21137
Diffstat (limited to 'runtime/web_worker.rs')
-rw-r--r--runtime/web_worker.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs
index 87841923b..11bcd328a 100644
--- a/runtime/web_worker.rs
+++ b/runtime/web_worker.rs
@@ -398,7 +398,7 @@ impl WebWorker {
});
// NOTE(bartlomieju): ordering is important here, keep it in sync with
- // `runtime/build.rs`, `runtime/worker.rs` and `runtime/snapshot.rs`!
+ // `runtime/worker.rs` and `runtime/snapshot.rs`!
let mut extensions = vec![
// Web APIs
@@ -509,8 +509,17 @@ impl WebWorker {
extensions.extend(std::mem::take(&mut options.extensions));
- #[cfg(all(feature = "include_js_files_for_snapshotting", feature = "dont_create_runtime_snapshot", not(feature = "__runtime_js_sources")))]
- options.startup_snapshot.as_ref().expect("Sources are not embedded, snapshotting was disabled and a user snapshot was not provided.");
+ #[cfg(all(
+ feature = "include_js_files_for_snapshotting",
+ not(feature = "__runtime_js_sources")
+ ))]
+ options
+ .startup_snapshot
+ .as_ref()
+ .expect("Sources are not embedded and a user snapshot was not provided.");
+
+ #[cfg(not(feature = "dont_use_runtime_snapshot"))]
+ options.startup_snapshot.as_ref().expect("A user snapshot was not provided, if you want to create a runtime without a snapshot use 'dont_use_runtime_snapshot' Cargo feature.");
// Hook up the summary metrics if the user or subcommand requested them
let (op_summary_metrics, op_metrics_factory_fn) =
@@ -526,9 +535,7 @@ impl WebWorker {
let mut js_runtime = JsRuntime::new(RuntimeOptions {
module_loader: Some(options.module_loader.clone()),
- startup_snapshot: options
- .startup_snapshot
- .or_else(crate::js::deno_isolate_init),
+ startup_snapshot: options.startup_snapshot,
source_map_getter: options.source_map_getter,
get_error_class_fn: options.get_error_class_fn,
shared_array_buffer_store: options.shared_array_buffer_store.clone(),