Introduce TaskOnce

Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing
from CancellableTask<T>.
This commit is contained in:
Anthony Ramine 2017-09-20 10:37:09 +02:00
parent 52527d6f9d
commit 6c9fb5ae7a
26 changed files with 144 additions and 124 deletions

View file

@ -19,7 +19,7 @@ use js::jsapi::{HandleValue, JSContext};
use script_traits::{ScriptMsg, DOMMessage};
use servo_url::ServoUrl;
use std::cell::Cell;
use task::TaskBox;
use task::TaskOnce;
pub type TrustedServiceWorkerAddress = Trusted<ServiceWorker>;
@ -104,10 +104,9 @@ impl ServiceWorkerMethods for ServiceWorker {
event_handler!(statechange, GetOnstatechange, SetOnstatechange);
}
impl TaskBox for SimpleWorkerErrorHandler<ServiceWorker> {
impl TaskOnce for SimpleWorkerErrorHandler<ServiceWorker> {
#[allow(unrooted_must_root)]
fn run_box(self: Box<Self>) {
let this = *self;
ServiceWorker::dispatch_simple_error(this.addr);
fn run_once(self) {
ServiceWorker::dispatch_simple_error(self.addr);
}
}