diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-01-10 16:30:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 16:30:50 +0100 |
commit | d4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (patch) | |
tree | 1a3c4936403dfaeed7c2b4c8711d75ba53ffb72e /runtime/worker.rs | |
parent | 0234eb23ddfe0a5ff9402610a2f3bd326c325ec6 (diff) |
refactor: remove snapshotting from deno_runtime (#21794)
Closes https://github.com/denoland/deno/issues/21137
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs index 2a838c0f6..1fac28c6a 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -308,7 +308,7 @@ impl MainWorker { }); // NOTE(bartlomieju): ordering is important here, keep it in sync with - // `runtime/build.rs`, `runtime/web_worker.rs` and `runtime/snapshot.rs`! + // `runtime/web_worker.rs` and `runtime/snapshot.rs`! let mut extensions = vec![ // Web APIs deno_webidl::deno_webidl::init_ops_and_esm(), @@ -428,8 +428,17 @@ impl MainWorker { 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."); let has_notified_of_inspector_disconnect = AtomicBool::new(false); let wait_for_inspector_disconnect_callback = Box::new(move || { @@ -442,9 +451,7 @@ impl MainWorker { 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, create_params: options.create_params, source_map_getter: options.source_map_getter, skip_op_registration: options.skip_op_registration, |