summaryrefslogtreecommitdiff
path: root/runtime/web_worker.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-03-17 16:15:27 -0600
committerGitHub <noreply@github.com>2023-03-17 22:15:27 +0000
commit3487fde236d0852a8b0672c293fa41a741f471e8 (patch)
treeaf466368147a08b787080446319a3a46a60ee37d /runtime/web_worker.rs
parente55b448730160a6e4df9815a268d4049ac89deab (diff)
perf(core) Reduce copying and cloning in extension initialization (#18252)
Follow-up to #18210: * we are passing the generated `cfg` object into the state function rather than passing individual config fields * reduce cloning dramatically by making the state_fn `FnOnce` * `take` for `ExtensionBuilder` to avoid more unnecessary copies * renamed `config` to `options`
Diffstat (limited to 'runtime/web_worker.rs')
-rw-r--r--runtime/web_worker.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs
index a78e7078b..1a8d02a1d 100644
--- a/runtime/web_worker.rs
+++ b/runtime/web_worker.rs
@@ -369,15 +369,15 @@ impl WebWorker {
mut options: WebWorkerOptions,
) -> (Self, SendableWebWorkerHandle) {
deno_core::extension!(deno_permissions_web_worker,
- config = {
+ options = {
permissions: PermissionsContainer,
unstable: bool,
enable_testing_features: bool,
},
- state = |state, permissions, unstable, enable_testing_features| {
- state.put::<PermissionsContainer>(permissions);
- state.put(ops::UnstableChecker { unstable });
- state.put(ops::TestingFeaturesEnabled(enable_testing_features));
+ state = |state, options| {
+ state.put::<PermissionsContainer>(options.permissions);
+ state.put(ops::UnstableChecker { unstable: options.unstable });
+ state.put(ops::TestingFeaturesEnabled(options.enable_testing_features));
},
);
@@ -432,7 +432,7 @@ impl WebWorker {
deno_tls::deno_tls::init_ops(),
deno_napi::deno_napi::init_ops::<PermissionsContainer>(),
deno_http::deno_http::init_ops(),
- deno_io::deno_io::init_ops(Rc::new(RefCell::new(Some(options.stdio)))),
+ deno_io::deno_io::init_ops(Some(options.stdio)),
deno_fs::deno_fs::init_ops::<PermissionsContainer>(unstable),
deno_flash::deno_flash::init_ops::<PermissionsContainer>(unstable),
deno_node::deno_node_loading::init_ops::<PermissionsContainer>(