From d4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 10 Jan 2024 16:30:50 +0100 Subject: refactor: remove snapshotting from deno_runtime (#21794) Closes https://github.com/denoland/deno/issues/21137 --- runtime/web_worker.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'runtime/web_worker.rs') 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(), -- cgit v1.2.3