From d7ad5d6ea2378bf3c55ece8637bf5126af5c5eba Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 19 May 2015 14:47:00 -0400 Subject: [PATCH] add cef method for notifying the main loop of work available --- .../interfaces/cef_browser_process_handler.rs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ports/cef/interfaces/cef_browser_process_handler.rs b/ports/cef/interfaces/cef_browser_process_handler.rs index 672247169fd..49cc9e327b1 100644 --- a/ports/cef/interfaces/cef_browser_process_handler.rs +++ b/ports/cef/interfaces/cef_browser_process_handler.rs @@ -94,6 +94,12 @@ pub struct _cef_browser_process_handler_t { pub get_print_handler: Option *mut interfaces::cef_print_handler_t>, + // + // Called when the application should call cef_do_message_loop_work() + // + pub on_work_available: Option ()>, + // // The reference count. This will only be present for Rust instances! // @@ -253,6 +259,21 @@ impl CefBrowserProcessHandler { self.c_object)) } } + + // + // Called when the application should call cef_do_message_loop_work() + // + pub fn on_work_available(&self) -> () { + if self.c_object.is_null() || + self.c_object as usize == mem::POST_DROP_USIZE { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_work_available.unwrap())( + self.c_object)) + } + } } impl CefWrap<*mut cef_browser_process_handler_t> for CefBrowserProcessHandler {