summaryrefslogtreecommitdiff
path: root/ext/fetch/26_fetch.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2024-01-11 07:37:25 +0900
committerGitHub <noreply@github.com>2024-01-10 15:37:25 -0700
commit515a34b4de222e35c7ade1b92614d746e73d4c2e (patch)
tree8284201fc826a33f12597959a8a8be14e0f524bd /ext/fetch/26_fetch.js
parentd4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (diff)
refactor: use `core.ensureFastOps()` (#21888)
Diffstat (limited to 'ext/fetch/26_fetch.js')
-rw-r--r--ext/fetch/26_fetch.js44
1 files changed, 23 insertions, 21 deletions
diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js
index b53013e49..154e2bcd3 100644
--- a/ext/fetch/26_fetch.js
+++ b/ext/fetch/26_fetch.js
@@ -11,10 +11,29 @@
/// <reference lib="esnext" />
import { core, primordials } from "ext:core/mod.js";
-const ops = core.ops;
const {
+ op_fetch,
op_fetch_send,
+ op_wasm_streaming_feed,
+ op_wasm_streaming_set_url,
} = core.ensureFastOps();
+const {
+ ArrayPrototypePush,
+ ArrayPrototypeSplice,
+ ArrayPrototypeFilter,
+ ArrayPrototypeIncludes,
+ Error,
+ ObjectPrototypeIsPrototypeOf,
+ Promise,
+ PromisePrototypeThen,
+ PromisePrototypeCatch,
+ SafeArrayIterator,
+ String,
+ StringPrototypeStartsWith,
+ StringPrototypeToLowerCase,
+ TypeError,
+ TypedArrayPrototypeGetSymbolToStringTag,
+} = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js";
import { byteLowerCase } from "ext:deno_web/00_infra.js";
@@ -36,23 +55,6 @@ import {
toInnerResponse,
} from "ext:deno_fetch/23_response.js";
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
-const {
- ArrayPrototypePush,
- ArrayPrototypeSplice,
- ArrayPrototypeFilter,
- ArrayPrototypeIncludes,
- Error,
- ObjectPrototypeIsPrototypeOf,
- Promise,
- PromisePrototypeThen,
- PromisePrototypeCatch,
- SafeArrayIterator,
- String,
- StringPrototypeStartsWith,
- StringPrototypeToLowerCase,
- TypeError,
- TypedArrayPrototypeGetSymbolToStringTag,
-} = primordials;
const REQUEST_BODY_HEADER_NAMES = [
"content-encoding",
@@ -147,7 +149,7 @@ async function mainFetch(req, recursive, terminator) {
}
}
- const { requestRid, cancelHandleRid } = ops.op_fetch(
+ const { requestRid, cancelHandleRid } = op_fetch(
req.method,
req.currentUrl(),
req.headerList,
@@ -448,7 +450,7 @@ function handleWasmStreaming(source, rid) {
}
// Pass the resolved URL to v8.
- ops.op_wasm_streaming_set_url(rid, res.url);
+ op_wasm_streaming_set_url(rid, res.url);
if (res.body !== null) {
// 2.6.
@@ -460,7 +462,7 @@ function handleWasmStreaming(source, rid) {
while (true) {
const { value: chunk, done } = await reader.read();
if (done) break;
- ops.op_wasm_streaming_feed(rid, chunk);
+ op_wasm_streaming_feed(rid, chunk);
}
})(),
// 2.7