diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Cargo.toml | 2 | ||||
-rw-r--r-- | core/bindings.rs | 55 |
2 files changed, 29 insertions, 28 deletions
diff --git a/core/Cargo.toml b/core/Cargo.toml index 584745e8f..2bfd50b73 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -16,9 +16,9 @@ path = "lib.rs" anyhow = "1.0.43" futures = "0.3.16" indexmap = "1.7.0" -lazy_static = "1.4.0" libc = "0.2.106" log = "0.4.14" +once_cell = "=1.9.0" parking_lot = "0.11.1" pin-project = "1.0.7" serde = { version = "1.0.129", features = ["derive"] } diff --git a/core/bindings.rs b/core/bindings.rs index 5f1806e4b..8aed39ea9 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -17,6 +17,7 @@ use crate::PromiseId; use crate::ZeroCopyBuf; use anyhow::Error; use log::debug; +use once_cell::sync::Lazy; use serde::Deserialize; use serde::Serialize; use serde_v8::to_v8; @@ -35,71 +36,71 @@ const UNDEFINED_OP_ID_MSG: &str = This error is often caused by a typo in an op name, or not calling JsRuntime::sync_ops_cache() after JsRuntime initialization."; -lazy_static::lazy_static! { - pub static ref EXTERNAL_REFERENCES: v8::ExternalReferences = +pub static EXTERNAL_REFERENCES: Lazy<v8::ExternalReferences> = + Lazy::new(|| { v8::ExternalReferences::new(&[ v8::ExternalReference { - function: opcall_async.map_fn_to() + function: opcall_async.map_fn_to(), }, v8::ExternalReference { - function: opcall_sync.map_fn_to() + function: opcall_sync.map_fn_to(), }, v8::ExternalReference { - function: ref_op.map_fn_to() + function: ref_op.map_fn_to(), }, v8::ExternalReference { - function: unref_op.map_fn_to() + function: unref_op.map_fn_to(), }, v8::ExternalReference { - function: set_macrotask_callback.map_fn_to() + function: set_macrotask_callback.map_fn_to(), }, v8::ExternalReference { - function: set_nexttick_callback.map_fn_to() + function: set_nexttick_callback.map_fn_to(), }, v8::ExternalReference { - function: set_promise_reject_callback.map_fn_to() + function: set_promise_reject_callback.map_fn_to(), }, v8::ExternalReference { - function: set_uncaught_exception_callback.map_fn_to() + function: set_uncaught_exception_callback.map_fn_to(), }, v8::ExternalReference { - function: run_microtasks.map_fn_to() + function: run_microtasks.map_fn_to(), }, v8::ExternalReference { - function: has_tick_scheduled.map_fn_to() + function: has_tick_scheduled.map_fn_to(), }, v8::ExternalReference { - function: set_has_tick_scheduled.map_fn_to() + function: set_has_tick_scheduled.map_fn_to(), }, v8::ExternalReference { - function: eval_context.map_fn_to() + function: eval_context.map_fn_to(), }, v8::ExternalReference { - function: queue_microtask.map_fn_to() + function: queue_microtask.map_fn_to(), }, v8::ExternalReference { - function: create_host_object.map_fn_to() + function: create_host_object.map_fn_to(), }, v8::ExternalReference { - function: encode.map_fn_to() + function: encode.map_fn_to(), }, v8::ExternalReference { - function: decode.map_fn_to() + function: decode.map_fn_to(), }, v8::ExternalReference { - function: serialize.map_fn_to() + function: serialize.map_fn_to(), }, v8::ExternalReference { - function: deserialize.map_fn_to() + function: deserialize.map_fn_to(), }, v8::ExternalReference { - function: get_promise_details.map_fn_to() + function: get_promise_details.map_fn_to(), }, v8::ExternalReference { - function: get_proxy_details.map_fn_to() + function: get_proxy_details.map_fn_to(), }, v8::ExternalReference { - function: is_proxy.map_fn_to() + function: is_proxy.map_fn_to(), }, v8::ExternalReference { function: memory_usage.map_fn_to(), @@ -108,10 +109,10 @@ lazy_static::lazy_static! { function: call_console.map_fn_to(), }, v8::ExternalReference { - function: set_wasm_streaming_callback.map_fn_to() - } - ]); -} + function: set_wasm_streaming_callback.map_fn_to(), + }, + ]) + }); pub fn script_origin<'a>( s: &mut v8::HandleScope<'a>, |