diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/js/01_async_context.js | 45 | ||||
-rw-r--r-- | runtime/ops/runtime.rs | 11 | ||||
-rw-r--r-- | runtime/shared.rs | 1 |
3 files changed, 1 insertions, 56 deletions
diff --git a/runtime/js/01_async_context.js b/runtime/js/01_async_context.js deleted file mode 100644 index 9c0236fbe..000000000 --- a/runtime/js/01_async_context.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -import { primordials } from "ext:core/mod.js"; -import { op_get_extras_binding_object } from "ext:core/ops"; - -const { - SafeWeakMap, -} = primordials; - -const { - getContinuationPreservedEmbedderData, - setContinuationPreservedEmbedderData, -} = op_get_extras_binding_object(); - -let counter = 0; - -export const getAsyncContext = getContinuationPreservedEmbedderData; -export const setAsyncContext = setContinuationPreservedEmbedderData; - -export class AsyncVariable { - #id = counter++; - #data = new SafeWeakMap(); - - enter(value) { - const previousContextMapping = getAsyncContext(); - const entry = { id: this.#id }; - const asyncContextMapping = { - __proto__: null, - ...previousContextMapping, - [this.#id]: entry, - }; - this.#data.set(entry, value); - setAsyncContext(asyncContextMapping); - return previousContextMapping; - } - - get() { - const current = getAsyncContext(); - const entry = current?.[this.#id]; - if (entry) { - return this.#data.get(entry); - } - return undefined; - } -} diff --git a/runtime/ops/runtime.rs b/runtime/ops/runtime.rs index b52a23f30..306e6ce8f 100644 --- a/runtime/ops/runtime.rs +++ b/runtime/ops/runtime.rs @@ -2,14 +2,13 @@ use deno_core::error::AnyError; use deno_core::op2; -use deno_core::v8; use deno_core::ModuleSpecifier; use deno_core::OpState; use deno_permissions::PermissionsContainer; deno_core::extension!( deno_runtime, - ops = [op_main_module, op_ppid, op_get_extras_binding_object], + ops = [op_main_module, op_ppid], options = { main_module: ModuleSpecifier }, state = |state, options| { state.put::<ModuleSpecifier>(options.main_module); @@ -95,11 +94,3 @@ pub fn op_ppid() -> i64 { parent_id().into() } } - -#[op2] -pub fn op_get_extras_binding_object<'a>( - scope: &mut v8::HandleScope<'a>, -) -> v8::Local<'a, v8::Value> { - let context = scope.get_current_context(); - context.get_extras_binding_object(scope).into() -} diff --git a/runtime/shared.rs b/runtime/shared.rs index 185cbc0a9..1b2136c63 100644 --- a/runtime/shared.rs +++ b/runtime/shared.rs @@ -38,7 +38,6 @@ extension!(runtime, dir "js", "01_errors.js", "01_version.ts", - "01_async_context.js", "06_util.js", "10_permissions.js", "11_workers.js", |