diff options
Diffstat (limited to 'ext/timers')
-rw-r--r-- | ext/timers/benches/timers_ops.rs | 18 | ||||
-rw-r--r-- | ext/timers/lib.rs | 9 |
2 files changed, 16 insertions, 11 deletions
diff --git a/ext/timers/benches/timers_ops.rs b/ext/timers/benches/timers_ops.rs index 269d9627d..8d13d5807 100644 --- a/ext/timers/benches/timers_ops.rs +++ b/ext/timers/benches/timers_ops.rs @@ -5,12 +5,26 @@ use deno_bench_util::bencher::{benchmark_group, Bencher}; use deno_bench_util::{bench_js_async, bench_js_sync}; use deno_web::BlobStore; +struct Permissions; + +impl deno_timers::TimersPermission for Permissions { + fn allow_hrtime(&mut self) -> bool { + true + } + fn check_unstable( + &self, + _state: &deno_core::OpState, + _api_name: &'static str, + ) { + } +} + fn setup() -> Vec<Extension> { vec![ deno_webidl::init(), deno_url::init(), deno_web::init(BlobStore::default(), None), - deno_timers::init::<deno_timers::NoTimersPermission>(), + deno_timers::init::<Permissions>(), Extension::builder() .js(vec![ ("setup", @@ -21,7 +35,7 @@ fn setup() -> Vec<Extension> { ), ]) .state(|state| { - state.put(deno_timers::NoTimersPermission{}); + state.put(Permissions{}); Ok(()) }) .build() diff --git a/ext/timers/lib.rs b/ext/timers/lib.rs index 2b9948d1f..384627c57 100644 --- a/ext/timers/lib.rs +++ b/ext/timers/lib.rs @@ -31,15 +31,6 @@ pub trait TimersPermission { fn check_unstable(&self, state: &OpState, api_name: &'static str); } -pub struct NoTimersPermission; - -impl TimersPermission for NoTimersPermission { - fn allow_hrtime(&mut self) -> bool { - false - } - fn check_unstable(&self, _: &OpState, _: &'static str) {} -} - pub fn init<P: TimersPermission + 'static>() -> Extension { Extension::builder() .js(include_js_files!( |