mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 05:04:48 +00:00
refactor(core): JsRuntime is not a Future (#7855)
This commit rewrites deno_core::JsRuntime to not implement Future trait. Instead there are two separate methods: - JsRuntime::poll_event_loop() - does single tick of event loop - JsRuntime::run_event_loop() - runs event loop to completion
This commit is contained in:
parent
8bd7c936f9
commit
d8879feb8c
6 changed files with 73 additions and 66 deletions
|
@ -75,7 +75,6 @@ pub fn get_declaration() -> PathBuf {
|
|||
mod tests {
|
||||
use deno_core::JsRuntime;
|
||||
use futures::future::lazy;
|
||||
use futures::future::FutureExt;
|
||||
use futures::task::Context;
|
||||
use futures::task::Poll;
|
||||
|
||||
|
@ -102,7 +101,7 @@ mod tests {
|
|||
include_str!("abort_controller_test.js"),
|
||||
)
|
||||
.unwrap();
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) {
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_event_loop(&mut cx) {
|
||||
unreachable!();
|
||||
}
|
||||
});
|
||||
|
@ -115,7 +114,7 @@ mod tests {
|
|||
isolate
|
||||
.execute("event_test.js", include_str!("event_test.js"))
|
||||
.unwrap();
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) {
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_event_loop(&mut cx) {
|
||||
unreachable!();
|
||||
}
|
||||
});
|
||||
|
@ -134,7 +133,7 @@ mod tests {
|
|||
} else {
|
||||
unreachable!();
|
||||
}
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) {
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_event_loop(&mut cx) {
|
||||
unreachable!();
|
||||
}
|
||||
});
|
||||
|
@ -147,7 +146,7 @@ mod tests {
|
|||
isolate
|
||||
.execute("event_target_test.js", include_str!("event_target_test.js"))
|
||||
.unwrap();
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) {
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_event_loop(&mut cx) {
|
||||
unreachable!();
|
||||
}
|
||||
});
|
||||
|
@ -163,7 +162,7 @@ mod tests {
|
|||
include_str!("text_encoding_test.js"),
|
||||
)
|
||||
.unwrap();
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) {
|
||||
if let Poll::Ready(Err(_)) = isolate.poll_event_loop(&mut cx) {
|
||||
unreachable!();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue