summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2022-06-24 10:04:45 -0300
committerGitHub <noreply@github.com>2022-06-24 15:04:45 +0200
commitfd5a12d7e25dc53238e2bbcffe970e646c1035f3 (patch)
tree251c3ec1a46067b02ef30fb48349962973016bf3 /runtime/worker.rs
parentd39094913e91e5193f63459d9c5ca6ddc7779477 (diff)
refactor(snapshots): to their own crate (#14794)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r--runtime/worker.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs
index e46b5c75f..acb50dc30 100644
--- a/runtime/worker.rs
+++ b/runtime/worker.rs
@@ -81,6 +81,7 @@ pub struct WorkerOptions {
pub shared_array_buffer_store: Option<SharedArrayBufferStore>,
pub compiled_wasm_module_store: Option<CompiledWasmModuleStore>,
pub stdio: Stdio,
+ pub startup_snapshot: Option<deno_core::Snapshot>,
}
impl MainWorker {
@@ -168,6 +169,8 @@ impl MainWorker {
ops::tty::init(),
deno_http::init(),
ops::http::init(),
+ // Runtime JS
+ js::init(),
// Permissions ext (worker specific state)
perm_ext,
];
@@ -175,7 +178,7 @@ impl MainWorker {
let mut js_runtime = JsRuntime::new(RuntimeOptions {
module_loader: Some(options.module_loader.clone()),
- startup_snapshot: Some(js::deno_isolate_init()),
+ startup_snapshot: options.startup_snapshot.take(),
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(),
@@ -411,6 +414,7 @@ mod tests {
shared_array_buffer_store: None,
compiled_wasm_module_store: None,
stdio: Default::default(),
+ startup_snapshot: None,
};
MainWorker::bootstrap_from_options(main_module, permissions, options)