Skip to content

Commit fefac7f

Browse files
committed
Address review comments
1 parent ca6a06f commit fefac7f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

desktop/src/app.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ impl WinitApp {
4646

4747
impl ApplicationHandler<CustomEvent> for WinitApp {
4848
fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) {
49-
let timeout = Instant::now() + Duration::from_millis(1000);
49+
// Set a timeout in case we miss any cef schedule requests
50+
let timeout = Instant::now() + Duration::from_millis(100);
5051
let wait_until = timeout.min(self.cef_schedule.unwrap_or(timeout));
5152
event_loop.set_control_flow(ControlFlow::WaitUntil(wait_until));
5253
}
5354

5455
fn new_events(&mut self, _event_loop: &ActiveEventLoop, _cause: StartCause) {
55-
if self.ui_frame_buffer.is_none() {
56-
self.cef_context.work();
57-
}
5856
if let Some(schedule) = self.cef_schedule
5957
&& schedule < Instant::now()
6058
{

desktop/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ fn main() {
3434

3535
let event_loop = EventLoop::<CustomEvent>::with_user_event().build().unwrap();
3636

37-
let (send, recv) = std::sync::mpsc::channel();
37+
let (window_size_sender, window_size_receiver) = std::sync::mpsc::channel();
3838

39-
let cef_context = match cef_context.init(cef::CefHandler::new(recv, event_loop.create_proxy())) {
39+
let cef_context = match cef_context.init(cef::CefHandler::new(window_size_receiver, event_loop.create_proxy())) {
4040
Ok(c) => c,
4141
Err(cef::InitError::InitializationFailed) => {
4242
tracing::error!("Cef initialization failed");
@@ -46,7 +46,7 @@ fn main() {
4646

4747
tracing::info!("Cef initialized successfully");
4848

49-
let mut winit_app = WinitApp::new(cef_context, send, event_loop.create_proxy());
49+
let mut winit_app = WinitApp::new(cef_context, window_size_sender, event_loop.create_proxy());
5050

5151
event_loop.run_app(&mut winit_app).unwrap();
5252
}

0 commit comments

Comments
 (0)