refactor: Worker is not a Future (#7895)

This commit rewrites deno::Worker to not implement Future
trait.

Instead there are two separate methods:
- Worker::poll_event_loop() - does single tick of event loop
- Worker::run_event_loop() - runs event loop to completion

Additionally some cleanup to Worker's field visibility was done.
This commit is contained in:
Bartek Iwańczuk 2020-10-09 19:08:10 +02:00 committed by GitHub
parent 9731cbc288
commit f4357f0ff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 134 additions and 147 deletions

View file

@ -1,7 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::colors;
use crate::inspector::DenoInspector;
use crate::inspector::InspectorSession;
use deno_core::error::AnyError;
use deno_core::serde_json;
@ -14,8 +13,7 @@ pub struct CoverageCollector {
}
impl CoverageCollector {
pub fn new(inspector_ptr: *mut DenoInspector) -> Self {
let session = InspectorSession::new(inspector_ptr);
pub fn new(session: Box<InspectorSession>) -> Self {
Self { session }
}