diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-28 10:27:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 10:27:17 +0200 |
commit | 795ecfa146c7b6c49be4b11f7064b2b5500296ff (patch) | |
tree | bbb0ad501db4abafa8dc2a6287162a13c231bd9c /runtime/web_worker.rs | |
parent | 86c3c4f34397a29c2bf1847bddfea562a2369a4f (diff) |
refactor(runtime): manual serialization of bootstrap data (#18448)
This commit changes how data required to bootstrap main and worker
runtime is serialized.
Instead of relying on serde_v8 and using JSON object,
we're doing manual serialization to a "v8::Array". This limits number
of V8 strings that need to be serialized by 16.
It also made it clear that some data could be obtained during
snapshotting instead of during bootstrap.
Diffstat (limited to 'runtime/web_worker.rs')
-rw-r--r-- | runtime/web_worker.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index ab06ab649..b50e91610 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -556,8 +556,7 @@ impl WebWorker { // WebWorkers can have empty string as name. { let scope = &mut self.js_runtime.handle_scope(); - let options_v8 = - deno_core::serde_v8::to_v8(scope, options.as_json()).unwrap(); + let args = options.as_v8(scope); let bootstrap_fn = self.bootstrap_fn_global.take().unwrap(); let bootstrap_fn = v8::Local::new(scope, bootstrap_fn); let undefined = v8::undefined(scope); @@ -568,7 +567,7 @@ impl WebWorker { .unwrap() .into(); bootstrap_fn - .call(scope, undefined.into(), &[options_v8, name_str, id_str]) + .call(scope, undefined.into(), &[args.into(), name_str, id_str]) .unwrap(); } // TODO(bartlomieju): this could be done using V8 API, without calling `execute_script`. |