add new browser process interface method for main loop integration

regular CEF requires the user to either run the cef main loop or
poll on a function to drain events. now the engine will trigger a callback
in some application thread which will notify it that there is work
to be done by the browser
This commit is contained in:
Mike Blumenkrantz 2015-05-19 17:21:53 -04:00
parent 83e605d2fb
commit af1dce5a2e
3 changed files with 19 additions and 2 deletions

View file

@ -26,6 +26,8 @@ static CEF_API_HASH_PLATFORM: &'static [u8] = b"6813214accbf2ebfb6bdcf8d00654650
#[cfg(target_os="linux")]
static CEF_API_HASH_PLATFORM: &'static [u8] = b"2bc564c3871965ef3a2531b528bda3e17fa17a6d\0";
pub static mut CEF_APP: *mut cef_app_t = 0 as *mut cef_app_t;
#[no_mangle]
pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
@ -36,6 +38,11 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
if args.is_null() {
return 0;
}
unsafe {
if !CEF_APP.is_null() {
panic!("Attempting to call cef_initialize() multiple times!");
}
}
unsafe {
command_line_init((*args).argc, (*args).argv);
@ -47,6 +54,7 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
(*handler).on_context_initialized.map(|hcb| hcb(handler));
}
});
CEF_APP = application;
}
}