mirror of
https://github.com/servo/servo.git
synced 2025-09-22 04:40:09 +01:00
Auto merge of #7283 - Ms2ger:create_shareable, r=larsbergstrom
Cleanup ActorRegistry::create_shareable. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7283) <!-- Reviewable:end -->
This commit is contained in:
commit
1fd5418f43
1 changed files with 9 additions and 7 deletions
|
@ -110,16 +110,18 @@ impl ActorRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creating shareable registry
|
/// Creating shareable registry
|
||||||
pub fn create_shareable(self) -> Arc<Mutex<ActorRegistry>>{
|
pub fn create_shareable(self) -> Arc<Mutex<ActorRegistry>> {
|
||||||
if self.shareable.is_some() {
|
if let Some(shareable) = self.shareable {
|
||||||
return self.shareable.unwrap();
|
return shareable;
|
||||||
}
|
}
|
||||||
|
|
||||||
let shareable = Arc::new(Mutex::new(self));
|
let shareable = Arc::new(Mutex::new(self));
|
||||||
let mut lock = shareable.lock();
|
{
|
||||||
let registry = lock.as_mut().unwrap();
|
let mut lock = shareable.lock();
|
||||||
registry.shareable = Some(shareable.clone());
|
let registry = lock.as_mut().unwrap();
|
||||||
shareable.clone()
|
registry.shareable = Some(shareable.clone());
|
||||||
|
}
|
||||||
|
shareable
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get shareable registry through threads
|
/// Get shareable registry through threads
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue