embedding: remove eutil::fptr_is_null, fix #3967, add Option<> to fptrs

This commit is contained in:
Mike Blumenkrantz 2014-11-14 14:26:00 -05:00
parent 85a2f0b66a
commit d33f74f499
7 changed files with 213 additions and 222 deletions

View file

@ -4,14 +4,12 @@
use command_line::command_line_init;
use eutil::fptr_is_null;
use geom::size::TypedSize2D;
use glfw_app;
use libc::{c_int, c_void};
use native;
use servo::Browser;
use servo_util::opts;
use std::mem;
use types::{cef_app_t, cef_main_args_t, cef_settings_t};
#[no_mangle]
@ -25,15 +23,13 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
}
unsafe {
command_line_init((*args).argc, (*args).argv);
let cb = (*application).get_browser_process_handler;
if !fptr_is_null(mem::transmute(cb)) {
let handler = cb(application);
if handler.is_not_null() {
let hcb = (*handler).on_context_initialized;
if !fptr_is_null(mem::transmute(hcb)) {
hcb(handler);
}
}
if !(*application).get_browser_process_handler.is_some() { return 1; }
let cb = (*application).get_browser_process_handler.unwrap();
let handler = cb(application);
if handler.is_not_null() {
if !(*handler).on_context_initialized.is_some() { return 1; }
let hcb = (*handler).on_context_initialized.unwrap();
hcb(handler);
}
}
return 1