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;
//
@ -108,13 +109,13 @@ pub struct _cef_scheme_registrar_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_scheme_registrar_t = _cef_scheme_registrar_t;
@ -129,7 +130,8 @@ pub struct CefSchemeRegistrar {
impl Clone for CefSchemeRegistrar {
fn clone(&self) -> CefSchemeRegistrar{
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);
}
CefSchemeRegistrar {
@ -142,7 +144,8 @@ impl Clone for CefSchemeRegistrar {
impl Drop for CefSchemeRegistrar {
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);
}
}
@ -157,7 +160,8 @@ impl CefSchemeRegistrar {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_scheme_registrar_t) -> CefSchemeRegistrar {
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);
}
CefSchemeRegistrar {
@ -171,7 +175,8 @@ impl CefSchemeRegistrar {
pub fn c_object_addrefed(&self) -> *mut cef_scheme_registrar_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
@ -179,10 +184,10 @@ impl CefSchemeRegistrar {
}
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
}
//
@ -234,7 +239,8 @@ impl CefSchemeRegistrar {
pub fn add_custom_scheme(&self, scheme_name: &[u16], is_standard: libc::c_int,
is_local: libc::c_int,
is_display_isolated: 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 {
@ -265,7 +271,8 @@ impl CefWrap<*mut cef_scheme_registrar_t> for Option<CefSchemeRegistrar> {
}
}
unsafe fn to_rust(c_object: *mut cef_scheme_registrar_t) -> Option<CefSchemeRegistrar> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefSchemeRegistrar::from_c_object_addref(c_object))
@ -303,13 +310,13 @@ pub struct _cef_scheme_handler_factory_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_scheme_handler_factory_t = _cef_scheme_handler_factory_t;
@ -326,7 +333,8 @@ pub struct CefSchemeHandlerFactory {
impl Clone for CefSchemeHandlerFactory {
fn clone(&self) -> CefSchemeHandlerFactory{
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);
}
CefSchemeHandlerFactory {
@ -339,7 +347,8 @@ impl Clone for CefSchemeHandlerFactory {
impl Drop for CefSchemeHandlerFactory {
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);
}
}
@ -354,7 +363,8 @@ impl CefSchemeHandlerFactory {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_scheme_handler_factory_t) -> CefSchemeHandlerFactory {
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);
}
CefSchemeHandlerFactory {
@ -368,7 +378,8 @@ impl CefSchemeHandlerFactory {
pub fn c_object_addrefed(&self) -> *mut cef_scheme_handler_factory_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
@ -376,10 +387,10 @@ impl CefSchemeHandlerFactory {
}
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
}
//
@ -393,7 +404,8 @@ impl CefSchemeHandlerFactory {
pub fn create(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, scheme_name: &[u16],
request: interfaces::CefRequest) -> interfaces::CefResourceHandler {
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 {
@ -424,7 +436,8 @@ impl CefWrap<*mut cef_scheme_handler_factory_t> for Option<CefSchemeHandlerFacto
}
}
unsafe fn to_rust(c_object: *mut cef_scheme_handler_factory_t) -> Option<CefSchemeHandlerFactory> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefSchemeHandlerFactory::from_c_object_addref(c_object))