add cef method for notifying the main loop of work available

This commit is contained in:
Mike Blumenkrantz 2015-05-19 14:47:00 -04:00
parent d87af8ac52
commit d7ad5d6ea2

View file

@ -94,6 +94,12 @@ pub struct _cef_browser_process_handler_t {
pub get_print_handler: Option<extern "C" fn(
this: *mut cef_browser_process_handler_t) -> *mut interfaces::cef_print_handler_t>,
//
// Called when the application should call cef_do_message_loop_work()
//
pub on_work_available: Option<extern "C" fn(
this: *mut cef_browser_process_handler_t) -> ()>,
//
// 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 {