mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Flatten and cleanup ConstellationListener::is_cancelled
.
This commit is contained in:
parent
16be0640a8
commit
a10b574d44
1 changed files with 9 additions and 11 deletions
|
@ -227,17 +227,15 @@ impl CancellationListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_cancelled(&self) -> bool {
|
pub fn is_cancelled(&self) -> bool {
|
||||||
match self.cancel_resource {
|
let resource = match self.cancel_resource {
|
||||||
Some(ref resource) => {
|
Some(ref resource) => resource,
|
||||||
match resource.cancel_receiver.try_recv() {
|
None => return false, // channel doesn't exist!
|
||||||
Ok(_) => {
|
};
|
||||||
|
if resource.cancel_receiver.try_recv().is_ok() {
|
||||||
self.cancel_status.set(true);
|
self.cancel_status.set(true);
|
||||||
true
|
true
|
||||||
},
|
} else {
|
||||||
Err(_) => self.cancel_status.get(),
|
self.cancel_status.get()
|
||||||
}
|
|
||||||
},
|
|
||||||
None => false, // channel doesn't exist!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue