summaryrefslogtreecommitdiff
path: root/ext/web
diff options
context:
space:
mode:
Diffstat (limited to 'ext/web')
-rw-r--r--ext/web/lib.rs24
-rw-r--r--ext/web/stream_resource.rs2
-rw-r--r--ext/web/timers.rs7
3 files changed, 15 insertions, 18 deletions
diff --git a/ext/web/lib.rs b/ext/web/lib.rs
index f4789123b..4e0d97f5c 100644
--- a/ext/web/lib.rs
+++ b/ext/web/lib.rs
@@ -10,9 +10,7 @@ mod timers;
use deno_core::error::range_error;
use deno_core::error::type_error;
use deno_core::error::AnyError;
-use deno_core::op;
use deno_core::op2;
-use deno_core::serde_v8;
use deno_core::url::Url;
use deno_core::v8;
use deno_core::ByteString;
@@ -366,14 +364,14 @@ impl Resource for TextDecoderResource {
}
}
-#[op(v8)]
-fn op_encoding_encode_into_fallback(
+#[op2(fast(op_encoding_encode_into_fast))]
+fn op_encoding_encode_into(
scope: &mut v8::HandleScope,
- input: serde_v8::Value,
- buffer: &mut [u8],
- out_buf: &mut [u32],
+ input: v8::Local<v8::Value>,
+ #[buffer] buffer: &mut [u8],
+ #[buffer] out_buf: &mut [u32],
) -> Result<(), AnyError> {
- let s = v8::Local::<v8::String>::try_from(input.v8_value)?;
+ let s = v8::Local::<v8::String>::try_from(input)?;
let mut nchars = 0;
out_buf[1] = s.write_utf8(
@@ -387,11 +385,11 @@ fn op_encoding_encode_into_fallback(
Ok(())
}
-#[op(fast, slow = op_encoding_encode_into_fallback)]
-fn op_encoding_encode_into(
- input: Cow<'_, str>,
- buffer: &mut [u8],
- out_buf: &mut [u32],
+#[op2(fast)]
+fn op_encoding_encode_into_fast(
+ #[string] input: Cow<'_, str>,
+ #[buffer] buffer: &mut [u8],
+ #[buffer] out_buf: &mut [u32],
) {
// Since `input` is already UTF-8, we can simply find the last UTF-8 code
// point boundary from input that fits in `buffer`, and copy the bytes up to
diff --git a/ext/web/stream_resource.rs b/ext/web/stream_resource.rs
index b35d4c302..212f1e956 100644
--- a/ext/web/stream_resource.rs
+++ b/ext/web/stream_resource.rs
@@ -491,7 +491,7 @@ pub fn op_readable_stream_resource_write_buf(
/// Write to the channel synchronously, returning 0 if the channel was closed, 1 if we wrote
/// successfully, 2 if the channel was full and we need to block.
-#[op2]
+#[op2(fast)]
pub fn op_readable_stream_resource_write_sync(
sender: *const c_void,
#[buffer] buffer: JsBuffer,
diff --git a/ext/web/timers.rs b/ext/web/timers.rs
index 67beee599..7c83e8f37 100644
--- a/ext/web/timers.rs
+++ b/ext/web/timers.rs
@@ -4,7 +4,6 @@
use crate::hr_timer_lock::hr_timer_lock;
use deno_core::error::AnyError;
-use deno_core::op;
use deno_core::op2;
use deno_core::CancelFuture;
use deno_core::CancelHandle;
@@ -80,11 +79,11 @@ pub fn op_timer_handle(state: &mut OpState) -> ResourceId {
/// [`TimerHandle`] resource given by `rid` has been canceled.
///
/// If the timer is canceled, this returns `false`. Otherwise, it returns `true`.
-#[op(deferred)]
+#[op2(async(deferred), fast)]
pub async fn op_sleep(
state: Rc<RefCell<OpState>>,
- millis: u64,
- rid: ResourceId,
+ #[number] millis: u64,
+ #[smi] rid: ResourceId,
) -> Result<bool, AnyError> {
let handle = state.borrow().resource_table.get::<TimerHandle>(rid)?;