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;
//
@ -70,13 +71,13 @@ pub struct _cef_print_dialog_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_print_dialog_callback_t = _cef_print_dialog_callback_t;
@ -91,7 +92,8 @@ pub struct CefPrintDialogCallback {
impl Clone for CefPrintDialogCallback {
fn clone(&self) -> CefPrintDialogCallback{
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);
}
CefPrintDialogCallback {
@ -104,7 +106,8 @@ impl Clone for CefPrintDialogCallback {
impl Drop for CefPrintDialogCallback {
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);
}
}
@ -119,7 +122,8 @@ impl CefPrintDialogCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_dialog_callback_t) -> CefPrintDialogCallback {
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);
}
CefPrintDialogCallback {
@ -133,7 +137,8 @@ impl CefPrintDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_print_dialog_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
@ -141,17 +146,18 @@ impl CefPrintDialogCallback {
}
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
}
//
// Continue printing with the specified |settings|.
//
pub fn cont(&self, settings: interfaces::CefPrintSettings) -> () {
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 {
@ -166,7 +172,8 @@ impl CefPrintDialogCallback {
// Cancel the printing.
//
pub fn cancel(&self) -> () {
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 {
@ -193,7 +200,8 @@ impl CefWrap<*mut cef_print_dialog_callback_t> for Option<CefPrintDialogCallback
}
}
unsafe fn to_rust(c_object: *mut cef_print_dialog_callback_t) -> Option<CefPrintDialogCallback> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefPrintDialogCallback::from_c_object_addref(c_object))
@ -220,13 +228,13 @@ pub struct _cef_print_job_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_print_job_callback_t = _cef_print_job_callback_t;
@ -241,7 +249,8 @@ pub struct CefPrintJobCallback {
impl Clone for CefPrintJobCallback {
fn clone(&self) -> CefPrintJobCallback{
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);
}
CefPrintJobCallback {
@ -254,7 +263,8 @@ impl Clone for CefPrintJobCallback {
impl Drop for CefPrintJobCallback {
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);
}
}
@ -269,7 +279,8 @@ impl CefPrintJobCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_job_callback_t) -> CefPrintJobCallback {
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);
}
CefPrintJobCallback {
@ -283,7 +294,8 @@ impl CefPrintJobCallback {
pub fn c_object_addrefed(&self) -> *mut cef_print_job_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
@ -291,17 +303,18 @@ impl CefPrintJobCallback {
}
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
}
//
// Indicate completion of the print job.
//
pub fn cont(&self) -> () {
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 {
@ -328,7 +341,8 @@ impl CefWrap<*mut cef_print_job_callback_t> for Option<CefPrintJobCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_print_job_callback_t) -> Option<CefPrintJobCallback> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefPrintJobCallback::from_c_object_addref(c_object))
@ -385,13 +399,13 @@ pub struct _cef_print_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_print_handler_t = _cef_print_handler_t;
@ -407,7 +421,8 @@ pub struct CefPrintHandler {
impl Clone for CefPrintHandler {
fn clone(&self) -> CefPrintHandler{
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);
}
CefPrintHandler {
@ -420,7 +435,8 @@ impl Clone for CefPrintHandler {
impl Drop for CefPrintHandler {
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);
}
}
@ -435,7 +451,8 @@ impl CefPrintHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_handler_t) -> CefPrintHandler {
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);
}
CefPrintHandler {
@ -449,7 +466,8 @@ impl CefPrintHandler {
pub fn c_object_addrefed(&self) -> *mut cef_print_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
@ -457,10 +475,10 @@ impl CefPrintHandler {
}
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
}
//
@ -470,7 +488,8 @@ impl CefPrintHandler {
//
pub fn on_print_settings(&self, settings: interfaces::CefPrintSettings,
get_defaults: 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 {
@ -489,7 +508,8 @@ impl CefPrintHandler {
//
pub fn on_print_dialog(&self, has_selection: libc::c_int,
callback: interfaces::CefPrintDialogCallback) -> 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 {
@ -508,7 +528,8 @@ impl CefPrintHandler {
//
pub fn on_print_job(&self, document_name: &[u16], pdf_file_path: &[u16],
callback: interfaces::CefPrintJobCallback) -> 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 {
@ -525,7 +546,8 @@ impl CefPrintHandler {
// Reset client state related to printing.
//
pub fn on_print_reset(&self) -> () {
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 {
@ -552,7 +574,8 @@ impl CefWrap<*mut cef_print_handler_t> for Option<CefPrintHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_print_handler_t) -> Option<CefPrintHandler> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefPrintHandler::from_c_object_addref(c_object))