mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
chore(servo): simplify servo example (#35253)
Removes the `Arc<Mutex<T>>` usage in `winit_minimal` given that `EventLoopProxy` has `Send` and `Sync` traits. re #35252 Signed-off-by: Roberto Huertas <roberto.huertas@outlook.com>
This commit is contained in:
parent
6fd63b6c7d
commit
8999b539df
1 changed files with 3 additions and 9 deletions
|
@ -5,7 +5,6 @@
|
|||
use std::cell::Cell;
|
||||
use std::error::Error;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use compositing::windowing::{AnimationState, EmbedderEvent, EmbedderMethods, WindowMethods};
|
||||
use embedder_traits::EmbedderMsg;
|
||||
|
@ -207,13 +206,13 @@ impl EmbedderMethods for EmbedderDelegate {
|
|||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Waker(Arc<Mutex<winit::event_loop::EventLoopProxy<WakerEvent>>>);
|
||||
struct Waker(winit::event_loop::EventLoopProxy<WakerEvent>);
|
||||
#[derive(Debug)]
|
||||
struct WakerEvent;
|
||||
|
||||
impl Waker {
|
||||
fn new(event_loop: &EventLoop<WakerEvent>) -> Self {
|
||||
Self(Arc::new(Mutex::new(event_loop.create_proxy())))
|
||||
Self(event_loop.create_proxy())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,12 +222,7 @@ impl embedder_traits::EventLoopWaker for Waker {
|
|||
}
|
||||
|
||||
fn wake(&self) {
|
||||
if let Err(error) = self
|
||||
.0
|
||||
.lock()
|
||||
.expect("Failed to lock EventLoopProxy")
|
||||
.send_event(WakerEvent)
|
||||
{
|
||||
if let Err(error) = self.0.send_event(WakerEvent) {
|
||||
warn!(?error, "Failed to wake event loop");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue