mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
move name implementation as default implementation to the trait and remove overrides.
This commit is contained in:
parent
a3df0cf4de
commit
99e4504f85
13 changed files with 1 additions and 45 deletions
|
@ -222,8 +222,6 @@ pub struct CancellableRunnable<T: Runnable + Send> {
|
|||
}
|
||||
|
||||
impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
|
||||
fn name(&self) -> &'static str { unsafe { intrinsics::type_name::<Self>() } }
|
||||
|
||||
fn is_cancelled(&self) -> bool {
|
||||
self.cancelled.as_ref()
|
||||
.map(|cancelled| cancelled.load(Ordering::SeqCst))
|
||||
|
@ -241,7 +239,7 @@ impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
|
|||
|
||||
pub trait Runnable {
|
||||
fn is_cancelled(&self) -> bool { false }
|
||||
fn name(&self) -> &'static str { "generic runnable" }
|
||||
fn name(&self) -> &'static str { unsafe { intrinsics::type_name::<Self>() } }
|
||||
fn handler(self: Box<Self>) {}
|
||||
fn main_thread_handler(self: Box<Self>, _script_thread: &ScriptThread) { self.handler(); }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue