mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +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 {
|
||||
match self.cancel_resource {
|
||||
Some(ref resource) => {
|
||||
match resource.cancel_receiver.try_recv() {
|
||||
Ok(_) => {
|
||||
self.cancel_status.set(true);
|
||||
true
|
||||
},
|
||||
Err(_) => self.cancel_status.get(),
|
||||
}
|
||||
},
|
||||
None => false, // channel doesn't exist!
|
||||
let resource = match self.cancel_resource {
|
||||
Some(ref resource) => resource,
|
||||
None => return false, // channel doesn't exist!
|
||||
};
|
||||
if resource.cancel_receiver.try_recv().is_ok() {
|
||||
self.cancel_status.set(true);
|
||||
true
|
||||
} else {
|
||||
self.cancel_status.get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue