update embedding interfaces again to use filling_drop feature

...and remove trailing whitespaces
This commit is contained in:
Mike Blumenkrantz 2015-05-06 12:27:58 -04:00
parent efb2b37185
commit 745e3bd49f
57 changed files with 2797 additions and 1550 deletions

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc;
use std::collections::HashMap;
use std::mem;
use std::ptr;
//
@ -66,13 +67,13 @@ pub struct _cef_jsdialog_callback_t {
//
// The reference count. This will only be present for Rust instances!
//
pub ref_count: usize,
pub ref_count: u32,
//
// Extra data. This will only be present for Rust instances!
//
pub extra: u8,
}
}
pub type cef_jsdialog_callback_t = _cef_jsdialog_callback_t;
@ -88,7 +89,8 @@ pub struct CefJSDialogCallback {
impl Clone for CefJSDialogCallback {
fn clone(&self) -> CefJSDialogCallback{
unsafe {
if !self.c_object.is_null() {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefJSDialogCallback {
@ -101,7 +103,8 @@ impl Clone for CefJSDialogCallback {
impl Drop for CefJSDialogCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -116,7 +119,8 @@ impl CefJSDialogCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_jsdialog_callback_t) -> CefJSDialogCallback {
if !c_object.is_null() {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefJSDialogCallback {
@ -130,7 +134,8 @@ impl CefJSDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_jsdialog_callback_t {
unsafe {
if !self.c_object.is_null() {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -138,10 +143,10 @@ impl CefJSDialogCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null()
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null()
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
}
//
@ -149,7 +154,8 @@ impl CefJSDialogCallback {
// was pressed. The |user_input| value should be specified for prompt dialogs.
//
pub fn cont(&self, success: libc::c_int, user_input: &[u16]) -> () {
if self.c_object.is_null() {
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 {
@ -178,7 +184,8 @@ impl CefWrap<*mut cef_jsdialog_callback_t> for Option<CefJSDialogCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_jsdialog_callback_t) -> Option<CefJSDialogCallback> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefJSDialogCallback::from_c_object_addref(c_object))
@ -255,13 +262,13 @@ pub struct _cef_jsdialog_handler_t {
//
// The reference count. This will only be present for Rust instances!
//
pub ref_count: usize,
pub ref_count: u32,
//
// Extra data. This will only be present for Rust instances!
//
pub extra: u8,
}
}
pub type cef_jsdialog_handler_t = _cef_jsdialog_handler_t;
@ -277,7 +284,8 @@ pub struct CefJSDialogHandler {
impl Clone for CefJSDialogHandler {
fn clone(&self) -> CefJSDialogHandler{
unsafe {
if !self.c_object.is_null() {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefJSDialogHandler {
@ -290,7 +298,8 @@ impl Clone for CefJSDialogHandler {
impl Drop for CefJSDialogHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -305,7 +314,8 @@ impl CefJSDialogHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_jsdialog_handler_t) -> CefJSDialogHandler {
if !c_object.is_null() {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefJSDialogHandler {
@ -319,7 +329,8 @@ impl CefJSDialogHandler {
pub fn c_object_addrefed(&self) -> *mut cef_jsdialog_handler_t {
unsafe {
if !self.c_object.is_null() {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -327,10 +338,10 @@ impl CefJSDialogHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null()
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null()
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
}
//
@ -353,7 +364,8 @@ impl CefJSDialogHandler {
message_text: &[u16], default_prompt_text: &[u16],
callback: interfaces::CefJSDialogCallback,
suppress_message: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() {
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 {
@ -382,7 +394,8 @@ impl CefJSDialogHandler {
pub fn on_before_unload_dialog(&self, browser: interfaces::CefBrowser,
message_text: &[u16], is_reload: libc::c_int,
callback: interfaces::CefJSDialogCallback) -> libc::c_int {
if self.c_object.is_null() {
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 {
@ -402,7 +415,8 @@ impl CefJSDialogHandler {
// dialogs are currently pending.
//
pub fn on_reset_dialog_state(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() {
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 {
@ -417,7 +431,8 @@ impl CefJSDialogHandler {
// Called when the default implementation dialog is closed.
//
pub fn on_dialog_closed(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() {
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 {
@ -445,7 +460,8 @@ impl CefWrap<*mut cef_jsdialog_handler_t> for Option<CefJSDialogHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_jsdialog_handler_t) -> Option<CefJSDialogHandler> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefJSDialogHandler::from_c_object_addref(c_object))