mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Introduce TaskOnce
Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing from CancellableTask<T>.
This commit is contained in:
parent
52527d6f9d
commit
6c9fb5ae7a
26 changed files with 144 additions and 124 deletions
|
@ -11,21 +11,21 @@ pub mod user_interaction;
|
|||
|
||||
use dom::globalscope::GlobalScope;
|
||||
use std::result::Result;
|
||||
use task::{TaskBox, TaskCanceller};
|
||||
use task::{TaskCanceller, TaskOnce};
|
||||
|
||||
pub trait TaskSource {
|
||||
fn queue_with_canceller<T>(
|
||||
&self,
|
||||
msg: Box<T>,
|
||||
task: T,
|
||||
canceller: &TaskCanceller,
|
||||
) -> Result<(), ()>
|
||||
where
|
||||
T: TaskBox + 'static;
|
||||
T: TaskOnce + 'static;
|
||||
|
||||
fn queue<T>(&self, msg: Box<T>, global: &GlobalScope) -> Result<(), ()>
|
||||
fn queue<T>(&self, task: T, global: &GlobalScope) -> Result<(), ()>
|
||||
where
|
||||
T: TaskBox + 'static,
|
||||
T: TaskOnce + 'static,
|
||||
{
|
||||
self.queue_with_canceller(msg, &global.task_canceller())
|
||||
self.queue_with_canceller(task, &global.task_canceller())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue