summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock19
-rw-r--r--Cargo.toml2
-rw-r--r--bench_util/js_runtime.rs6
-rw-r--r--cli/tests/integration/inspector_tests.rs6
-rw-r--r--cli/tools/bench/mod.rs7
-rw-r--r--cli/tools/repl/session.rs11
-rw-r--r--cli/tools/test/mod.rs18
-rw-r--r--cli/worker.rs28
-rw-r--r--runtime/web_worker.rs9
-rw-r--r--runtime/worker.rs25
10 files changed, 60 insertions, 71 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e5c811f92..51f1abc38 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -682,6 +682,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
+name = "cooked-waker"
+version = "5.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147be55d677052dabc6b22252d5dd0fd4c29c8c27aa4f2fbef0f94aa003b406f"
+
+[[package]]
name = "core-foundation"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1128,12 +1134,13 @@ dependencies = [
[[package]]
name = "deno_core"
-version = "0.237.0"
+version = "0.238.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2ea708c221abdb5734e3c4b72075379c3046eb0ac54afa0ecb5e58509cce72c"
+checksum = "0ded8b759e4435aa0929913909dd6c482ed6042dae19c53260e1caf9d55b37a9"
dependencies = [
"anyhow",
"bytes",
+ "cooked-waker",
"deno_ops",
"deno_unsync 0.3.0",
"futures",
@@ -1559,9 +1566,9 @@ dependencies = [
[[package]]
name = "deno_ops"
-version = "0.113.0"
+version = "0.114.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5b9c0f6360795fb625774a8b5955c87c470c43159670cf5d2052df5ce9d84bc"
+checksum = "168a929496191fdd8e91f898c8454429df4d5489597777d89f47897f6a37da6b"
dependencies = [
"proc-macro-rules",
"proc-macro2",
@@ -5084,9 +5091,9 @@ dependencies = [
[[package]]
name = "serde_v8"
-version = "0.146.0"
+version = "0.147.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78309bd1ec4d14d165f271e203bdc45ad5bf45525da57bb70901f57942f6c0f7"
+checksum = "2af950d83e1c70b762d48fa7a869d6db9a4f191548dfd666fa4e62f2229e1dce"
dependencies = [
"bytes",
"derive_more",
diff --git a/Cargo.toml b/Cargo.toml
index bc0bcf5b6..ac8206061 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,7 +41,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
deno_ast = { version = "0.31.6", features = ["transpiling"] }
-deno_core = { version = "0.237.0" }
+deno_core = { version = "0.238.0" }
deno_runtime = { version = "0.135.0", path = "./runtime" }
napi_sym = { version = "0.57.0", path = "./cli/napi/sym" }
diff --git a/bench_util/js_runtime.rs b/bench_util/js_runtime.rs
index a12e6ca62..3de4bf787 100644
--- a/bench_util/js_runtime.rs
+++ b/bench_util/js_runtime.rs
@@ -3,6 +3,7 @@ use bencher::Bencher;
use deno_core::v8;
use deno_core::Extension;
use deno_core::JsRuntime;
+use deno_core::PollEventLoopOptions;
use deno_core::RuntimeOptions;
use crate::profiling::is_profiling;
@@ -116,5 +117,8 @@ pub fn bench_js_async_with(
async fn inner_async(src: &'static str, runtime: &mut JsRuntime) {
runtime.execute_script_static("inner_loop", src).unwrap();
- runtime.run_event_loop(false).await.unwrap();
+ runtime
+ .run_event_loop(PollEventLoopOptions::default())
+ .await
+ .unwrap();
}
diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs
index 36d469196..41c126cdb 100644
--- a/cli/tests/integration/inspector_tests.rs
+++ b/cli/tests/integration/inspector_tests.rs
@@ -869,7 +869,11 @@ async fn inspector_break_on_first_line_in_test() {
.await;
assert_starts_with!(&tester.stdout_line(), "running 1 test from");
- assert!(&tester.stdout_line().contains("basic test ... ok"));
+ let line = tester.stdout_line();
+ assert!(
+ &line.contains("basic test ... ok"),
+ "Missing content: {line}"
+ );
tester.child.kill().unwrap();
tester.child.wait().unwrap();
diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs
index 57d148463..ed6f10689 100644
--- a/cli/tools/bench/mod.rs
+++ b/cli/tools/bench/mod.rs
@@ -31,6 +31,7 @@ use deno_core::unsync::spawn;
use deno_core::unsync::spawn_blocking;
use deno_core::v8;
use deno_core::ModuleSpecifier;
+use deno_core::PollEventLoopOptions;
use deno_runtime::permissions::Permissions;
use deno_runtime::permissions::PermissionsContainer;
use deno_runtime::tokio_util::create_and_run_current_thread;
@@ -254,7 +255,11 @@ async fn bench_specifier_inner(
}))?;
for (desc, function) in benchmarks {
sender.send(BenchEvent::Wait(desc.id))?;
- let result = worker.js_runtime.call_and_await(&function).await?;
+ let call = worker.js_runtime.call(&function);
+ let result = worker
+ .js_runtime
+ .with_event_loop_promise(call, PollEventLoopOptions::default())
+ .await?;
let scope = &mut worker.js_runtime.handle_scope();
let result = v8::Local::new(scope, result);
let result = serde_v8::from_v8::<BenchResult>(scope, result)?;
diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs
index 22dd30caf..624d7dafe 100644
--- a/cli/tools/repl/session.rs
+++ b/cli/tools/repl/session.rs
@@ -202,14 +202,11 @@ impl ReplSession {
worker
.js_runtime
- .with_event_loop(
+ .with_event_loop_future(
session
.post_message::<()>("Runtime.enable", None)
.boxed_local(),
- PollEventLoopOptions {
- wait_for_inspector: false,
- ..Default::default()
- },
+ PollEventLoopOptions::default(),
)
.await?;
@@ -298,14 +295,14 @@ impl ReplSession {
self
.worker
.js_runtime
- .with_event_loop(
+ .with_event_loop_future(
self.session.post_message(method, params).boxed_local(),
PollEventLoopOptions {
- wait_for_inspector: false,
// NOTE(bartlomieju): this is an important bit; we don't want to pump V8
// message loop here, so that GC won't run. Otherwise, the resulting
// object might be GC'ed before we have a chance to inspect it.
pump_v8_message_loop: false,
+ ..Default::default()
},
)
.await
diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs
index 840c5ac87..fe1d6cc9c 100644
--- a/cli/tools/test/mod.rs
+++ b/cli/tools/test/mod.rs
@@ -498,12 +498,9 @@ async fn test_specifier_inner(
if let Some(coverage_collector) = coverage_collector.as_mut() {
worker
.js_runtime
- .with_event_loop(
+ .with_event_loop_future(
coverage_collector.stop_collecting().boxed_local(),
- PollEventLoopOptions {
- wait_for_inspector: false,
- ..Default::default()
- },
+ PollEventLoopOptions::default(),
)
.await?;
}
@@ -574,11 +571,18 @@ pub async fn run_tests_for_worker(
// but haven't responded to settle.
let waker = noop_waker();
let mut cx = Context::from_waker(&waker);
- let _ = worker.js_runtime.poll_event_loop(&mut cx, false);
+ let _ = worker
+ .js_runtime
+ .poll_event_loop(&mut cx, PollEventLoopOptions::default());
}
let earlier = SystemTime::now();
- let result = match worker.js_runtime.call_and_await(&function).await {
+ let call = worker.js_runtime.call(&function);
+ let result = match worker
+ .js_runtime
+ .with_event_loop_promise(call, PollEventLoopOptions::default())
+ .await
+ {
Ok(r) => r,
Err(error) => {
if error.is::<JsError>() {
diff --git a/cli/worker.rs b/cli/worker.rs
index 22e534e1d..2f0016581 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -211,12 +211,9 @@ impl CliMainWorker {
self
.worker
.js_runtime
- .with_event_loop(
+ .with_event_loop_future(
coverage_collector.stop_collecting().boxed_local(),
- PollEventLoopOptions {
- wait_for_inspector: false,
- ..Default::default()
- },
+ PollEventLoopOptions::default(),
)
.await?;
}
@@ -224,12 +221,9 @@ impl CliMainWorker {
self
.worker
.js_runtime
- .with_event_loop(
+ .with_event_loop_future(
hmr_runner.stop().boxed_local(),
- PollEventLoopOptions {
- wait_for_inspector: false,
- ..Default::default()
- },
+ PollEventLoopOptions::default(),
)
.await?;
}
@@ -340,12 +334,9 @@ impl CliMainWorker {
self
.worker
.js_runtime
- .with_event_loop(
+ .with_event_loop_future(
coverage_collector.start_collecting().boxed_local(),
- PollEventLoopOptions {
- wait_for_inspector: false,
- ..Default::default()
- },
+ PollEventLoopOptions::default(),
)
.await?;
Ok(Some(coverage_collector))
@@ -371,12 +362,9 @@ impl CliMainWorker {
self
.worker
.js_runtime
- .with_event_loop(
+ .with_event_loop_future(
hmr_runner.start().boxed_local(),
- PollEventLoopOptions {
- wait_for_inspector: false,
- ..Default::default()
- },
+ PollEventLoopOptions::default(),
)
.await?;
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<Result<(), AnyError>> {
- 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()
})