diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2022-03-24 11:23:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 11:23:40 +0100 |
commit | 6516130b0138ef382a0588f983287fb463222086 (patch) | |
tree | f250150295fb4d7a023c1fa7d92da621ac804340 /serde_v8/src/utils.rs | |
parent | c52d72e8e115f30be32cbb2a91a4c3aa117c328c (diff) |
chore: drop src/ in bench_util & serde_v8 (#14097)
To align with conventions used in our other crates
Diffstat (limited to 'serde_v8/src/utils.rs')
-rw-r--r-- | serde_v8/src/utils.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/serde_v8/src/utils.rs b/serde_v8/src/utils.rs deleted file mode 100644 index 427ac5f2f..000000000 --- a/serde_v8/src/utils.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -use std::sync::Once; - -pub fn js_exec<'s>( - scope: &mut v8::HandleScope<'s>, - src: &str, -) -> v8::Local<'s, v8::Value> { - let code = v8::String::new(scope, src).unwrap(); - let script = v8::Script::compile(scope, code, None).unwrap(); - script.run(scope).unwrap() -} - -pub fn v8_init() { - let platform = v8::new_default_platform(0, false).make_shared(); - v8::V8::initialize_platform(platform); - v8::V8::initialize(); -} - -pub fn v8_shutdown() { - unsafe { - v8::V8::dispose(); - } - v8::V8::dispose_platform(); -} - -pub fn v8_do(f: impl FnOnce()) { - static V8_INIT: Once = Once::new(); - V8_INIT.call_once(|| { - v8_init(); - }); - f(); - // v8_shutdown(); -} |