summaryrefslogtreecommitdiff
path: root/ext/node/polyfills
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-11-09 13:57:26 -0700
committerGitHub <noreply@github.com>2023-11-09 13:57:26 -0700
commit9010b8df53cd37f0410e08c43a194667974686a2 (patch)
tree97c13d696ba1216e74b745f5ce1b25ed34afa2cd /ext/node/polyfills
parentc4029f6af22b373bf22383453cb4e2159f3b5b72 (diff)
perf: remove knowledge of promise IDs from deno (#21132)
We can move all promise ID knowledge to deno_core, allowing us to better experiment with promise implementation in deno_core. `{un,}refOpPromise(promise)` is equivalent to `{un,}refOp(promise[promiseIdSymbol])`
Diffstat (limited to 'ext/node/polyfills')
-rw-r--r--ext/node/polyfills/http2.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts
index 9ebdabb79..50d85f694 100644
--- a/ext/node/polyfills/http2.ts
+++ b/ext/node/polyfills/http2.ts
@@ -68,7 +68,7 @@ const kDenoResponse = Symbol("kDenoResponse");
const kDenoRid = Symbol("kDenoRid");
const kDenoClientRid = Symbol("kDenoClientRid");
const kDenoConnRid = Symbol("kDenoConnRid");
-const kPollConnPromiseId = Symbol("kPollConnPromiseId");
+const kPollConnPromise = Symbol("kPollConnPromise");
const STREAM_FLAGS_PENDING = 0x0;
const STREAM_FLAGS_READY = 0x1;
@@ -364,7 +364,7 @@ export class ClientHttp2Session extends Http2Session {
this[kPendingRequestCalls] = null;
this[kDenoClientRid] = undefined;
this[kDenoConnRid] = undefined;
- this[kPollConnPromiseId] = undefined;
+ this[kPollConnPromise] = undefined;
socket.on("error", socketOnError);
socket.on("close", socketOnClose);
@@ -394,8 +394,7 @@ export class ClientHttp2Session extends Http2Session {
"op_http2_poll_client_connection",
this[kDenoConnRid],
);
- this[kPollConnPromiseId] =
- promise[Symbol.for("Deno.core.internalPromiseId")];
+ this[kPollConnPromise] = promise;
if (!this.#refed) {
this.unref();
}
@@ -410,15 +409,15 @@ export class ClientHttp2Session extends Http2Session {
ref() {
this.#refed = true;
- if (this[kPollConnPromiseId]) {
- core.refOp(this[kPollConnPromiseId]);
+ if (this[kPollConnPromise]) {
+ core.refOpPromise(this[kPollConnPromise]);
}
}
unref() {
this.#refed = false;
- if (this[kPollConnPromiseId]) {
- core.unrefOp(this[kPollConnPromiseId]);
+ if (this[kPollConnPromise]) {
+ core.unrefOpPromise(this[kPollConnPromise]);
}
}