From 76a6ea57753be420398d3eba8f313a6c98eab8c3 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Wed, 13 Dec 2023 08:07:26 -0700 Subject: refactor(cli): update to new deno_core promise/call methods (#21519) --- runtime/web_worker.rs | 9 +++------ runtime/worker.rs | 25 ++++--------------------- 2 files changed, 7 insertions(+), 27 deletions(-) (limited to 'runtime') diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index b669b5c2a..41e6ca4fe 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -691,7 +691,7 @@ impl WebWorker { maybe_result } - event_loop_result = self.js_runtime.run_event_loop(false) => { + event_loop_result = self.js_runtime.run_event_loop(PollEventLoopOptions::default()) => { event_loop_result?; receiver.await } @@ -706,10 +706,7 @@ impl WebWorker { id: ModuleId, ) -> Result<(), AnyError> { let mut receiver = self.js_runtime.mod_evaluate(id); - let poll_options = PollEventLoopOptions { - wait_for_inspector: false, - ..Default::default() - }; + let poll_options = PollEventLoopOptions::default(); tokio::select! { biased; @@ -741,7 +738,7 @@ impl WebWorker { self.internal_handle.terminate_waker.register(cx.waker()); - match self.js_runtime.poll_event_loop2(cx, poll_options) { + match self.js_runtime.poll_event_loop(cx, poll_options) { Poll::Ready(r) => { // If js ended because we are terminating, just return Ok if self.internal_handle.terminate_if_needed() { diff --git a/runtime/worker.rs b/runtime/worker.rs index 0bfb9305c..94b0d9606 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -3,8 +3,6 @@ use std::rc::Rc; use std::sync::atomic::AtomicI32; use std::sync::atomic::Ordering::Relaxed; use std::sync::Arc; -use std::task::Context; -use std::task::Poll; use std::time::Duration; use std::time::Instant; @@ -561,10 +559,9 @@ impl MainWorker { ) -> Result<(), AnyError> { match tokio::time::timeout( duration, - self.js_runtime.run_event_loop2(PollEventLoopOptions { - wait_for_inspector: false, - pump_v8_message_loop: true, - }), + self + .js_runtime + .run_event_loop(PollEventLoopOptions::default()), ) .await { @@ -613,27 +610,13 @@ impl MainWorker { self.js_runtime.inspector().borrow().create_local_session() } - pub fn poll_event_loop( - &mut self, - cx: &mut Context, - wait_for_inspector: bool, - ) -> Poll> { - self.js_runtime.poll_event_loop2( - cx, - deno_core::PollEventLoopOptions { - wait_for_inspector, - ..Default::default() - }, - ) - } - pub async fn run_event_loop( &mut self, wait_for_inspector: bool, ) -> Result<(), AnyError> { self .js_runtime - .run_event_loop2(deno_core::PollEventLoopOptions { + .run_event_loop(deno_core::PollEventLoopOptions { wait_for_inspector, ..Default::default() }) -- cgit v1.2.3