summaryrefslogtreecommitdiff
path: root/ext/web/timers.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-10-05 14:34:38 +0200
committerGitHub <noreply@github.com>2023-10-05 14:34:38 +0200
commit5d98a544b421e2b0bc3f99318fe44d1fed6d95d9 (patch)
tree871b510abadb2746a532ba7a13988f7dc437d932 /ext/web/timers.rs
parent551a08145098e95022efb778308d677db60a67cc (diff)
refactor: rewrite several extension ops to op2 (#20457)
Rewrites following extensions: - `ext/web` - `ext/url` - `ext/webstorage` - `ext/io` --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'ext/web/timers.rs')
-rw-r--r--ext/web/timers.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/web/timers.rs b/ext/web/timers.rs
index 6e0759a98..17b46c2be 100644
--- a/ext/web/timers.rs
+++ b/ext/web/timers.rs
@@ -5,6 +5,7 @@
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;
use deno_core::OpState;
@@ -27,8 +28,8 @@ pub type StartTime = Instant;
// since the start time of the deno runtime.
// If the High precision flag is not set, the
// nanoseconds are rounded on 2ms.
-#[op(fast)]
-pub fn op_now<TP>(state: &mut OpState, buf: &mut [u8])
+#[op2(fast)]
+pub fn op_now<TP>(state: &mut OpState, #[buffer] buf: &mut [u8])
where
TP: TimersPermission + 'static,
{
@@ -68,7 +69,8 @@ impl Resource for TimerHandle {
/// Creates a [`TimerHandle`] resource that can be used to cancel invocations of
/// [`op_sleep`].
-#[op]
+#[op2(fast)]
+#[smi]
pub fn op_timer_handle(state: &mut OpState) -> ResourceId {
state
.resource_table