From 489cafd5ba4ecd3fc9d8fa393b17e50015ec4707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 6 Mar 2023 12:37:46 -0400 Subject: refactor: use v8::String::new_external_onebyte_static where appropriate (#18051) --- runtime/web_worker.rs | 7 +++++-- runtime/worker.rs | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index ffafbc1d3..06b594dd1 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -500,13 +500,16 @@ impl WebWorker { let scope = &mut js_runtime.handle_scope(); let context_local = v8::Local::new(scope, context); let global_obj = context_local.global(scope); - let bootstrap_str = v8::String::new(scope, "bootstrap").unwrap(); + let bootstrap_str = + v8::String::new_external_onebyte_static(scope, b"bootstrap").unwrap(); let bootstrap_ns: v8::Local = global_obj .get(scope, bootstrap_str.into()) .unwrap() .try_into() .unwrap(); - let main_runtime_str = v8::String::new(scope, "workerRuntime").unwrap(); + let main_runtime_str = + v8::String::new_external_onebyte_static(scope, b"workerRuntime") + .unwrap(); let bootstrap_fn = bootstrap_ns.get(scope, main_runtime_str.into()).unwrap(); let bootstrap_fn = diff --git a/runtime/worker.rs b/runtime/worker.rs index 8fa17a7f5..66497489d 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -321,13 +321,15 @@ impl MainWorker { let scope = &mut js_runtime.handle_scope(); let context_local = v8::Local::new(scope, context); let global_obj = context_local.global(scope); - let bootstrap_str = v8::String::new(scope, "bootstrap").unwrap(); + let bootstrap_str = + v8::String::new_external_onebyte_static(scope, b"bootstrap").unwrap(); let bootstrap_ns: v8::Local = global_obj .get(scope, bootstrap_str.into()) .unwrap() .try_into() .unwrap(); - let main_runtime_str = v8::String::new(scope, "mainRuntime").unwrap(); + let main_runtime_str = + v8::String::new_external_onebyte_static(scope, b"mainRuntime").unwrap(); let bootstrap_fn = bootstrap_ns.get(scope, main_runtime_str.into()).unwrap(); let bootstrap_fn = -- cgit v1.2.3