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

@ -23,7 +23,7 @@ use dom_struct::dom_struct;
use servo_atoms::Atom;
use std::cell::Cell;
use std::default::Default;
use task::TaskBox;
use task::TaskOnce;
use time;
#[dom_struct]
@ -388,8 +388,8 @@ pub struct EventTask {
pub cancelable: EventCancelable,
}
impl TaskBox for EventTask {
fn run_box(self: Box<Self>) {
impl TaskOnce for EventTask {
fn run_once(self) {
let target = self.target.root();
let bubbles = self.bubbles;
let cancelable = self.cancelable;
@ -403,8 +403,8 @@ pub struct SimpleEventTask {
pub name: Atom,
}
impl TaskBox for SimpleEventTask {
fn run_box(self: Box<Self>) {
impl TaskOnce for SimpleEventTask {
fn run_once(self) {
let target = self.target.root();
target.fire_event(self.name);
}