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 libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -106,13 +107,13 @@ pub struct _cef_app_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_app_t = _cef_app_t; pub type cef_app_t = _cef_app_t;
@ -128,7 +129,8 @@ pub struct CefApp {
impl Clone for CefApp { impl Clone for CefApp {
fn clone(&self) -> CefApp{ fn clone(&self) -> CefApp{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefApp { CefApp {
@ -141,7 +143,8 @@ impl Clone for CefApp {
impl Drop for CefApp { impl Drop for CefApp {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -156,7 +159,8 @@ impl CefApp {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_app_t) -> CefApp { pub unsafe fn from_c_object_addref(c_object: *mut cef_app_t) -> CefApp {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefApp { CefApp {
@ -170,7 +174,8 @@ impl CefApp {
pub fn c_object_addrefed(&self) -> *mut cef_app_t { pub fn c_object_addrefed(&self) -> *mut cef_app_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -178,10 +183,10 @@ impl CefApp {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -197,7 +202,8 @@ impl CefApp {
// //
pub fn on_before_command_line_processing(&self, process_type: &[u16], pub fn on_before_command_line_processing(&self, process_type: &[u16],
command_line: interfaces::CefCommandLine) -> () { command_line: interfaces::CefCommandLine) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -217,7 +223,8 @@ impl CefApp {
// //
pub fn on_register_custom_schemes(&self, pub fn on_register_custom_schemes(&self,
registrar: interfaces::CefSchemeRegistrar) -> () { registrar: interfaces::CefSchemeRegistrar) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -236,7 +243,8 @@ impl CefApp {
// //
pub fn get_resource_bundle_handler( pub fn get_resource_bundle_handler(
&self) -> interfaces::CefResourceBundleHandler { &self) -> interfaces::CefResourceBundleHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -252,7 +260,8 @@ impl CefApp {
// //
pub fn get_browser_process_handler( pub fn get_browser_process_handler(
&self) -> interfaces::CefBrowserProcessHandler { &self) -> interfaces::CefBrowserProcessHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -268,7 +277,8 @@ impl CefApp {
// //
pub fn get_render_process_handler( pub fn get_render_process_handler(
&self) -> interfaces::CefRenderProcessHandler { &self) -> interfaces::CefRenderProcessHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -295,7 +305,8 @@ impl CefWrap<*mut cef_app_t> for Option<CefApp> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_app_t) -> Option<CefApp> { unsafe fn to_rust(c_object: *mut cef_app_t) -> Option<CefApp> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefApp::from_c_object_addref(c_object)) Some(CefApp::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -71,13 +72,13 @@ pub struct _cef_auth_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_auth_callback_t = _cef_auth_callback_t; pub type cef_auth_callback_t = _cef_auth_callback_t;
@ -93,7 +94,8 @@ pub struct CefAuthCallback {
impl Clone for CefAuthCallback { impl Clone for CefAuthCallback {
fn clone(&self) -> CefAuthCallback{ fn clone(&self) -> CefAuthCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefAuthCallback { CefAuthCallback {
@ -106,7 +108,8 @@ impl Clone for CefAuthCallback {
impl Drop for CefAuthCallback { impl Drop for CefAuthCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -121,7 +124,8 @@ impl CefAuthCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_auth_callback_t) -> CefAuthCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_auth_callback_t) -> CefAuthCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefAuthCallback { CefAuthCallback {
@ -135,7 +139,8 @@ impl CefAuthCallback {
pub fn c_object_addrefed(&self) -> *mut cef_auth_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_auth_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -143,17 +148,18 @@ impl CefAuthCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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 the authentication request. // Continue the authentication request.
// //
pub fn cont(&self, username: &[u16], password: &[u16]) -> () { pub fn cont(&self, username: &[u16], password: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -169,7 +175,8 @@ impl CefAuthCallback {
// Cancel the authentication request. // Cancel the authentication request.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -196,7 +203,8 @@ impl CefWrap<*mut cef_auth_callback_t> for Option<CefAuthCallback> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_auth_callback_t) -> Option<CefAuthCallback> { unsafe fn to_rust(c_object: *mut cef_auth_callback_t) -> Option<CefAuthCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefAuthCallback::from_c_object_addref(c_object)) Some(CefAuthCallback::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -186,13 +187,13 @@ pub struct _cef_browser_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_browser_t = _cef_browser_t; pub type cef_browser_t = _cef_browser_t;
@ -210,7 +211,8 @@ pub struct CefBrowser {
impl Clone for CefBrowser { impl Clone for CefBrowser {
fn clone(&self) -> CefBrowser{ fn clone(&self) -> CefBrowser{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefBrowser { CefBrowser {
@ -223,7 +225,8 @@ impl Clone for CefBrowser {
impl Drop for CefBrowser { impl Drop for CefBrowser {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -238,7 +241,8 @@ impl CefBrowser {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_t) -> CefBrowser { pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_t) -> CefBrowser {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefBrowser { CefBrowser {
@ -252,7 +256,8 @@ impl CefBrowser {
pub fn c_object_addrefed(&self) -> *mut cef_browser_t { pub fn c_object_addrefed(&self) -> *mut cef_browser_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -260,10 +265,10 @@ impl CefBrowser {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -271,7 +276,8 @@ impl CefBrowser {
// browser process. // browser process.
// //
pub fn get_host(&self) -> interfaces::CefBrowserHost { pub fn get_host(&self) -> interfaces::CefBrowserHost {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -285,7 +291,8 @@ impl CefBrowser {
// Returns true (1) if the browser can navigate backwards. // Returns true (1) if the browser can navigate backwards.
// //
pub fn can_go_back(&self) -> libc::c_int { pub fn can_go_back(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -299,7 +306,8 @@ impl CefBrowser {
// Navigate backwards. // Navigate backwards.
// //
pub fn go_back(&self) -> () { pub fn go_back(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -313,7 +321,8 @@ impl CefBrowser {
// Returns true (1) if the browser can navigate forwards. // Returns true (1) if the browser can navigate forwards.
// //
pub fn can_go_forward(&self) -> libc::c_int { pub fn can_go_forward(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -327,7 +336,8 @@ impl CefBrowser {
// Navigate forwards. // Navigate forwards.
// //
pub fn go_forward(&self) -> () { pub fn go_forward(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -341,7 +351,8 @@ impl CefBrowser {
// Returns true (1) if the browser is currently loading. // Returns true (1) if the browser is currently loading.
// //
pub fn is_loading(&self) -> libc::c_int { pub fn is_loading(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -355,7 +366,8 @@ impl CefBrowser {
// Reload the current page. // Reload the current page.
// //
pub fn reload(&self) -> () { pub fn reload(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -369,7 +381,8 @@ impl CefBrowser {
// Reload the current page ignoring any cached data. // Reload the current page ignoring any cached data.
// //
pub fn reload_ignore_cache(&self) -> () { pub fn reload_ignore_cache(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -383,7 +396,8 @@ impl CefBrowser {
// Stop loading the page. // Stop loading the page.
// //
pub fn stop_load(&self) -> () { pub fn stop_load(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -397,7 +411,8 @@ impl CefBrowser {
// Returns the globally unique identifier for this browser. // Returns the globally unique identifier for this browser.
// //
pub fn get_identifier(&self) -> libc::c_int { pub fn get_identifier(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -412,7 +427,8 @@ impl CefBrowser {
// object. // object.
// //
pub fn is_same(&self, that: interfaces::CefBrowser) -> libc::c_int { pub fn is_same(&self, that: interfaces::CefBrowser) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -427,7 +443,8 @@ impl CefBrowser {
// Returns true (1) if the window is a popup window. // Returns true (1) if the window is a popup window.
// //
pub fn is_popup(&self) -> libc::c_int { pub fn is_popup(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -441,7 +458,8 @@ impl CefBrowser {
// Returns true (1) if a document has been loaded in the browser. // Returns true (1) if a document has been loaded in the browser.
// //
pub fn has_document(&self) -> libc::c_int { pub fn has_document(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -455,7 +473,8 @@ impl CefBrowser {
// Returns the main (top-level) frame for the browser window. // Returns the main (top-level) frame for the browser window.
// //
pub fn get_main_frame(&self) -> interfaces::CefFrame { pub fn get_main_frame(&self) -> interfaces::CefFrame {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -469,7 +488,8 @@ impl CefBrowser {
// Returns the focused frame for the browser window. // Returns the focused frame for the browser window.
// //
pub fn get_focused_frame(&self) -> interfaces::CefFrame { pub fn get_focused_frame(&self) -> interfaces::CefFrame {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -483,7 +503,8 @@ impl CefBrowser {
// Returns the frame with the specified identifier, or NULL if not found. // Returns the frame with the specified identifier, or NULL if not found.
// //
pub fn get_frame_byident(&self, identifier: i64) -> interfaces::CefFrame { pub fn get_frame_byident(&self, identifier: i64) -> interfaces::CefFrame {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -498,7 +519,8 @@ impl CefBrowser {
// Returns the frame with the specified name, or NULL if not found. // Returns the frame with the specified name, or NULL if not found.
// //
pub fn get_frame(&self, name: &[u16]) -> interfaces::CefFrame { pub fn get_frame(&self, name: &[u16]) -> interfaces::CefFrame {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -513,7 +535,8 @@ impl CefBrowser {
// Returns the number of frames that currently exist. // Returns the number of frames that currently exist.
// //
pub fn get_frame_count(&self) -> libc::size_t { pub fn get_frame_count(&self) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -528,7 +551,8 @@ impl CefBrowser {
// //
pub fn get_frame_identifiers(&self, identifiers_count: *mut libc::size_t, pub fn get_frame_identifiers(&self, identifiers_count: *mut libc::size_t,
identifiers: *mut i64) -> () { identifiers: *mut i64) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -544,7 +568,8 @@ impl CefBrowser {
// Returns the names of all existing frames. // Returns the names of all existing frames.
// //
pub fn get_frame_names(&self, names: Vec<String>) -> () { pub fn get_frame_names(&self, names: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -561,7 +586,8 @@ impl CefBrowser {
// //
pub fn send_process_message(&self, target_process: interfaces::CefProcessId, pub fn send_process_message(&self, target_process: interfaces::CefProcessId,
message: interfaces::CefProcessMessage) -> libc::c_int { message: interfaces::CefProcessMessage) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -590,7 +616,8 @@ impl CefWrap<*mut cef_browser_t> for Option<CefBrowser> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_browser_t) -> Option<CefBrowser> { unsafe fn to_rust(c_object: *mut cef_browser_t) -> Option<CefBrowser> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefBrowser::from_c_object_addref(c_object)) Some(CefBrowser::from_c_object_addref(c_object))
@ -625,13 +652,13 @@ pub struct _cef_run_file_dialog_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_run_file_dialog_callback_t = _cef_run_file_dialog_callback_t; pub type cef_run_file_dialog_callback_t = _cef_run_file_dialog_callback_t;
@ -647,7 +674,8 @@ pub struct CefRunFileDialogCallback {
impl Clone for CefRunFileDialogCallback { impl Clone for CefRunFileDialogCallback {
fn clone(&self) -> CefRunFileDialogCallback{ fn clone(&self) -> CefRunFileDialogCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRunFileDialogCallback { CefRunFileDialogCallback {
@ -660,7 +688,8 @@ impl Clone for CefRunFileDialogCallback {
impl Drop for CefRunFileDialogCallback { impl Drop for CefRunFileDialogCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -675,7 +704,8 @@ impl CefRunFileDialogCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_run_file_dialog_callback_t) -> CefRunFileDialogCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_run_file_dialog_callback_t) -> CefRunFileDialogCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRunFileDialogCallback { CefRunFileDialogCallback {
@ -689,7 +719,8 @@ impl CefRunFileDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_run_file_dialog_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_run_file_dialog_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -697,10 +728,10 @@ impl CefRunFileDialogCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -712,7 +743,8 @@ impl CefRunFileDialogCallback {
// //
pub fn on_file_dialog_dismissed(&self, selected_accept_filter: libc::c_int, pub fn on_file_dialog_dismissed(&self, selected_accept_filter: libc::c_int,
file_paths: Vec<String>) -> () { file_paths: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -741,7 +773,8 @@ impl CefWrap<*mut cef_run_file_dialog_callback_t> for Option<CefRunFileDialogCal
} }
} }
unsafe fn to_rust(c_object: *mut cef_run_file_dialog_callback_t) -> Option<CefRunFileDialogCallback> { unsafe fn to_rust(c_object: *mut cef_run_file_dialog_callback_t) -> Option<CefRunFileDialogCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRunFileDialogCallback::from_c_object_addref(c_object)) Some(CefRunFileDialogCallback::from_c_object_addref(c_object))
@ -775,13 +808,13 @@ pub struct _cef_navigation_entry_visitor_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_navigation_entry_visitor_t = _cef_navigation_entry_visitor_t; pub type cef_navigation_entry_visitor_t = _cef_navigation_entry_visitor_t;
@ -797,7 +830,8 @@ pub struct CefNavigationEntryVisitor {
impl Clone for CefNavigationEntryVisitor { impl Clone for CefNavigationEntryVisitor {
fn clone(&self) -> CefNavigationEntryVisitor{ fn clone(&self) -> CefNavigationEntryVisitor{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefNavigationEntryVisitor { CefNavigationEntryVisitor {
@ -810,7 +844,8 @@ impl Clone for CefNavigationEntryVisitor {
impl Drop for CefNavigationEntryVisitor { impl Drop for CefNavigationEntryVisitor {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -825,7 +860,8 @@ impl CefNavigationEntryVisitor {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_visitor_t) -> CefNavigationEntryVisitor { pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_visitor_t) -> CefNavigationEntryVisitor {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefNavigationEntryVisitor { CefNavigationEntryVisitor {
@ -839,7 +875,8 @@ impl CefNavigationEntryVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_visitor_t { pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_visitor_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -847,10 +884,10 @@ impl CefNavigationEntryVisitor {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -863,7 +900,8 @@ impl CefNavigationEntryVisitor {
pub fn visit(&self, entry: interfaces::CefNavigationEntry, pub fn visit(&self, entry: interfaces::CefNavigationEntry,
current: libc::c_int, index: libc::c_int, current: libc::c_int, index: libc::c_int,
total: libc::c_int) -> libc::c_int { total: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -894,7 +932,8 @@ impl CefWrap<*mut cef_navigation_entry_visitor_t> for Option<CefNavigationEntryV
} }
} }
unsafe fn to_rust(c_object: *mut cef_navigation_entry_visitor_t) -> Option<CefNavigationEntryVisitor> { unsafe fn to_rust(c_object: *mut cef_navigation_entry_visitor_t) -> Option<CefNavigationEntryVisitor> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefNavigationEntryVisitor::from_c_object_addref(c_object)) Some(CefNavigationEntryVisitor::from_c_object_addref(c_object))
@ -1292,13 +1331,13 @@ pub struct _cef_browser_host_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_browser_host_t = _cef_browser_host_t; pub type cef_browser_host_t = _cef_browser_host_t;
@ -1316,7 +1355,8 @@ pub struct CefBrowserHost {
impl Clone for CefBrowserHost { impl Clone for CefBrowserHost {
fn clone(&self) -> CefBrowserHost{ fn clone(&self) -> CefBrowserHost{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefBrowserHost { CefBrowserHost {
@ -1329,7 +1369,8 @@ impl Clone for CefBrowserHost {
impl Drop for CefBrowserHost { impl Drop for CefBrowserHost {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -1344,7 +1385,8 @@ impl CefBrowserHost {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_host_t) -> CefBrowserHost { pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_host_t) -> CefBrowserHost {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefBrowserHost { CefBrowserHost {
@ -1358,7 +1400,8 @@ impl CefBrowserHost {
pub fn c_object_addrefed(&self) -> *mut cef_browser_host_t { pub fn c_object_addrefed(&self) -> *mut cef_browser_host_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -1366,17 +1409,18 @@ impl CefBrowserHost {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns the hosted browser object. // Returns the hosted browser object.
// //
pub fn get_browser(&self) -> interfaces::CefBrowser { pub fn get_browser(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1397,7 +1441,8 @@ impl CefBrowserHost {
// information. // information.
// //
pub fn close_browser(&self, force_close: libc::c_int) -> () { pub fn close_browser(&self, force_close: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1412,7 +1457,8 @@ impl CefBrowserHost {
// Set whether the browser is focused. // Set whether the browser is focused.
// //
pub fn set_focus(&self, focus: libc::c_int) -> () { pub fn set_focus(&self, focus: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1428,7 +1474,8 @@ impl CefBrowserHost {
// (minimized/unminimized, app hidden/unhidden, etc). Only used on Mac OS X. // (minimized/unminimized, app hidden/unhidden, etc). Only used on Mac OS X.
// //
pub fn set_window_visibility(&self, visible: libc::c_int) -> () { pub fn set_window_visibility(&self, visible: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1443,7 +1490,8 @@ impl CefBrowserHost {
// Retrieve the window handle for this browser. // Retrieve the window handle for this browser.
// //
pub fn get_window_handle(&self) -> types::cef_window_handle_t { pub fn get_window_handle(&self) -> types::cef_window_handle_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1459,7 +1507,8 @@ impl CefBrowserHost {
// with custom handling of modal windows. // with custom handling of modal windows.
// //
pub fn get_opener_window_handle(&self) -> types::cef_window_handle_t { pub fn get_opener_window_handle(&self) -> types::cef_window_handle_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1473,7 +1522,8 @@ impl CefBrowserHost {
// Returns the client for this browser. // Returns the client for this browser.
// //
pub fn get_client(&self) -> interfaces::CefClient { pub fn get_client(&self) -> interfaces::CefClient {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1487,7 +1537,8 @@ impl CefBrowserHost {
// Returns the request context for this browser. // Returns the request context for this browser.
// //
pub fn get_request_context(&self) -> interfaces::CefRequestContext { pub fn get_request_context(&self) -> interfaces::CefRequestContext {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1502,7 +1553,8 @@ impl CefBrowserHost {
// can only be called on the UI thread. // can only be called on the UI thread.
// //
pub fn get_zoom_level(&self) -> libc::c_double { pub fn get_zoom_level(&self) -> libc::c_double {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1518,7 +1570,8 @@ impl CefBrowserHost {
// Otherwise, the change will be applied asynchronously on the UI thread. // Otherwise, the change will be applied asynchronously on the UI thread.
// //
pub fn set_zoom_level(&self, zoomLevel: libc::c_double) -> () { pub fn set_zoom_level(&self, zoomLevel: libc::c_double) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1549,7 +1602,8 @@ impl CefBrowserHost {
title: &[u16], default_file_path: &[u16], accept_filters: Vec<String>, title: &[u16], default_file_path: &[u16], accept_filters: Vec<String>,
selected_accept_filter: libc::c_int, selected_accept_filter: libc::c_int,
callback: interfaces::CefRunFileDialogCallback) -> () { callback: interfaces::CefRunFileDialogCallback) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1569,7 +1623,8 @@ impl CefBrowserHost {
// Download the file at |url| using cef_download_handler_t. // Download the file at |url| using cef_download_handler_t.
// //
pub fn start_download(&self, url: &[u16]) -> () { pub fn start_download(&self, url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1584,7 +1639,8 @@ impl CefBrowserHost {
// Print the current browser contents. // Print the current browser contents.
// //
pub fn print(&self) -> () { pub fn print(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1605,7 +1661,8 @@ impl CefBrowserHost {
pub fn find(&self, identifier: libc::c_int, searchText: &[u16], pub fn find(&self, identifier: libc::c_int, searchText: &[u16],
forward: libc::c_int, matchCase: libc::c_int, findNext: libc::c_int) -> ( forward: libc::c_int, matchCase: libc::c_int, findNext: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1624,7 +1681,8 @@ impl CefBrowserHost {
// Cancel all searches that are currently going on. // Cancel all searches that are currently going on.
// //
pub fn stop_finding(&self, clearSelection: libc::c_int) -> () { pub fn stop_finding(&self, clearSelection: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1642,7 +1700,8 @@ impl CefBrowserHost {
pub fn show_dev_tools(&self, windowInfo: &interfaces::CefWindowInfo, pub fn show_dev_tools(&self, windowInfo: &interfaces::CefWindowInfo,
client: interfaces::CefClient, settings: &interfaces::CefBrowserSettings, client: interfaces::CefClient, settings: &interfaces::CefBrowserSettings,
inspect_element_at: &types::cef_point_t) -> () { inspect_element_at: &types::cef_point_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1661,7 +1720,8 @@ impl CefBrowserHost {
// instance. // instance.
// //
pub fn close_dev_tools(&self) -> () { pub fn close_dev_tools(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1681,7 +1741,8 @@ impl CefBrowserHost {
pub fn get_navigation_entries(&self, pub fn get_navigation_entries(&self,
visitor: interfaces::CefNavigationEntryVisitor, visitor: interfaces::CefNavigationEntryVisitor,
current_only: libc::c_int) -> () { current_only: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1697,7 +1758,8 @@ impl CefBrowserHost {
// Set whether mouse cursor change is disabled. // Set whether mouse cursor change is disabled.
// //
pub fn set_mouse_cursor_change_disabled(&self, disabled: libc::c_int) -> () { pub fn set_mouse_cursor_change_disabled(&self, disabled: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1712,7 +1774,8 @@ impl CefBrowserHost {
// Returns true (1) if mouse cursor change is disabled. // Returns true (1) if mouse cursor change is disabled.
// //
pub fn is_mouse_cursor_change_disabled(&self) -> libc::c_int { pub fn is_mouse_cursor_change_disabled(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1727,7 +1790,8 @@ impl CefBrowserHost {
// function will replace it with the specified |word|. // function will replace it with the specified |word|.
// //
pub fn replace_misspelling(&self, word: &[u16]) -> () { pub fn replace_misspelling(&self, word: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1742,7 +1806,8 @@ impl CefBrowserHost {
// Add the specified |word| to the spelling dictionary. // Add the specified |word| to the spelling dictionary.
// //
pub fn add_word_to_dictionary(&self, word: &[u16]) -> () { pub fn add_word_to_dictionary(&self, word: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1757,7 +1822,8 @@ impl CefBrowserHost {
// Returns true (1) if window rendering is disabled. // Returns true (1) if window rendering is disabled.
// //
pub fn is_window_rendering_disabled(&self) -> libc::c_int { pub fn is_window_rendering_disabled(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1774,7 +1840,8 @@ impl CefBrowserHost {
// function is only used when window rendering is disabled. // function is only used when window rendering is disabled.
// //
pub fn was_resized(&self) -> () { pub fn was_resized(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1790,7 +1857,8 @@ impl CefBrowserHost {
// hidden. This function is only used when window rendering is disabled. // hidden. This function is only used when window rendering is disabled.
// //
pub fn was_hidden(&self, hidden: libc::c_int) -> () { pub fn was_hidden(&self, hidden: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1810,7 +1878,8 @@ impl CefBrowserHost {
// disabled. // disabled.
// //
pub fn notify_screen_info_changed(&self) -> () { pub fn notify_screen_info_changed(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1826,7 +1895,8 @@ impl CefBrowserHost {
// disabled. // disabled.
// //
pub fn invalidate(&self, ty: types::cef_paint_element_type_t) -> () { pub fn invalidate(&self, ty: types::cef_paint_element_type_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1841,7 +1911,8 @@ impl CefBrowserHost {
// Send a key event to the browser. // Send a key event to the browser.
// //
pub fn send_key_event(&self, event: &interfaces::CefKeyEvent) -> () { pub fn send_key_event(&self, event: &interfaces::CefKeyEvent) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1859,7 +1930,8 @@ impl CefBrowserHost {
pub fn send_mouse_click_event(&self, event: &interfaces::CefMouseEvent, pub fn send_mouse_click_event(&self, event: &interfaces::CefMouseEvent,
ty: types::cef_mouse_button_type_t, mouseUp: libc::c_int, ty: types::cef_mouse_button_type_t, mouseUp: libc::c_int,
clickCount: libc::c_int) -> () { clickCount: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1879,7 +1951,8 @@ impl CefBrowserHost {
// //
pub fn send_mouse_move_event(&self, event: &interfaces::CefMouseEvent, pub fn send_mouse_move_event(&self, event: &interfaces::CefMouseEvent,
mouseLeave: libc::c_int) -> () { mouseLeave: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1900,7 +1973,8 @@ impl CefBrowserHost {
// //
pub fn send_mouse_wheel_event(&self, event: &interfaces::CefMouseEvent, pub fn send_mouse_wheel_event(&self, event: &interfaces::CefMouseEvent,
deltaX: libc::c_int, deltaY: libc::c_int) -> () { deltaX: libc::c_int, deltaY: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1917,7 +1991,8 @@ impl CefBrowserHost {
// Send a focus event to the browser. // Send a focus event to the browser.
// //
pub fn send_focus_event(&self, setFocus: libc::c_int) -> () { pub fn send_focus_event(&self, setFocus: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1932,7 +2007,8 @@ impl CefBrowserHost {
// Send a capture lost event to the browser. // Send a capture lost event to the browser.
// //
pub fn send_capture_lost_event(&self) -> () { pub fn send_capture_lost_event(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1947,7 +2023,8 @@ impl CefBrowserHost {
// resized. This function is only used on Windows and Linux. // resized. This function is only used on Windows and Linux.
// //
pub fn notify_move_or_resize_started(&self) -> () { pub fn notify_move_or_resize_started(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1962,7 +2039,8 @@ impl CefBrowserHost {
// window rendering is disabled. // window rendering is disabled.
// //
pub fn get_nstext_input_context(&self) -> types::cef_text_input_context_t { pub fn get_nstext_input_context(&self) -> types::cef_text_input_context_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1978,7 +2056,8 @@ impl CefBrowserHost {
// //
pub fn handle_key_event_before_text_input_client(&self, pub fn handle_key_event_before_text_input_client(&self,
keyEvent: types::cef_event_handle_t) -> () { keyEvent: types::cef_event_handle_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1994,7 +2073,8 @@ impl CefBrowserHost {
// //
pub fn handle_key_event_after_text_input_client(&self, pub fn handle_key_event_after_text_input_client(&self,
keyEvent: types::cef_event_handle_t) -> () { keyEvent: types::cef_event_handle_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2017,7 +2097,8 @@ impl CefBrowserHost {
pub fn drag_target_drag_enter(&self, drag_data: interfaces::CefDragData, pub fn drag_target_drag_enter(&self, drag_data: interfaces::CefDragData,
event: &interfaces::CefMouseEvent, event: &interfaces::CefMouseEvent,
allowed_ops: types::cef_drag_operations_mask_t) -> () { allowed_ops: types::cef_drag_operations_mask_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2038,7 +2119,8 @@ impl CefBrowserHost {
// //
pub fn drag_target_drag_over(&self, event: &interfaces::CefMouseEvent, pub fn drag_target_drag_over(&self, event: &interfaces::CefMouseEvent,
allowed_ops: types::cef_drag_operations_mask_t) -> () { allowed_ops: types::cef_drag_operations_mask_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2056,7 +2138,8 @@ impl CefBrowserHost {
// rendering is disabled. // rendering is disabled.
// //
pub fn drag_target_drag_leave(&self) -> () { pub fn drag_target_drag_leave(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2074,7 +2157,8 @@ impl CefBrowserHost {
// is disabled. // is disabled.
// //
pub fn drag_target_drop(&self, event: &interfaces::CefMouseEvent) -> () { pub fn drag_target_drop(&self, event: &interfaces::CefMouseEvent) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2096,7 +2180,8 @@ impl CefBrowserHost {
// //
pub fn drag_source_ended_at(&self, x: libc::c_int, y: libc::c_int, pub fn drag_source_ended_at(&self, x: libc::c_int, y: libc::c_int,
op: types::cef_drag_operations_mask_t) -> () { op: types::cef_drag_operations_mask_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2118,7 +2203,8 @@ impl CefBrowserHost {
// This function is only used when window rendering is disabled. // This function is only used when window rendering is disabled.
// //
pub fn drag_source_system_drag_ended(&self) -> () { pub fn drag_source_system_drag_ended(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2134,7 +2220,8 @@ impl CefBrowserHost {
// this function. // this function.
// //
pub fn initialize_compositing(&self) -> () { pub fn initialize_compositing(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -2203,7 +2290,8 @@ impl CefWrap<*mut cef_browser_host_t> for Option<CefBrowserHost> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_browser_host_t) -> Option<CefBrowserHost> { unsafe fn to_rust(c_object: *mut cef_browser_host_t) -> Option<CefBrowserHost> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefBrowserHost::from_c_object_addref(c_object)) Some(CefBrowserHost::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -96,13 +97,13 @@ pub struct _cef_browser_process_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_browser_process_handler_t = _cef_browser_process_handler_t; pub type cef_browser_process_handler_t = _cef_browser_process_handler_t;
@ -119,7 +120,8 @@ pub struct CefBrowserProcessHandler {
impl Clone for CefBrowserProcessHandler { impl Clone for CefBrowserProcessHandler {
fn clone(&self) -> CefBrowserProcessHandler{ fn clone(&self) -> CefBrowserProcessHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefBrowserProcessHandler { CefBrowserProcessHandler {
@ -132,7 +134,8 @@ impl Clone for CefBrowserProcessHandler {
impl Drop for CefBrowserProcessHandler { impl Drop for CefBrowserProcessHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -147,7 +150,8 @@ impl CefBrowserProcessHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_process_handler_t) -> CefBrowserProcessHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_process_handler_t) -> CefBrowserProcessHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefBrowserProcessHandler { CefBrowserProcessHandler {
@ -161,7 +165,8 @@ impl CefBrowserProcessHandler {
pub fn c_object_addrefed(&self) -> *mut cef_browser_process_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_browser_process_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -169,10 +174,10 @@ impl CefBrowserProcessHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -180,7 +185,8 @@ impl CefBrowserProcessHandler {
// has been initialized. // has been initialized.
// //
pub fn on_context_initialized(&self) -> () { pub fn on_context_initialized(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -199,7 +205,8 @@ impl CefBrowserProcessHandler {
// //
pub fn on_before_child_process_launch(&self, pub fn on_before_child_process_launch(&self,
command_line: interfaces::CefCommandLine) -> () { command_line: interfaces::CefCommandLine) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -219,7 +226,8 @@ impl CefBrowserProcessHandler {
// //
pub fn on_render_process_thread_created(&self, pub fn on_render_process_thread_created(&self,
extra_info: interfaces::CefListValue) -> () { extra_info: interfaces::CefListValue) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -235,7 +243,8 @@ impl CefBrowserProcessHandler {
// provided then printing will not be supported on the Linux platform. // provided then printing will not be supported on the Linux platform.
// //
pub fn get_print_handler(&self) -> interfaces::CefPrintHandler { pub fn get_print_handler(&self) -> interfaces::CefPrintHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -262,7 +271,8 @@ impl CefWrap<*mut cef_browser_process_handler_t> for Option<CefBrowserProcessHan
} }
} }
unsafe fn to_rust(c_object: *mut cef_browser_process_handler_t) -> Option<CefBrowserProcessHandler> { unsafe fn to_rust(c_object: *mut cef_browser_process_handler_t) -> Option<CefBrowserProcessHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefBrowserProcessHandler::from_c_object_addref(c_object)) Some(CefBrowserProcessHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -68,13 +69,13 @@ pub struct _cef_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_callback_t = _cef_callback_t; pub type cef_callback_t = _cef_callback_t;
@ -89,7 +90,8 @@ pub struct CefCallback {
impl Clone for CefCallback { impl Clone for CefCallback {
fn clone(&self) -> CefCallback{ fn clone(&self) -> CefCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefCallback { CefCallback {
@ -102,7 +104,8 @@ impl Clone for CefCallback {
impl Drop for CefCallback { impl Drop for CefCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -117,7 +120,8 @@ impl CefCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_callback_t) -> CefCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_callback_t) -> CefCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefCallback { CefCallback {
@ -131,7 +135,8 @@ impl CefCallback {
pub fn c_object_addrefed(&self) -> *mut cef_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -139,17 +144,18 @@ impl CefCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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 processing. // Continue processing.
// //
pub fn cont(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -163,7 +169,8 @@ impl CefCallback {
// Cancel processing. // Cancel processing.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -190,7 +197,8 @@ impl CefWrap<*mut cef_callback_t> for Option<CefCallback> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_callback_t) -> Option<CefCallback> { unsafe fn to_rust(c_object: *mut cef_callback_t) -> Option<CefCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefCallback::from_c_object_addref(c_object)) Some(CefCallback::from_c_object_addref(c_object))
@ -218,13 +226,13 @@ pub struct _cef_completion_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_completion_callback_t = _cef_completion_callback_t; pub type cef_completion_callback_t = _cef_completion_callback_t;
@ -239,7 +247,8 @@ pub struct CefCompletionCallback {
impl Clone for CefCompletionCallback { impl Clone for CefCompletionCallback {
fn clone(&self) -> CefCompletionCallback{ fn clone(&self) -> CefCompletionCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefCompletionCallback { CefCompletionCallback {
@ -252,7 +261,8 @@ impl Clone for CefCompletionCallback {
impl Drop for CefCompletionCallback { impl Drop for CefCompletionCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -267,7 +277,8 @@ impl CefCompletionCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_completion_callback_t) -> CefCompletionCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_completion_callback_t) -> CefCompletionCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefCompletionCallback { CefCompletionCallback {
@ -281,7 +292,8 @@ impl CefCompletionCallback {
pub fn c_object_addrefed(&self) -> *mut cef_completion_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_completion_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -289,17 +301,18 @@ impl CefCompletionCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Method that will be called once the task is complete. // Method that will be called once the task is complete.
// //
pub fn on_complete(&self) -> () { pub fn on_complete(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -326,7 +339,8 @@ impl CefWrap<*mut cef_completion_callback_t> for Option<CefCompletionCallback> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_completion_callback_t) -> Option<CefCompletionCallback> { unsafe fn to_rust(c_object: *mut cef_completion_callback_t) -> Option<CefCompletionCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefCompletionCallback::from_c_object_addref(c_object)) Some(CefCompletionCallback::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -157,13 +158,13 @@ pub struct _cef_client_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_client_t = _cef_client_t; pub type cef_client_t = _cef_client_t;
@ -178,7 +179,8 @@ pub struct CefClient {
impl Clone for CefClient { impl Clone for CefClient {
fn clone(&self) -> CefClient{ fn clone(&self) -> CefClient{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefClient { CefClient {
@ -191,7 +193,8 @@ impl Clone for CefClient {
impl Drop for CefClient { impl Drop for CefClient {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -206,7 +209,8 @@ impl CefClient {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_client_t) -> CefClient { pub unsafe fn from_c_object_addref(c_object: *mut cef_client_t) -> CefClient {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefClient { CefClient {
@ -220,7 +224,8 @@ impl CefClient {
pub fn c_object_addrefed(&self) -> *mut cef_client_t { pub fn c_object_addrefed(&self) -> *mut cef_client_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -228,10 +233,10 @@ impl CefClient {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -239,7 +244,8 @@ impl CefClient {
// implementation will be used. // implementation will be used.
// //
pub fn get_context_menu_handler(&self) -> interfaces::CefContextMenuHandler { pub fn get_context_menu_handler(&self) -> interfaces::CefContextMenuHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -254,7 +260,8 @@ impl CefClient {
// implementation will be used. // implementation will be used.
// //
pub fn get_dialog_handler(&self) -> interfaces::CefDialogHandler { pub fn get_dialog_handler(&self) -> interfaces::CefDialogHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -268,7 +275,8 @@ impl CefClient {
// Return the handler for browser display state events. // Return the handler for browser display state events.
// //
pub fn get_display_handler(&self) -> interfaces::CefDisplayHandler { pub fn get_display_handler(&self) -> interfaces::CefDisplayHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -283,7 +291,8 @@ impl CefClient {
// will not be allowed. // will not be allowed.
// //
pub fn get_download_handler(&self) -> interfaces::CefDownloadHandler { pub fn get_download_handler(&self) -> interfaces::CefDownloadHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -297,7 +306,8 @@ impl CefClient {
// Return the handler for drag events. // Return the handler for drag events.
// //
pub fn get_drag_handler(&self) -> interfaces::CefDragHandler { pub fn get_drag_handler(&self) -> interfaces::CefDragHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -311,7 +321,8 @@ impl CefClient {
// Return the handler for find result events. // Return the handler for find result events.
// //
pub fn get_find_handler(&self) -> interfaces::CefFindHandler { pub fn get_find_handler(&self) -> interfaces::CefFindHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -325,7 +336,8 @@ impl CefClient {
// Return the handler for focus events. // Return the handler for focus events.
// //
pub fn get_focus_handler(&self) -> interfaces::CefFocusHandler { pub fn get_focus_handler(&self) -> interfaces::CefFocusHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -340,7 +352,8 @@ impl CefClient {
// provided geolocation access will be denied by default. // provided geolocation access will be denied by default.
// //
pub fn get_geolocation_handler(&self) -> interfaces::CefGeolocationHandler { pub fn get_geolocation_handler(&self) -> interfaces::CefGeolocationHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -355,7 +368,8 @@ impl CefClient {
// default implementation will be used. // default implementation will be used.
// //
pub fn get_jsdialog_handler(&self) -> interfaces::CefJSDialogHandler { pub fn get_jsdialog_handler(&self) -> interfaces::CefJSDialogHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -369,7 +383,8 @@ impl CefClient {
// Return the handler for keyboard events. // Return the handler for keyboard events.
// //
pub fn get_keyboard_handler(&self) -> interfaces::CefKeyboardHandler { pub fn get_keyboard_handler(&self) -> interfaces::CefKeyboardHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -383,7 +398,8 @@ impl CefClient {
// Return the handler for browser life span events. // Return the handler for browser life span events.
// //
pub fn get_life_span_handler(&self) -> interfaces::CefLifeSpanHandler { pub fn get_life_span_handler(&self) -> interfaces::CefLifeSpanHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -397,7 +413,8 @@ impl CefClient {
// Return the handler for browser load status events. // Return the handler for browser load status events.
// //
pub fn get_load_handler(&self) -> interfaces::CefLoadHandler { pub fn get_load_handler(&self) -> interfaces::CefLoadHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -411,7 +428,8 @@ impl CefClient {
// Return the handler for off-screen rendering events. // Return the handler for off-screen rendering events.
// //
pub fn get_render_handler(&self) -> interfaces::CefRenderHandler { pub fn get_render_handler(&self) -> interfaces::CefRenderHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -425,7 +443,8 @@ impl CefClient {
// Return the handler for browser request events. // Return the handler for browser request events.
// //
pub fn get_request_handler(&self) -> interfaces::CefRequestHandler { pub fn get_request_handler(&self) -> interfaces::CefRequestHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -443,7 +462,8 @@ impl CefClient {
pub fn on_process_message_received(&self, browser: interfaces::CefBrowser, pub fn on_process_message_received(&self, browser: interfaces::CefBrowser,
source_process: interfaces::CefProcessId, source_process: interfaces::CefProcessId,
message: interfaces::CefProcessMessage) -> libc::c_int { message: interfaces::CefProcessMessage) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -473,7 +493,8 @@ impl CefWrap<*mut cef_client_t> for Option<CefClient> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_client_t) -> Option<CefClient> { unsafe fn to_rust(c_object: *mut cef_client_t) -> Option<CefClient> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefClient::from_c_object_addref(c_object)) Some(CefClient::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -200,13 +201,13 @@ pub struct _cef_command_line_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_command_line_t = _cef_command_line_t; pub type cef_command_line_t = _cef_command_line_t;
@ -228,7 +229,8 @@ pub struct CefCommandLine {
impl Clone for CefCommandLine { impl Clone for CefCommandLine {
fn clone(&self) -> CefCommandLine{ fn clone(&self) -> CefCommandLine{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefCommandLine { CefCommandLine {
@ -241,7 +243,8 @@ impl Clone for CefCommandLine {
impl Drop for CefCommandLine { impl Drop for CefCommandLine {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -256,7 +259,8 @@ impl CefCommandLine {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_command_line_t) -> CefCommandLine { pub unsafe fn from_c_object_addref(c_object: *mut cef_command_line_t) -> CefCommandLine {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefCommandLine { CefCommandLine {
@ -270,7 +274,8 @@ impl CefCommandLine {
pub fn c_object_addrefed(&self) -> *mut cef_command_line_t { pub fn c_object_addrefed(&self) -> *mut cef_command_line_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -278,10 +283,10 @@ impl CefCommandLine {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -289,7 +294,8 @@ impl CefCommandLine {
// if this function returns false (0). // if this function returns false (0).
// //
pub fn is_valid(&self) -> libc::c_int { pub fn is_valid(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -304,7 +310,8 @@ impl CefCommandLine {
// expose read-only objects. // expose read-only objects.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -318,7 +325,8 @@ impl CefCommandLine {
// Returns a writable copy of this object. // Returns a writable copy of this object.
// //
pub fn copy(&self) -> interfaces::CefCommandLine { pub fn copy(&self) -> interfaces::CefCommandLine {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -334,7 +342,8 @@ impl CefCommandLine {
// supported on non-Windows platforms. // supported on non-Windows platforms.
// //
pub fn init_from_argv(&self, argc: libc::c_int, argv: &&str) -> () { pub fn init_from_argv(&self, argc: libc::c_int, argv: &&str) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -351,7 +360,8 @@ impl CefCommandLine {
// GetCommandLineW(). This function is only supported on Windows. // GetCommandLineW(). This function is only supported on Windows.
// //
pub fn init_from_string(&self, command_line: &[u16]) -> () { pub fn init_from_string(&self, command_line: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -367,7 +377,8 @@ impl CefCommandLine {
// component unchanged. // component unchanged.
// //
pub fn reset(&self) -> () { pub fn 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -382,7 +393,8 @@ impl CefCommandLine {
// array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* } // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
// //
pub fn get_argv(&self, argv: Vec<String>) -> () { pub fn get_argv(&self, argv: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -399,7 +411,8 @@ impl CefCommandLine {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_command_line_string(&self) -> String { pub fn get_command_line_string(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -414,7 +427,8 @@ impl CefCommandLine {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_program(&self) -> String { pub fn get_program(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -428,7 +442,8 @@ impl CefCommandLine {
// Set the program part of the command line string (the first item). // Set the program part of the command line string (the first item).
// //
pub fn set_program(&self, program: &[u16]) -> () { pub fn set_program(&self, program: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -443,7 +458,8 @@ impl CefCommandLine {
// Returns true (1) if the command line has switches. // Returns true (1) if the command line has switches.
// //
pub fn has_switches(&self) -> libc::c_int { pub fn has_switches(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -457,7 +473,8 @@ impl CefCommandLine {
// Returns true (1) if the command line contains the given switch. // Returns true (1) if the command line contains the given switch.
// //
pub fn has_switch(&self, name: &[u16]) -> libc::c_int { pub fn has_switch(&self, name: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -474,7 +491,8 @@ impl CefCommandLine {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_switch_value(&self, name: &[u16]) -> String { pub fn get_switch_value(&self, name: &[u16]) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -490,7 +508,8 @@ impl CefCommandLine {
// NULL string is returned. // NULL string is returned.
// //
pub fn get_switches(&self, switches: HashMap<String,String>) -> () { pub fn get_switches(&self, switches: HashMap<String,String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -506,7 +525,8 @@ impl CefCommandLine {
// pass an NULL value string. // pass an NULL value string.
// //
pub fn append_switch(&self, name: &[u16]) -> () { pub fn append_switch(&self, name: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -521,7 +541,8 @@ impl CefCommandLine {
// Add a switch with the specified value to the end of the command line. // Add a switch with the specified value to the end of the command line.
// //
pub fn append_switch_with_value(&self, name: &[u16], value: &[u16]) -> () { pub fn append_switch_with_value(&self, name: &[u16], value: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -537,7 +558,8 @@ impl CefCommandLine {
// True if there are remaining command line arguments. // True if there are remaining command line arguments.
// //
pub fn has_arguments(&self) -> libc::c_int { pub fn has_arguments(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -551,7 +573,8 @@ impl CefCommandLine {
// Get the remaining command line arguments. // Get the remaining command line arguments.
// //
pub fn get_arguments(&self, arguments: Vec<String>) -> () { pub fn get_arguments(&self, arguments: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -566,7 +589,8 @@ impl CefCommandLine {
// Add an argument to the end of the command line. // Add an argument to the end of the command line.
// //
pub fn append_argument(&self, argument: &[u16]) -> () { pub fn append_argument(&self, argument: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -582,7 +606,8 @@ impl CefCommandLine {
// "valgrind" or "gdb --args". // "valgrind" or "gdb --args".
// //
pub fn prepend_wrapper(&self, wrapper: &[u16]) -> () { pub fn prepend_wrapper(&self, wrapper: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -633,7 +658,8 @@ impl CefWrap<*mut cef_command_line_t> for Option<CefCommandLine> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_command_line_t) -> Option<CefCommandLine> { unsafe fn to_rust(c_object: *mut cef_command_line_t) -> Option<CefCommandLine> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefCommandLine::from_c_object_addref(c_object)) Some(CefCommandLine::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -99,13 +100,13 @@ pub struct _cef_context_menu_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_context_menu_handler_t = _cef_context_menu_handler_t; pub type cef_context_menu_handler_t = _cef_context_menu_handler_t;
@ -121,7 +122,8 @@ pub struct CefContextMenuHandler {
impl Clone for CefContextMenuHandler { impl Clone for CefContextMenuHandler {
fn clone(&self) -> CefContextMenuHandler{ fn clone(&self) -> CefContextMenuHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefContextMenuHandler { CefContextMenuHandler {
@ -134,7 +136,8 @@ impl Clone for CefContextMenuHandler {
impl Drop for CefContextMenuHandler { impl Drop for CefContextMenuHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -149,7 +152,8 @@ impl CefContextMenuHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_handler_t) -> CefContextMenuHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_handler_t) -> CefContextMenuHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefContextMenuHandler { CefContextMenuHandler {
@ -163,7 +167,8 @@ impl CefContextMenuHandler {
pub fn c_object_addrefed(&self) -> *mut cef_context_menu_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_context_menu_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -171,10 +176,10 @@ impl CefContextMenuHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -187,7 +192,8 @@ impl CefContextMenuHandler {
pub fn on_before_context_menu(&self, browser: interfaces::CefBrowser, pub fn on_before_context_menu(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams, frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams,
model: interfaces::CefMenuModel) -> () { model: interfaces::CefMenuModel) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -214,7 +220,8 @@ impl CefContextMenuHandler {
frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams, frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams,
command_id: libc::c_int, command_id: libc::c_int,
event_flags: types::cef_event_flags_t) -> libc::c_int { event_flags: types::cef_event_flags_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -235,7 +242,8 @@ impl CefContextMenuHandler {
// //
pub fn on_context_menu_dismissed(&self, browser: interfaces::CefBrowser, pub fn on_context_menu_dismissed(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame) -> () { frame: interfaces::CefFrame) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -264,7 +272,8 @@ impl CefWrap<*mut cef_context_menu_handler_t> for Option<CefContextMenuHandler>
} }
} }
unsafe fn to_rust(c_object: *mut cef_context_menu_handler_t) -> Option<CefContextMenuHandler> { unsafe fn to_rust(c_object: *mut cef_context_menu_handler_t) -> Option<CefContextMenuHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefContextMenuHandler::from_c_object_addref(c_object)) Some(CefContextMenuHandler::from_c_object_addref(c_object))
@ -419,13 +428,13 @@ pub struct _cef_context_menu_params_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_context_menu_params_t = _cef_context_menu_params_t; pub type cef_context_menu_params_t = _cef_context_menu_params_t;
@ -441,7 +450,8 @@ pub struct CefContextMenuParams {
impl Clone for CefContextMenuParams { impl Clone for CefContextMenuParams {
fn clone(&self) -> CefContextMenuParams{ fn clone(&self) -> CefContextMenuParams{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefContextMenuParams { CefContextMenuParams {
@ -454,7 +464,8 @@ impl Clone for CefContextMenuParams {
impl Drop for CefContextMenuParams { impl Drop for CefContextMenuParams {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -469,7 +480,8 @@ impl CefContextMenuParams {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_params_t) -> CefContextMenuParams { pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_params_t) -> CefContextMenuParams {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefContextMenuParams { CefContextMenuParams {
@ -483,7 +495,8 @@ impl CefContextMenuParams {
pub fn c_object_addrefed(&self) -> *mut cef_context_menu_params_t { pub fn c_object_addrefed(&self) -> *mut cef_context_menu_params_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -491,10 +504,10 @@ impl CefContextMenuParams {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -502,7 +515,8 @@ impl CefContextMenuParams {
// Coords are relative to the associated RenderView's origin. // Coords are relative to the associated RenderView's origin.
// //
pub fn get_xcoord(&self) -> libc::c_int { pub fn get_xcoord(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -517,7 +531,8 @@ impl CefContextMenuParams {
// Coords are relative to the associated RenderView's origin. // Coords are relative to the associated RenderView's origin.
// //
pub fn get_ycoord(&self) -> libc::c_int { pub fn get_ycoord(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -532,7 +547,8 @@ impl CefContextMenuParams {
// invoked on. // invoked on.
// //
pub fn get_type_flags(&self) -> types::cef_context_menu_type_flags_t { pub fn get_type_flags(&self) -> types::cef_context_menu_type_flags_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -548,7 +564,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_url(&self) -> String { pub fn get_link_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -564,7 +581,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_unfiltered_link_url(&self) -> String { pub fn get_unfiltered_link_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -580,7 +598,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_source_url(&self) -> String { pub fn get_source_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -595,7 +614,8 @@ impl CefContextMenuParams {
// NULL contents. // NULL contents.
// //
pub fn has_image_contents(&self) -> libc::c_int { pub fn has_image_contents(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -610,7 +630,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_page_url(&self) -> String { pub fn get_page_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -625,7 +646,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_frame_url(&self) -> String { pub fn get_frame_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -641,7 +663,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_frame_charset(&self) -> String { pub fn get_frame_charset(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -655,7 +678,8 @@ impl CefContextMenuParams {
// Returns the type of context node that the context menu was invoked on. // Returns the type of context node that the context menu was invoked on.
// //
pub fn get_media_type(&self) -> types::cef_context_menu_media_type_t { pub fn get_media_type(&self) -> types::cef_context_menu_media_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -671,7 +695,8 @@ impl CefContextMenuParams {
// //
pub fn get_media_state_flags( pub fn get_media_state_flags(
&self) -> types::cef_context_menu_media_state_flags_t { &self) -> types::cef_context_menu_media_state_flags_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -687,7 +712,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_selection_text(&self) -> String { pub fn get_selection_text(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -703,7 +729,8 @@ impl CefContextMenuParams {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_misspelled_word(&self) -> String { pub fn get_misspelled_word(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -720,7 +747,8 @@ impl CefContextMenuParams {
// //
pub fn get_dictionary_suggestions(&self, pub fn get_dictionary_suggestions(&self,
suggestions: Vec<String>) -> libc::c_int { suggestions: Vec<String>) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -735,7 +763,8 @@ impl CefContextMenuParams {
// Returns true (1) if the context menu was invoked on an editable node. // Returns true (1) if the context menu was invoked on an editable node.
// //
pub fn is_editable(&self) -> libc::c_int { pub fn is_editable(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -750,7 +779,8 @@ impl CefContextMenuParams {
// spell-check is enabled. // spell-check is enabled.
// //
pub fn is_spell_check_enabled(&self) -> libc::c_int { pub fn is_spell_check_enabled(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -766,7 +796,8 @@ impl CefContextMenuParams {
// //
pub fn get_edit_state_flags( pub fn get_edit_state_flags(
&self) -> types::cef_context_menu_edit_state_flags_t { &self) -> types::cef_context_menu_edit_state_flags_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -793,7 +824,8 @@ impl CefWrap<*mut cef_context_menu_params_t> for Option<CefContextMenuParams> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_context_menu_params_t) -> Option<CefContextMenuParams> { unsafe fn to_rust(c_object: *mut cef_context_menu_params_t) -> Option<CefContextMenuParams> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefContextMenuParams::from_c_object_addref(c_object)) Some(CefContextMenuParams::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -138,13 +139,13 @@ pub struct _cef_cookie_manager_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_cookie_manager_t = _cef_cookie_manager_t; pub type cef_cookie_manager_t = _cef_cookie_manager_t;
@ -160,7 +161,8 @@ pub struct CefCookieManager {
impl Clone for CefCookieManager { impl Clone for CefCookieManager {
fn clone(&self) -> CefCookieManager{ fn clone(&self) -> CefCookieManager{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefCookieManager { CefCookieManager {
@ -173,7 +175,8 @@ impl Clone for CefCookieManager {
impl Drop for CefCookieManager { impl Drop for CefCookieManager {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -188,7 +191,8 @@ impl CefCookieManager {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_manager_t) -> CefCookieManager { pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_manager_t) -> CefCookieManager {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefCookieManager { CefCookieManager {
@ -202,7 +206,8 @@ impl CefCookieManager {
pub fn c_object_addrefed(&self) -> *mut cef_cookie_manager_t { pub fn c_object_addrefed(&self) -> *mut cef_cookie_manager_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -210,10 +215,10 @@ impl CefCookieManager {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -224,7 +229,8 @@ impl CefCookieManager {
// //
pub fn set_supported_schemes(&self, schemes: Vec<String>, pub fn set_supported_schemes(&self, schemes: Vec<String>,
callback: interfaces::CefCompletionCallback) -> () { callback: interfaces::CefCompletionCallback) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -243,7 +249,8 @@ impl CefCookieManager {
// //
pub fn visit_all_cookies(&self, pub fn visit_all_cookies(&self,
visitor: interfaces::CefCookieVisitor) -> libc::c_int { visitor: interfaces::CefCookieVisitor) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -263,7 +270,8 @@ impl CefCookieManager {
// //
pub fn visit_url_cookies(&self, url: &[u16], includeHttpOnly: libc::c_int, pub fn visit_url_cookies(&self, url: &[u16], includeHttpOnly: libc::c_int,
visitor: interfaces::CefCookieVisitor) -> libc::c_int { visitor: interfaces::CefCookieVisitor) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -287,7 +295,8 @@ impl CefCookieManager {
// //
pub fn set_cookie(&self, url: &[u16], cookie: &interfaces::CefCookie, pub fn set_cookie(&self, url: &[u16], cookie: &interfaces::CefCookie,
callback: interfaces::CefSetCookieCallback) -> libc::c_int { callback: interfaces::CefSetCookieCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -313,7 +322,8 @@ impl CefCookieManager {
// //
pub fn delete_cookies(&self, url: &[u16], cookie_name: &[u16], pub fn delete_cookies(&self, url: &[u16], cookie_name: &[u16],
callback: interfaces::CefDeleteCookiesCallback) -> libc::c_int { callback: interfaces::CefDeleteCookiesCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -339,7 +349,8 @@ impl CefCookieManager {
pub fn set_storage_path(&self, path: &[u16], pub fn set_storage_path(&self, path: &[u16],
persist_session_cookies: libc::c_int, persist_session_cookies: libc::c_int,
callback: interfaces::CefCompletionCallback) -> libc::c_int { callback: interfaces::CefCompletionCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -359,7 +370,8 @@ impl CefCookieManager {
// //
pub fn flush_store(&self, pub fn flush_store(&self,
callback: interfaces::CefCompletionCallback) -> libc::c_int { callback: interfaces::CefCompletionCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -424,7 +436,8 @@ impl CefWrap<*mut cef_cookie_manager_t> for Option<CefCookieManager> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_cookie_manager_t) -> Option<CefCookieManager> { unsafe fn to_rust(c_object: *mut cef_cookie_manager_t) -> Option<CefCookieManager> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefCookieManager::from_c_object_addref(c_object)) Some(CefCookieManager::from_c_object_addref(c_object))
@ -458,13 +471,13 @@ pub struct _cef_cookie_visitor_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_cookie_visitor_t = _cef_cookie_visitor_t; pub type cef_cookie_visitor_t = _cef_cookie_visitor_t;
@ -480,7 +493,8 @@ pub struct CefCookieVisitor {
impl Clone for CefCookieVisitor { impl Clone for CefCookieVisitor {
fn clone(&self) -> CefCookieVisitor{ fn clone(&self) -> CefCookieVisitor{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefCookieVisitor { CefCookieVisitor {
@ -493,7 +507,8 @@ impl Clone for CefCookieVisitor {
impl Drop for CefCookieVisitor { impl Drop for CefCookieVisitor {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -508,7 +523,8 @@ impl CefCookieVisitor {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_visitor_t) -> CefCookieVisitor { pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_visitor_t) -> CefCookieVisitor {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefCookieVisitor { CefCookieVisitor {
@ -522,7 +538,8 @@ impl CefCookieVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_cookie_visitor_t { pub fn c_object_addrefed(&self) -> *mut cef_cookie_visitor_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -530,10 +547,10 @@ impl CefCookieVisitor {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -545,7 +562,8 @@ impl CefCookieVisitor {
// //
pub fn visit(&self, cookie: &interfaces::CefCookie, count: libc::c_int, pub fn visit(&self, cookie: &interfaces::CefCookie, count: libc::c_int,
total: libc::c_int, deleteCookie: &mut libc::c_int) -> libc::c_int { total: libc::c_int, deleteCookie: &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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -576,7 +594,8 @@ impl CefWrap<*mut cef_cookie_visitor_t> for Option<CefCookieVisitor> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_cookie_visitor_t) -> Option<CefCookieVisitor> { unsafe fn to_rust(c_object: *mut cef_cookie_visitor_t) -> Option<CefCookieVisitor> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefCookieVisitor::from_c_object_addref(c_object)) Some(CefCookieVisitor::from_c_object_addref(c_object))
@ -606,13 +625,13 @@ pub struct _cef_set_cookie_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_set_cookie_callback_t = _cef_set_cookie_callback_t; pub type cef_set_cookie_callback_t = _cef_set_cookie_callback_t;
@ -628,7 +647,8 @@ pub struct CefSetCookieCallback {
impl Clone for CefSetCookieCallback { impl Clone for CefSetCookieCallback {
fn clone(&self) -> CefSetCookieCallback{ fn clone(&self) -> CefSetCookieCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefSetCookieCallback { CefSetCookieCallback {
@ -641,7 +661,8 @@ impl Clone for CefSetCookieCallback {
impl Drop for CefSetCookieCallback { impl Drop for CefSetCookieCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -656,7 +677,8 @@ impl CefSetCookieCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_set_cookie_callback_t) -> CefSetCookieCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_set_cookie_callback_t) -> CefSetCookieCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefSetCookieCallback { CefSetCookieCallback {
@ -670,7 +692,8 @@ impl CefSetCookieCallback {
pub fn c_object_addrefed(&self) -> *mut cef_set_cookie_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_set_cookie_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -678,10 +701,10 @@ impl CefSetCookieCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -689,7 +712,8 @@ impl CefSetCookieCallback {
// the cookie was set successfully. // the cookie was set successfully.
// //
pub fn on_complete(&self, success: libc::c_int) -> () { pub fn on_complete(&self, success: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -717,7 +741,8 @@ impl CefWrap<*mut cef_set_cookie_callback_t> for Option<CefSetCookieCallback> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_set_cookie_callback_t) -> Option<CefSetCookieCallback> { unsafe fn to_rust(c_object: *mut cef_set_cookie_callback_t) -> Option<CefSetCookieCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefSetCookieCallback::from_c_object_addref(c_object)) Some(CefSetCookieCallback::from_c_object_addref(c_object))
@ -748,13 +773,13 @@ pub struct _cef_delete_cookies_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_delete_cookies_callback_t = _cef_delete_cookies_callback_t; pub type cef_delete_cookies_callback_t = _cef_delete_cookies_callback_t;
@ -770,7 +795,8 @@ pub struct CefDeleteCookiesCallback {
impl Clone for CefDeleteCookiesCallback { impl Clone for CefDeleteCookiesCallback {
fn clone(&self) -> CefDeleteCookiesCallback{ fn clone(&self) -> CefDeleteCookiesCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDeleteCookiesCallback { CefDeleteCookiesCallback {
@ -783,7 +809,8 @@ impl Clone for CefDeleteCookiesCallback {
impl Drop for CefDeleteCookiesCallback { impl Drop for CefDeleteCookiesCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -798,7 +825,8 @@ impl CefDeleteCookiesCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_delete_cookies_callback_t) -> CefDeleteCookiesCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_delete_cookies_callback_t) -> CefDeleteCookiesCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDeleteCookiesCallback { CefDeleteCookiesCallback {
@ -812,7 +840,8 @@ impl CefDeleteCookiesCallback {
pub fn c_object_addrefed(&self) -> *mut cef_delete_cookies_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_delete_cookies_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -820,10 +849,10 @@ impl CefDeleteCookiesCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -831,7 +860,8 @@ impl CefDeleteCookiesCallback {
// number of cookies that were deleted or -1 if unknown. // number of cookies that were deleted or -1 if unknown.
// //
pub fn on_complete(&self, num_deleted: libc::c_int) -> () { pub fn on_complete(&self, num_deleted: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -859,7 +889,8 @@ impl CefWrap<*mut cef_delete_cookies_callback_t> for Option<CefDeleteCookiesCall
} }
} }
unsafe fn to_rust(c_object: *mut cef_delete_cookies_callback_t) -> Option<CefDeleteCookiesCallback> { unsafe fn to_rust(c_object: *mut cef_delete_cookies_callback_t) -> Option<CefDeleteCookiesCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDeleteCookiesCallback::from_c_object_addref(c_object)) Some(CefDeleteCookiesCallback::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -75,13 +76,13 @@ pub struct _cef_file_dialog_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_file_dialog_callback_t = _cef_file_dialog_callback_t; pub type cef_file_dialog_callback_t = _cef_file_dialog_callback_t;
@ -96,7 +97,8 @@ pub struct CefFileDialogCallback {
impl Clone for CefFileDialogCallback { impl Clone for CefFileDialogCallback {
fn clone(&self) -> CefFileDialogCallback{ fn clone(&self) -> CefFileDialogCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefFileDialogCallback { CefFileDialogCallback {
@ -109,7 +111,8 @@ impl Clone for CefFileDialogCallback {
impl Drop for CefFileDialogCallback { impl Drop for CefFileDialogCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -124,7 +127,8 @@ impl CefFileDialogCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_file_dialog_callback_t) -> CefFileDialogCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_file_dialog_callback_t) -> CefFileDialogCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefFileDialogCallback { CefFileDialogCallback {
@ -138,7 +142,8 @@ impl CefFileDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_file_dialog_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_file_dialog_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -146,10 +151,10 @@ impl CefFileDialogCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -161,7 +166,8 @@ impl CefFileDialogCallback {
// //
pub fn cont(&self, selected_accept_filter: libc::c_int, pub fn cont(&self, selected_accept_filter: libc::c_int,
file_paths: Vec<String>) -> () { file_paths: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -177,7 +183,8 @@ impl CefFileDialogCallback {
// Cancel the file selection. // Cancel the file selection.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -204,7 +211,8 @@ impl CefWrap<*mut cef_file_dialog_callback_t> for Option<CefFileDialogCallback>
} }
} }
unsafe fn to_rust(c_object: *mut cef_file_dialog_callback_t) -> Option<CefFileDialogCallback> { unsafe fn to_rust(c_object: *mut cef_file_dialog_callback_t) -> Option<CefFileDialogCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefFileDialogCallback::from_c_object_addref(c_object)) Some(CefFileDialogCallback::from_c_object_addref(c_object))
@ -250,13 +258,13 @@ pub struct _cef_dialog_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_dialog_handler_t = _cef_dialog_handler_t; pub type cef_dialog_handler_t = _cef_dialog_handler_t;
@ -272,7 +280,8 @@ pub struct CefDialogHandler {
impl Clone for CefDialogHandler { impl Clone for CefDialogHandler {
fn clone(&self) -> CefDialogHandler{ fn clone(&self) -> CefDialogHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDialogHandler { CefDialogHandler {
@ -285,7 +294,8 @@ impl Clone for CefDialogHandler {
impl Drop for CefDialogHandler { impl Drop for CefDialogHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -300,7 +310,8 @@ impl CefDialogHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_dialog_handler_t) -> CefDialogHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_dialog_handler_t) -> CefDialogHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDialogHandler { CefDialogHandler {
@ -314,7 +325,8 @@ impl CefDialogHandler {
pub fn c_object_addrefed(&self) -> *mut cef_dialog_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_dialog_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -322,10 +334,10 @@ impl CefDialogHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -348,7 +360,8 @@ impl CefDialogHandler {
default_file_path: &[u16], accept_filters: Vec<String>, default_file_path: &[u16], accept_filters: Vec<String>,
selected_accept_filter: libc::c_int, selected_accept_filter: libc::c_int,
callback: interfaces::CefFileDialogCallback) -> libc::c_int { callback: interfaces::CefFileDialogCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -382,7 +395,8 @@ impl CefWrap<*mut cef_dialog_handler_t> for Option<CefDialogHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_dialog_handler_t) -> Option<CefDialogHandler> { unsafe fn to_rust(c_object: *mut cef_dialog_handler_t) -> Option<CefDialogHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDialogHandler::from_c_object_addref(c_object)) Some(CefDialogHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -110,13 +111,13 @@ pub struct _cef_display_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_display_handler_t = _cef_display_handler_t; pub type cef_display_handler_t = _cef_display_handler_t;
@ -132,7 +133,8 @@ pub struct CefDisplayHandler {
impl Clone for CefDisplayHandler { impl Clone for CefDisplayHandler {
fn clone(&self) -> CefDisplayHandler{ fn clone(&self) -> CefDisplayHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDisplayHandler { CefDisplayHandler {
@ -145,7 +147,8 @@ impl Clone for CefDisplayHandler {
impl Drop for CefDisplayHandler { impl Drop for CefDisplayHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -160,7 +163,8 @@ impl CefDisplayHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_display_handler_t) -> CefDisplayHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_display_handler_t) -> CefDisplayHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDisplayHandler { CefDisplayHandler {
@ -174,7 +178,8 @@ impl CefDisplayHandler {
pub fn c_object_addrefed(&self) -> *mut cef_display_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_display_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -182,10 +187,10 @@ impl CefDisplayHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -193,7 +198,8 @@ impl CefDisplayHandler {
// //
pub fn on_address_change(&self, browser: interfaces::CefBrowser, pub fn on_address_change(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, url: &[u16]) -> () { frame: interfaces::CefFrame, url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -211,7 +217,8 @@ impl CefDisplayHandler {
// //
pub fn on_title_change(&self, browser: interfaces::CefBrowser, pub fn on_title_change(&self, browser: interfaces::CefBrowser,
title: &[u16]) -> () { title: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -228,7 +235,8 @@ impl CefDisplayHandler {
// //
pub fn on_favicon_urlchange(&self, browser: interfaces::CefBrowser, pub fn on_favicon_urlchange(&self, browser: interfaces::CefBrowser,
icon_urls: Vec<String>) -> () { icon_urls: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -250,7 +258,8 @@ impl CefDisplayHandler {
// //
pub fn on_tooltip(&self, browser: interfaces::CefBrowser, pub fn on_tooltip(&self, browser: interfaces::CefBrowser,
text: *mut types::cef_string_t) -> libc::c_int { text: *mut types::cef_string_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -268,7 +277,8 @@ impl CefDisplayHandler {
// //
pub fn on_status_message(&self, browser: interfaces::CefBrowser, pub fn on_status_message(&self, browser: interfaces::CefBrowser,
value: &[u16]) -> () { value: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -286,7 +296,8 @@ impl CefDisplayHandler {
// //
pub fn on_console_message(&self, browser: interfaces::CefBrowser, pub fn on_console_message(&self, browser: interfaces::CefBrowser,
message: &[u16], source: &[u16], line: libc::c_int) -> libc::c_int { message: &[u16], source: &[u16], line: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -317,7 +328,8 @@ impl CefWrap<*mut cef_display_handler_t> for Option<CefDisplayHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_display_handler_t) -> Option<CefDisplayHandler> { unsafe fn to_rust(c_object: *mut cef_display_handler_t) -> Option<CefDisplayHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDisplayHandler::from_c_object_addref(c_object)) Some(CefDisplayHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -69,13 +70,13 @@ pub struct _cef_domvisitor_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_domvisitor_t = _cef_domvisitor_t; pub type cef_domvisitor_t = _cef_domvisitor_t;
@ -91,7 +92,8 @@ pub struct CefDOMVisitor {
impl Clone for CefDOMVisitor { impl Clone for CefDOMVisitor {
fn clone(&self) -> CefDOMVisitor{ fn clone(&self) -> CefDOMVisitor{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDOMVisitor { CefDOMVisitor {
@ -104,7 +106,8 @@ impl Clone for CefDOMVisitor {
impl Drop for CefDOMVisitor { impl Drop for CefDOMVisitor {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -119,7 +122,8 @@ impl CefDOMVisitor {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_domvisitor_t) -> CefDOMVisitor { pub unsafe fn from_c_object_addref(c_object: *mut cef_domvisitor_t) -> CefDOMVisitor {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDOMVisitor { CefDOMVisitor {
@ -133,7 +137,8 @@ impl CefDOMVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_domvisitor_t { pub fn c_object_addrefed(&self) -> *mut cef_domvisitor_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -141,10 +146,10 @@ impl CefDOMVisitor {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -155,7 +160,8 @@ impl CefDOMVisitor {
// of this function. // of this function.
// //
pub fn visit(&self, document: interfaces::CefDOMDocument) -> () { pub fn visit(&self, document: interfaces::CefDOMDocument) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -183,7 +189,8 @@ impl CefWrap<*mut cef_domvisitor_t> for Option<CefDOMVisitor> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_domvisitor_t) -> Option<CefDOMVisitor> { unsafe fn to_rust(c_object: *mut cef_domvisitor_t) -> Option<CefDOMVisitor> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDOMVisitor::from_c_object_addref(c_object)) Some(CefDOMVisitor::from_c_object_addref(c_object))
@ -296,13 +303,13 @@ pub struct _cef_domdocument_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_domdocument_t = _cef_domdocument_t; pub type cef_domdocument_t = _cef_domdocument_t;
@ -318,7 +325,8 @@ pub struct CefDOMDocument {
impl Clone for CefDOMDocument { impl Clone for CefDOMDocument {
fn clone(&self) -> CefDOMDocument{ fn clone(&self) -> CefDOMDocument{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDOMDocument { CefDOMDocument {
@ -331,7 +339,8 @@ impl Clone for CefDOMDocument {
impl Drop for CefDOMDocument { impl Drop for CefDOMDocument {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -346,7 +355,8 @@ impl CefDOMDocument {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_domdocument_t) -> CefDOMDocument { pub unsafe fn from_c_object_addref(c_object: *mut cef_domdocument_t) -> CefDOMDocument {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDOMDocument { CefDOMDocument {
@ -360,7 +370,8 @@ impl CefDOMDocument {
pub fn c_object_addrefed(&self) -> *mut cef_domdocument_t { pub fn c_object_addrefed(&self) -> *mut cef_domdocument_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -368,17 +379,18 @@ impl CefDOMDocument {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns the document type. // Returns the document type.
// //
pub fn get_type(&self) -> types::cef_dom_document_type_t { pub fn get_type(&self) -> types::cef_dom_document_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -392,7 +404,8 @@ impl CefDOMDocument {
// Returns the root document node. // Returns the root document node.
// //
pub fn get_document(&self) -> interfaces::CefDOMNode { pub fn get_document(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -406,7 +419,8 @@ impl CefDOMDocument {
// Returns the BODY node of an HTML document. // Returns the BODY node of an HTML document.
// //
pub fn get_body(&self) -> interfaces::CefDOMNode { pub fn get_body(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -420,7 +434,8 @@ impl CefDOMDocument {
// Returns the HEAD node of an HTML document. // Returns the HEAD node of an HTML document.
// //
pub fn get_head(&self) -> interfaces::CefDOMNode { pub fn get_head(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -435,7 +450,8 @@ impl CefDOMDocument {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_title(&self) -> String { pub fn get_title(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -449,7 +465,8 @@ impl CefDOMDocument {
// Returns the document element with the specified ID value. // Returns the document element with the specified ID value.
// //
pub fn get_element_by_id(&self, id: &[u16]) -> interfaces::CefDOMNode { pub fn get_element_by_id(&self, id: &[u16]) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -464,7 +481,8 @@ impl CefDOMDocument {
// Returns the node that currently has keyboard focus. // Returns the node that currently has keyboard focus.
// //
pub fn get_focused_node(&self) -> interfaces::CefDOMNode { pub fn get_focused_node(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -478,7 +496,8 @@ impl CefDOMDocument {
// Returns true (1) if a portion of the document is selected. // Returns true (1) if a portion of the document is selected.
// //
pub fn has_selection(&self) -> libc::c_int { pub fn has_selection(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -492,7 +511,8 @@ impl CefDOMDocument {
// Returns the selection offset within the start node. // Returns the selection offset within the start node.
// //
pub fn get_selection_start_offset(&self) -> libc::c_int { pub fn get_selection_start_offset(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -506,7 +526,8 @@ impl CefDOMDocument {
// Returns the selection offset within the end node. // Returns the selection offset within the end node.
// //
pub fn get_selection_end_offset(&self) -> libc::c_int { pub fn get_selection_end_offset(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -521,7 +542,8 @@ impl CefDOMDocument {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_selection_as_markup(&self) -> String { pub fn get_selection_as_markup(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -536,7 +558,8 @@ impl CefDOMDocument {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_selection_as_text(&self) -> String { pub fn get_selection_as_text(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -551,7 +574,8 @@ impl CefDOMDocument {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_base_url(&self) -> String { pub fn get_base_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -567,7 +591,8 @@ impl CefDOMDocument {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_complete_url(&self, partialURL: &[u16]) -> String { pub fn get_complete_url(&self, partialURL: &[u16]) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -595,7 +620,8 @@ impl CefWrap<*mut cef_domdocument_t> for Option<CefDOMDocument> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_domdocument_t) -> Option<CefDOMDocument> { unsafe fn to_rust(c_object: *mut cef_domdocument_t) -> Option<CefDOMDocument> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDOMDocument::from_c_object_addref(c_object)) Some(CefDOMDocument::from_c_object_addref(c_object))
@ -780,13 +806,13 @@ pub struct _cef_domnode_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_domnode_t = _cef_domnode_t; pub type cef_domnode_t = _cef_domnode_t;
@ -802,7 +828,8 @@ pub struct CefDOMNode {
impl Clone for CefDOMNode { impl Clone for CefDOMNode {
fn clone(&self) -> CefDOMNode{ fn clone(&self) -> CefDOMNode{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDOMNode { CefDOMNode {
@ -815,7 +842,8 @@ impl Clone for CefDOMNode {
impl Drop for CefDOMNode { impl Drop for CefDOMNode {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -830,7 +858,8 @@ impl CefDOMNode {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_domnode_t) -> CefDOMNode { pub unsafe fn from_c_object_addref(c_object: *mut cef_domnode_t) -> CefDOMNode {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDOMNode { CefDOMNode {
@ -844,7 +873,8 @@ impl CefDOMNode {
pub fn c_object_addrefed(&self) -> *mut cef_domnode_t { pub fn c_object_addrefed(&self) -> *mut cef_domnode_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -852,17 +882,18 @@ impl CefDOMNode {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns the type for this node. // Returns the type for this node.
// //
pub fn get_type(&self) -> types::cef_dom_node_type_t { pub fn get_type(&self) -> types::cef_dom_node_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -876,7 +907,8 @@ impl CefDOMNode {
// Returns true (1) if this is a text node. // Returns true (1) if this is a text node.
// //
pub fn is_text(&self) -> libc::c_int { pub fn is_text(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -890,7 +922,8 @@ impl CefDOMNode {
// Returns true (1) if this is an element node. // Returns true (1) if this is an element node.
// //
pub fn is_element(&self) -> libc::c_int { pub fn is_element(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -904,7 +937,8 @@ impl CefDOMNode {
// Returns true (1) if this is an editable node. // Returns true (1) if this is an editable node.
// //
pub fn is_editable(&self) -> libc::c_int { pub fn is_editable(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -918,7 +952,8 @@ impl CefDOMNode {
// Returns true (1) if this is a form control element node. // Returns true (1) if this is a form control element node.
// //
pub fn is_form_control_element(&self) -> libc::c_int { pub fn is_form_control_element(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -933,7 +968,8 @@ impl CefDOMNode {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_form_control_element_type(&self) -> String { pub fn get_form_control_element_type(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -948,7 +984,8 @@ impl CefDOMNode {
// object. // object.
// //
pub fn is_same(&self, that: interfaces::CefDOMNode) -> libc::c_int { pub fn is_same(&self, that: interfaces::CefDOMNode) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -964,7 +1001,8 @@ impl CefDOMNode {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String { pub fn get_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -979,7 +1017,8 @@ impl CefDOMNode {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_value(&self) -> String { pub fn get_value(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -993,7 +1032,8 @@ impl CefDOMNode {
// Set the value of this node. Returns true (1) on success. // Set the value of this node. Returns true (1) on success.
// //
pub fn set_value(&self, value: &[u16]) -> libc::c_int { pub fn set_value(&self, value: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1009,7 +1049,8 @@ impl CefDOMNode {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_as_markup(&self) -> String { pub fn get_as_markup(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1023,7 +1064,8 @@ impl CefDOMNode {
// Returns the document associated with this node. // Returns the document associated with this node.
// //
pub fn get_document(&self) -> interfaces::CefDOMDocument { pub fn get_document(&self) -> interfaces::CefDOMDocument {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1037,7 +1079,8 @@ impl CefDOMNode {
// Returns the parent node. // Returns the parent node.
// //
pub fn get_parent(&self) -> interfaces::CefDOMNode { pub fn get_parent(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1051,7 +1094,8 @@ impl CefDOMNode {
// Returns the previous sibling node. // Returns the previous sibling node.
// //
pub fn get_previous_sibling(&self) -> interfaces::CefDOMNode { pub fn get_previous_sibling(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1065,7 +1109,8 @@ impl CefDOMNode {
// Returns the next sibling node. // Returns the next sibling node.
// //
pub fn get_next_sibling(&self) -> interfaces::CefDOMNode { pub fn get_next_sibling(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1079,7 +1124,8 @@ impl CefDOMNode {
// Returns true (1) if this node has child nodes. // Returns true (1) if this node has child nodes.
// //
pub fn has_children(&self) -> libc::c_int { pub fn has_children(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1093,7 +1139,8 @@ impl CefDOMNode {
// Return the first child node. // Return the first child node.
// //
pub fn get_first_child(&self) -> interfaces::CefDOMNode { pub fn get_first_child(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1107,7 +1154,8 @@ impl CefDOMNode {
// Returns the last child node. // Returns the last child node.
// //
pub fn get_last_child(&self) -> interfaces::CefDOMNode { pub fn get_last_child(&self) -> interfaces::CefDOMNode {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1125,7 +1173,8 @@ impl CefDOMNode {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_element_tag_name(&self) -> String { pub fn get_element_tag_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1139,7 +1188,8 @@ impl CefDOMNode {
// Returns true (1) if this element has attributes. // Returns true (1) if this element has attributes.
// //
pub fn has_element_attributes(&self) -> libc::c_int { pub fn has_element_attributes(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1153,7 +1203,8 @@ impl CefDOMNode {
// Returns true (1) if this element has an attribute named |attrName|. // Returns true (1) if this element has an attribute named |attrName|.
// //
pub fn has_element_attribute(&self, attrName: &[u16]) -> libc::c_int { pub fn has_element_attribute(&self, attrName: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1169,7 +1220,8 @@ impl CefDOMNode {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_element_attribute(&self, attrName: &[u16]) -> String { pub fn get_element_attribute(&self, attrName: &[u16]) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1184,7 +1236,8 @@ impl CefDOMNode {
// Returns a map of all element attributes. // Returns a map of all element attributes.
// //
pub fn get_element_attributes(&self, attrMap: HashMap<String,String>) -> () { pub fn get_element_attributes(&self, attrMap: HashMap<String,String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1201,7 +1254,8 @@ impl CefDOMNode {
// //
pub fn set_element_attribute(&self, attrName: &[u16], pub fn set_element_attribute(&self, attrName: &[u16],
value: &[u16]) -> libc::c_int { value: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1218,7 +1272,8 @@ impl CefDOMNode {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_element_inner_text(&self) -> String { pub fn get_element_inner_text(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1245,7 +1300,8 @@ impl CefWrap<*mut cef_domnode_t> for Option<CefDOMNode> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_domnode_t) -> Option<CefDOMNode> { unsafe fn to_rust(c_object: *mut cef_domnode_t) -> Option<CefDOMNode> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDOMNode::from_c_object_addref(c_object)) Some(CefDOMNode::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -68,13 +69,13 @@ pub struct _cef_before_download_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_before_download_callback_t = _cef_before_download_callback_t; pub type cef_before_download_callback_t = _cef_before_download_callback_t;
@ -89,7 +90,8 @@ pub struct CefBeforeDownloadCallback {
impl Clone for CefBeforeDownloadCallback { impl Clone for CefBeforeDownloadCallback {
fn clone(&self) -> CefBeforeDownloadCallback{ fn clone(&self) -> CefBeforeDownloadCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefBeforeDownloadCallback { CefBeforeDownloadCallback {
@ -102,7 +104,8 @@ impl Clone for CefBeforeDownloadCallback {
impl Drop for CefBeforeDownloadCallback { impl Drop for CefBeforeDownloadCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -117,7 +120,8 @@ impl CefBeforeDownloadCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_before_download_callback_t) -> CefBeforeDownloadCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_before_download_callback_t) -> CefBeforeDownloadCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefBeforeDownloadCallback { CefBeforeDownloadCallback {
@ -131,7 +135,8 @@ impl CefBeforeDownloadCallback {
pub fn c_object_addrefed(&self) -> *mut cef_before_download_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_before_download_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -139,10 +144,10 @@ impl CefBeforeDownloadCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -152,7 +157,8 @@ impl CefBeforeDownloadCallback {
// (1) if you do wish to show the default "Save As" dialog. // (1) if you do wish to show the default "Save As" dialog.
// //
pub fn cont(&self, download_path: &[u16], show_dialog: libc::c_int) -> () { pub fn cont(&self, download_path: &[u16], show_dialog: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -181,7 +187,8 @@ impl CefWrap<*mut cef_before_download_callback_t> for Option<CefBeforeDownloadCa
} }
} }
unsafe fn to_rust(c_object: *mut cef_before_download_callback_t) -> Option<CefBeforeDownloadCallback> { unsafe fn to_rust(c_object: *mut cef_before_download_callback_t) -> Option<CefBeforeDownloadCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefBeforeDownloadCallback::from_c_object_addref(c_object)) Some(CefBeforeDownloadCallback::from_c_object_addref(c_object))
@ -221,13 +228,13 @@ pub struct _cef_download_item_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_download_item_callback_t = _cef_download_item_callback_t; pub type cef_download_item_callback_t = _cef_download_item_callback_t;
@ -242,7 +249,8 @@ pub struct CefDownloadItemCallback {
impl Clone for CefDownloadItemCallback { impl Clone for CefDownloadItemCallback {
fn clone(&self) -> CefDownloadItemCallback{ fn clone(&self) -> CefDownloadItemCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDownloadItemCallback { CefDownloadItemCallback {
@ -255,7 +263,8 @@ impl Clone for CefDownloadItemCallback {
impl Drop for CefDownloadItemCallback { impl Drop for CefDownloadItemCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -270,7 +279,8 @@ impl CefDownloadItemCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_callback_t) -> CefDownloadItemCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_callback_t) -> CefDownloadItemCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDownloadItemCallback { CefDownloadItemCallback {
@ -284,7 +294,8 @@ impl CefDownloadItemCallback {
pub fn c_object_addrefed(&self) -> *mut cef_download_item_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_download_item_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -292,17 +303,18 @@ impl CefDownloadItemCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Call to cancel the download. // Call to cancel the download.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -316,7 +328,8 @@ impl CefDownloadItemCallback {
// Call to pause the download. // Call to pause the download.
// //
pub fn pause(&self) -> () { pub fn pause(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -330,7 +343,8 @@ impl CefDownloadItemCallback {
// Call to resume the download. // Call to resume the download.
// //
pub fn resume(&self) -> () { pub fn resume(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -357,7 +371,8 @@ impl CefWrap<*mut cef_download_item_callback_t> for Option<CefDownloadItemCallba
} }
} }
unsafe fn to_rust(c_object: *mut cef_download_item_callback_t) -> Option<CefDownloadItemCallback> { unsafe fn to_rust(c_object: *mut cef_download_item_callback_t) -> Option<CefDownloadItemCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDownloadItemCallback::from_c_object_addref(c_object)) Some(CefDownloadItemCallback::from_c_object_addref(c_object))
@ -407,13 +422,13 @@ pub struct _cef_download_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_download_handler_t = _cef_download_handler_t; pub type cef_download_handler_t = _cef_download_handler_t;
@ -429,7 +444,8 @@ pub struct CefDownloadHandler {
impl Clone for CefDownloadHandler { impl Clone for CefDownloadHandler {
fn clone(&self) -> CefDownloadHandler{ fn clone(&self) -> CefDownloadHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDownloadHandler { CefDownloadHandler {
@ -442,7 +458,8 @@ impl Clone for CefDownloadHandler {
impl Drop for CefDownloadHandler { impl Drop for CefDownloadHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -457,7 +474,8 @@ impl CefDownloadHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_handler_t) -> CefDownloadHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_download_handler_t) -> CefDownloadHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDownloadHandler { CefDownloadHandler {
@ -471,7 +489,8 @@ impl CefDownloadHandler {
pub fn c_object_addrefed(&self) -> *mut cef_download_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_download_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -479,10 +498,10 @@ impl CefDownloadHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -495,7 +514,8 @@ impl CefDownloadHandler {
pub fn on_before_download(&self, browser: interfaces::CefBrowser, pub fn on_before_download(&self, browser: interfaces::CefBrowser,
download_item: interfaces::CefDownloadItem, suggested_name: &[u16], download_item: interfaces::CefDownloadItem, suggested_name: &[u16],
callback: interfaces::CefBeforeDownloadCallback) -> () { callback: interfaces::CefBeforeDownloadCallback) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -519,7 +539,8 @@ impl CefDownloadHandler {
pub fn on_download_updated(&self, browser: interfaces::CefBrowser, pub fn on_download_updated(&self, browser: interfaces::CefBrowser,
download_item: interfaces::CefDownloadItem, download_item: interfaces::CefDownloadItem,
callback: interfaces::CefDownloadItemCallback) -> () { callback: interfaces::CefDownloadItemCallback) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -549,7 +570,8 @@ impl CefWrap<*mut cef_download_handler_t> for Option<CefDownloadHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_download_handler_t) -> Option<CefDownloadHandler> { unsafe fn to_rust(c_object: *mut cef_download_handler_t) -> Option<CefDownloadHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDownloadHandler::from_c_object_addref(c_object)) Some(CefDownloadHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -167,13 +168,13 @@ pub struct _cef_download_item_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_download_item_t = _cef_download_item_t; pub type cef_download_item_t = _cef_download_item_t;
@ -188,7 +189,8 @@ pub struct CefDownloadItem {
impl Clone for CefDownloadItem { impl Clone for CefDownloadItem {
fn clone(&self) -> CefDownloadItem{ fn clone(&self) -> CefDownloadItem{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDownloadItem { CefDownloadItem {
@ -201,7 +203,8 @@ impl Clone for CefDownloadItem {
impl Drop for CefDownloadItem { impl Drop for CefDownloadItem {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -216,7 +219,8 @@ impl CefDownloadItem {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_t) -> CefDownloadItem { pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_t) -> CefDownloadItem {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDownloadItem { CefDownloadItem {
@ -230,7 +234,8 @@ impl CefDownloadItem {
pub fn c_object_addrefed(&self) -> *mut cef_download_item_t { pub fn c_object_addrefed(&self) -> *mut cef_download_item_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -238,10 +243,10 @@ impl CefDownloadItem {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -249,7 +254,8 @@ impl CefDownloadItem {
// if this function returns false (0). // if this function returns false (0).
// //
pub fn is_valid(&self) -> libc::c_int { pub fn is_valid(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -263,7 +269,8 @@ impl CefDownloadItem {
// Returns true (1) if the download is in progress. // Returns true (1) if the download is in progress.
// //
pub fn is_in_progress(&self) -> libc::c_int { pub fn is_in_progress(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -277,7 +284,8 @@ impl CefDownloadItem {
// Returns true (1) if the download is complete. // Returns true (1) if the download is complete.
// //
pub fn is_complete(&self) -> libc::c_int { pub fn is_complete(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -291,7 +299,8 @@ impl CefDownloadItem {
// Returns true (1) if the download has been canceled or interrupted. // Returns true (1) if the download has been canceled or interrupted.
// //
pub fn is_canceled(&self) -> libc::c_int { pub fn is_canceled(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -305,7 +314,8 @@ impl CefDownloadItem {
// Returns a simple speed estimate in bytes/s. // Returns a simple speed estimate in bytes/s.
// //
pub fn get_current_speed(&self) -> i64 { pub fn get_current_speed(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -320,7 +330,8 @@ impl CefDownloadItem {
// unknown. // unknown.
// //
pub fn get_percent_complete(&self) -> libc::c_int { pub fn get_percent_complete(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -334,7 +345,8 @@ impl CefDownloadItem {
// Returns the total number of bytes. // Returns the total number of bytes.
// //
pub fn get_total_bytes(&self) -> i64 { pub fn get_total_bytes(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -348,7 +360,8 @@ impl CefDownloadItem {
// Returns the number of received bytes. // Returns the number of received bytes.
// //
pub fn get_received_bytes(&self) -> i64 { pub fn get_received_bytes(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -362,7 +375,8 @@ impl CefDownloadItem {
// Returns the time that the download started. // Returns the time that the download started.
// //
pub fn get_start_time(&self) -> types::cef_time_t { pub fn get_start_time(&self) -> types::cef_time_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -376,7 +390,8 @@ impl CefDownloadItem {
// Returns the time that the download ended. // Returns the time that the download ended.
// //
pub fn get_end_time(&self) -> types::cef_time_t { pub fn get_end_time(&self) -> types::cef_time_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -391,7 +406,8 @@ impl CefDownloadItem {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_full_path(&self) -> String { pub fn get_full_path(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -405,7 +421,8 @@ impl CefDownloadItem {
// Returns the unique identifier for this download. // Returns the unique identifier for this download.
// //
pub fn get_id(&self) -> u32 { pub fn get_id(&self) -> u32 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -420,7 +437,8 @@ impl CefDownloadItem {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String { pub fn get_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -435,7 +453,8 @@ impl CefDownloadItem {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_original_url(&self) -> String { pub fn get_original_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -450,7 +469,8 @@ impl CefDownloadItem {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_suggested_file_name(&self) -> String { pub fn get_suggested_file_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -465,7 +485,8 @@ impl CefDownloadItem {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_content_disposition(&self) -> String { pub fn get_content_disposition(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -480,7 +501,8 @@ impl CefDownloadItem {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_mime_type(&self) -> String { pub fn get_mime_type(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -507,7 +529,8 @@ impl CefWrap<*mut cef_download_item_t> for Option<CefDownloadItem> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_download_item_t) -> Option<CefDownloadItem> { unsafe fn to_rust(c_object: *mut cef_download_item_t) -> Option<CefDownloadItem> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDownloadItem::from_c_object_addref(c_object)) Some(CefDownloadItem::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -204,13 +205,13 @@ pub struct _cef_drag_data_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_drag_data_t = _cef_drag_data_t; pub type cef_drag_data_t = _cef_drag_data_t;
@ -226,7 +227,8 @@ pub struct CefDragData {
impl Clone for CefDragData { impl Clone for CefDragData {
fn clone(&self) -> CefDragData{ fn clone(&self) -> CefDragData{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDragData { CefDragData {
@ -239,7 +241,8 @@ impl Clone for CefDragData {
impl Drop for CefDragData { impl Drop for CefDragData {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -254,7 +257,8 @@ impl CefDragData {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_data_t) -> CefDragData { pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_data_t) -> CefDragData {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDragData { CefDragData {
@ -268,7 +272,8 @@ impl CefDragData {
pub fn c_object_addrefed(&self) -> *mut cef_drag_data_t { pub fn c_object_addrefed(&self) -> *mut cef_drag_data_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -276,17 +281,18 @@ impl CefDragData {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns a copy of the current object. // Returns a copy of the current object.
// //
pub fn clone(&self) -> interfaces::CefDragData { pub fn clone(&self) -> interfaces::CefDragData {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -300,7 +306,8 @@ impl CefDragData {
// Returns true (1) if this object is read-only. // Returns true (1) if this object is read-only.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -314,7 +321,8 @@ impl CefDragData {
// Returns true (1) if the drag data is a link. // Returns true (1) if the drag data is a link.
// //
pub fn is_link(&self) -> libc::c_int { pub fn is_link(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -328,7 +336,8 @@ impl CefDragData {
// Returns true (1) if the drag data is a text or html fragment. // Returns true (1) if the drag data is a text or html fragment.
// //
pub fn is_fragment(&self) -> libc::c_int { pub fn is_fragment(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -342,7 +351,8 @@ impl CefDragData {
// Returns true (1) if the drag data is a file. // Returns true (1) if the drag data is a file.
// //
pub fn is_file(&self) -> libc::c_int { pub fn is_file(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -357,7 +367,8 @@ impl CefDragData {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_url(&self) -> String { pub fn get_link_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -372,7 +383,8 @@ impl CefDragData {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_title(&self) -> String { pub fn get_link_title(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -387,7 +399,8 @@ impl CefDragData {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_metadata(&self) -> String { pub fn get_link_metadata(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -402,7 +415,8 @@ impl CefDragData {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_fragment_text(&self) -> String { pub fn get_fragment_text(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -417,7 +431,8 @@ impl CefDragData {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_fragment_html(&self) -> String { pub fn get_fragment_html(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -433,7 +448,8 @@ impl CefDragData {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_fragment_base_url(&self) -> String { pub fn get_fragment_base_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -448,7 +464,8 @@ impl CefDragData {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_file_name(&self) -> String { pub fn get_file_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -466,7 +483,8 @@ impl CefDragData {
// //
pub fn get_file_contents(&self, pub fn get_file_contents(&self,
writer: interfaces::CefStreamWriter) -> libc::size_t { writer: interfaces::CefStreamWriter) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -482,7 +500,8 @@ impl CefDragData {
// window. // window.
// //
pub fn get_file_names(&self, names: Vec<String>) -> libc::c_int { pub fn get_file_names(&self, names: Vec<String>) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -497,7 +516,8 @@ impl CefDragData {
// Set the link URL that is being dragged. // Set the link URL that is being dragged.
// //
pub fn set_link_url(&self, url: &[u16]) -> () { pub fn set_link_url(&self, url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -512,7 +532,8 @@ impl CefDragData {
// Set the title associated with the link being dragged. // Set the title associated with the link being dragged.
// //
pub fn set_link_title(&self, title: &[u16]) -> () { pub fn set_link_title(&self, title: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -527,7 +548,8 @@ impl CefDragData {
// Set the metadata associated with the link being dragged. // Set the metadata associated with the link being dragged.
// //
pub fn set_link_metadata(&self, data: &[u16]) -> () { pub fn set_link_metadata(&self, data: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -542,7 +564,8 @@ impl CefDragData {
// Set the plain text fragment that is being dragged. // Set the plain text fragment that is being dragged.
// //
pub fn set_fragment_text(&self, text: &[u16]) -> () { pub fn set_fragment_text(&self, text: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -557,7 +580,8 @@ impl CefDragData {
// Set the text/html fragment that is being dragged. // Set the text/html fragment that is being dragged.
// //
pub fn set_fragment_html(&self, html: &[u16]) -> () { pub fn set_fragment_html(&self, html: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -572,7 +596,8 @@ impl CefDragData {
// Set the base URL that the fragment came from. // Set the base URL that the fragment came from.
// //
pub fn set_fragment_base_url(&self, base_url: &[u16]) -> () { pub fn set_fragment_base_url(&self, base_url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -589,7 +614,8 @@ impl CefDragData {
// to drag in this kind of data. // to drag in this kind of data.
// //
pub fn reset_file_contents(&self) -> () { pub fn reset_file_contents(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -603,7 +629,8 @@ impl CefDragData {
// Add a file that is being dragged into the webview. // Add a file that is being dragged into the webview.
// //
pub fn add_file(&self, path: &[u16], display_name: &[u16]) -> () { pub fn add_file(&self, path: &[u16], display_name: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -643,7 +670,8 @@ impl CefWrap<*mut cef_drag_data_t> for Option<CefDragData> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_drag_data_t) -> Option<CefDragData> { unsafe fn to_rust(c_object: *mut cef_drag_data_t) -> Option<CefDragData> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDragData::from_c_object_addref(c_object)) Some(CefDragData::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -70,13 +71,13 @@ pub struct _cef_drag_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_drag_handler_t = _cef_drag_handler_t; pub type cef_drag_handler_t = _cef_drag_handler_t;
@ -92,7 +93,8 @@ pub struct CefDragHandler {
impl Clone for CefDragHandler { impl Clone for CefDragHandler {
fn clone(&self) -> CefDragHandler{ fn clone(&self) -> CefDragHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefDragHandler { CefDragHandler {
@ -105,7 +107,8 @@ impl Clone for CefDragHandler {
impl Drop for CefDragHandler { impl Drop for CefDragHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -120,7 +123,8 @@ impl CefDragHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_handler_t) -> CefDragHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_handler_t) -> CefDragHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefDragHandler { CefDragHandler {
@ -134,7 +138,8 @@ impl CefDragHandler {
pub fn c_object_addrefed(&self) -> *mut cef_drag_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_drag_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -142,10 +147,10 @@ impl CefDragHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -157,7 +162,8 @@ impl CefDragHandler {
pub fn on_drag_enter(&self, browser: interfaces::CefBrowser, pub fn on_drag_enter(&self, browser: interfaces::CefBrowser,
dragData: interfaces::CefDragData, dragData: interfaces::CefDragData,
mask: types::cef_drag_operations_mask_t) -> libc::c_int { mask: types::cef_drag_operations_mask_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -187,7 +193,8 @@ impl CefWrap<*mut cef_drag_handler_t> for Option<CefDragHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_drag_handler_t) -> Option<CefDragHandler> { unsafe fn to_rust(c_object: *mut cef_drag_handler_t) -> Option<CefDragHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefDragHandler::from_c_object_addref(c_object)) Some(CefDragHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -72,13 +73,13 @@ pub struct _cef_find_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_find_handler_t = _cef_find_handler_t; pub type cef_find_handler_t = _cef_find_handler_t;
@ -94,7 +95,8 @@ pub struct CefFindHandler {
impl Clone for CefFindHandler { impl Clone for CefFindHandler {
fn clone(&self) -> CefFindHandler{ fn clone(&self) -> CefFindHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefFindHandler { CefFindHandler {
@ -107,7 +109,8 @@ impl Clone for CefFindHandler {
impl Drop for CefFindHandler { impl Drop for CefFindHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -122,7 +125,8 @@ impl CefFindHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_find_handler_t) -> CefFindHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_find_handler_t) -> CefFindHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefFindHandler { CefFindHandler {
@ -136,7 +140,8 @@ impl CefFindHandler {
pub fn c_object_addrefed(&self) -> *mut cef_find_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_find_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -144,10 +149,10 @@ impl CefFindHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -162,7 +167,8 @@ impl CefFindHandler {
identifier: libc::c_int, count: libc::c_int, identifier: libc::c_int, count: libc::c_int,
selectionRect: &types::cef_rect_t, activeMatchOrdinal: libc::c_int, selectionRect: &types::cef_rect_t, activeMatchOrdinal: libc::c_int,
finalUpdate: libc::c_int) -> () { finalUpdate: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -195,7 +201,8 @@ impl CefWrap<*mut cef_find_handler_t> for Option<CefFindHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_find_handler_t) -> Option<CefFindHandler> { unsafe fn to_rust(c_object: *mut cef_find_handler_t) -> Option<CefFindHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefFindHandler::from_c_object_addref(c_object)) Some(CefFindHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -83,13 +84,13 @@ pub struct _cef_focus_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_focus_handler_t = _cef_focus_handler_t; pub type cef_focus_handler_t = _cef_focus_handler_t;
@ -105,7 +106,8 @@ pub struct CefFocusHandler {
impl Clone for CefFocusHandler { impl Clone for CefFocusHandler {
fn clone(&self) -> CefFocusHandler{ fn clone(&self) -> CefFocusHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefFocusHandler { CefFocusHandler {
@ -118,7 +120,8 @@ impl Clone for CefFocusHandler {
impl Drop for CefFocusHandler { impl Drop for CefFocusHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -133,7 +136,8 @@ impl CefFocusHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_focus_handler_t) -> CefFocusHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_focus_handler_t) -> CefFocusHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefFocusHandler { CefFocusHandler {
@ -147,7 +151,8 @@ impl CefFocusHandler {
pub fn c_object_addrefed(&self) -> *mut cef_focus_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_focus_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -155,10 +160,10 @@ impl CefFocusHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -169,7 +174,8 @@ impl CefFocusHandler {
// //
pub fn on_take_focus(&self, browser: interfaces::CefBrowser, pub fn on_take_focus(&self, browser: interfaces::CefBrowser,
next: libc::c_int) -> () { next: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -188,7 +194,8 @@ impl CefFocusHandler {
// //
pub fn on_set_focus(&self, browser: interfaces::CefBrowser, pub fn on_set_focus(&self, browser: interfaces::CefBrowser,
source: types::cef_focus_source_t) -> libc::c_int { source: types::cef_focus_source_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -204,7 +211,8 @@ impl CefFocusHandler {
// Called when the browser component has received focus. // Called when the browser component has received focus.
// //
pub fn on_got_focus(&self, browser: interfaces::CefBrowser) -> () { pub fn on_got_focus(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -232,7 +240,8 @@ impl CefWrap<*mut cef_focus_handler_t> for Option<CefFocusHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_focus_handler_t) -> Option<CefFocusHandler> { unsafe fn to_rust(c_object: *mut cef_focus_handler_t) -> Option<CefFocusHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefFocusHandler::from_c_object_addref(c_object)) Some(CefFocusHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -214,13 +215,13 @@ pub struct _cef_frame_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_frame_t = _cef_frame_t; pub type cef_frame_t = _cef_frame_t;
@ -238,7 +239,8 @@ pub struct CefFrame {
impl Clone for CefFrame { impl Clone for CefFrame {
fn clone(&self) -> CefFrame{ fn clone(&self) -> CefFrame{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefFrame { CefFrame {
@ -251,7 +253,8 @@ impl Clone for CefFrame {
impl Drop for CefFrame { impl Drop for CefFrame {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -266,7 +269,8 @@ impl CefFrame {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_frame_t) -> CefFrame { pub unsafe fn from_c_object_addref(c_object: *mut cef_frame_t) -> CefFrame {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefFrame { CefFrame {
@ -280,7 +284,8 @@ impl CefFrame {
pub fn c_object_addrefed(&self) -> *mut cef_frame_t { pub fn c_object_addrefed(&self) -> *mut cef_frame_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -288,17 +293,18 @@ impl CefFrame {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// True if this object is currently attached to a valid frame. // True if this object is currently attached to a valid frame.
// //
pub fn is_valid(&self) -> libc::c_int { pub fn is_valid(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -312,7 +318,8 @@ impl CefFrame {
// Execute undo in this frame. // Execute undo in this frame.
// //
pub fn undo(&self) -> () { pub fn undo(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -326,7 +333,8 @@ impl CefFrame {
// Execute redo in this frame. // Execute redo in this frame.
// //
pub fn redo(&self) -> () { pub fn redo(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -340,7 +348,8 @@ impl CefFrame {
// Execute cut in this frame. // Execute cut in this frame.
// //
pub fn cut(&self) -> () { pub fn cut(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -354,7 +363,8 @@ impl CefFrame {
// Execute copy in this frame. // Execute copy in this frame.
// //
pub fn copy(&self) -> () { pub fn copy(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -368,7 +378,8 @@ impl CefFrame {
// Execute paste in this frame. // Execute paste in this frame.
// //
pub fn paste(&self) -> () { pub fn paste(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -382,7 +393,8 @@ impl CefFrame {
// Execute delete in this frame. // Execute delete in this frame.
// //
pub fn del(&self) -> () { pub fn del(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -396,7 +408,8 @@ impl CefFrame {
// Execute select all in this frame. // Execute select all in this frame.
// //
pub fn select_all(&self) -> () { pub fn select_all(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -412,7 +425,8 @@ impl CefFrame {
// browser process. // browser process.
// //
pub fn view_source(&self) -> () { pub fn view_source(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -427,7 +441,8 @@ impl CefFrame {
// visitor. // visitor.
// //
pub fn get_source(&self, visitor: interfaces::CefStringVisitor) -> () { pub fn get_source(&self, visitor: interfaces::CefStringVisitor) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -443,7 +458,8 @@ impl CefFrame {
// visitor. // visitor.
// //
pub fn get_text(&self, visitor: interfaces::CefStringVisitor) -> () { pub fn get_text(&self, visitor: interfaces::CefStringVisitor) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -458,7 +474,8 @@ impl CefFrame {
// Load the request represented by the |request| object. // Load the request represented by the |request| object.
// //
pub fn load_request(&self, request: interfaces::CefRequest) -> () { pub fn load_request(&self, request: interfaces::CefRequest) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -473,7 +490,8 @@ impl CefFrame {
// Load the specified |url|. // Load the specified |url|.
// //
pub fn load_url(&self, url: &[u16]) -> () { pub fn load_url(&self, url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -490,7 +508,8 @@ impl CefFrame {
// link clicks and web security restrictions may not behave as expected. // link clicks and web security restrictions may not behave as expected.
// //
pub fn load_string(&self, string_val: &[u16], url: &[u16]) -> () { pub fn load_string(&self, string_val: &[u16], url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -511,7 +530,8 @@ impl CefFrame {
// //
pub fn execute_java_script(&self, code: &[u16], script_url: &[u16], pub fn execute_java_script(&self, code: &[u16], script_url: &[u16],
start_line: libc::c_int) -> () { start_line: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -528,7 +548,8 @@ impl CefFrame {
// Returns true (1) if this is the main (top-level) frame. // Returns true (1) if this is the main (top-level) frame.
// //
pub fn is_main(&self) -> libc::c_int { pub fn is_main(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -542,7 +563,8 @@ impl CefFrame {
// Returns true (1) if this is the focused frame. // Returns true (1) if this is the focused frame.
// //
pub fn is_focused(&self) -> libc::c_int { pub fn is_focused(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -561,7 +583,8 @@ impl CefFrame {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String { pub fn get_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -575,7 +598,8 @@ impl CefFrame {
// Returns the globally unique identifier for this frame. // Returns the globally unique identifier for this frame.
// //
pub fn get_identifier(&self) -> i64 { pub fn get_identifier(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -590,7 +614,8 @@ impl CefFrame {
// frame. // frame.
// //
pub fn get_parent(&self) -> interfaces::CefFrame { pub fn get_parent(&self) -> interfaces::CefFrame {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -605,7 +630,8 @@ impl CefFrame {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String { pub fn get_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -619,7 +645,8 @@ impl CefFrame {
// Returns the browser that this frame belongs to. // Returns the browser that this frame belongs to.
// //
pub fn get_browser(&self) -> interfaces::CefBrowser { pub fn get_browser(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -634,7 +661,8 @@ impl CefFrame {
// called from the render process. // called from the render process.
// //
pub fn get_v8context(&self) -> interfaces::CefV8Context { pub fn get_v8context(&self) -> interfaces::CefV8Context {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -649,7 +677,8 @@ impl CefFrame {
// process. // process.
// //
pub fn visit_dom(&self, visitor: interfaces::CefDOMVisitor) -> () { pub fn visit_dom(&self, visitor: interfaces::CefDOMVisitor) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -677,7 +706,8 @@ impl CefWrap<*mut cef_frame_t> for Option<CefFrame> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_frame_t) -> Option<CefFrame> { unsafe fn to_rust(c_object: *mut cef_frame_t) -> Option<CefFrame> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefFrame::from_c_object_addref(c_object)) Some(CefFrame::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -67,13 +68,13 @@ pub struct _cef_get_geolocation_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_get_geolocation_callback_t = _cef_get_geolocation_callback_t; pub type cef_get_geolocation_callback_t = _cef_get_geolocation_callback_t;
@ -89,7 +90,8 @@ pub struct CefGetGeolocationCallback {
impl Clone for CefGetGeolocationCallback { impl Clone for CefGetGeolocationCallback {
fn clone(&self) -> CefGetGeolocationCallback{ fn clone(&self) -> CefGetGeolocationCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefGetGeolocationCallback { CefGetGeolocationCallback {
@ -102,7 +104,8 @@ impl Clone for CefGetGeolocationCallback {
impl Drop for CefGetGeolocationCallback { impl Drop for CefGetGeolocationCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -117,7 +120,8 @@ impl CefGetGeolocationCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_get_geolocation_callback_t) -> CefGetGeolocationCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_get_geolocation_callback_t) -> CefGetGeolocationCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefGetGeolocationCallback { CefGetGeolocationCallback {
@ -131,7 +135,8 @@ impl CefGetGeolocationCallback {
pub fn c_object_addrefed(&self) -> *mut cef_get_geolocation_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_get_geolocation_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -139,10 +144,10 @@ impl CefGetGeolocationCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -151,7 +156,8 @@ impl CefGetGeolocationCallback {
// //
pub fn on_location_update(&self, position: &interfaces::CefGeoposition) -> ( pub fn on_location_update(&self, position: &interfaces::CefGeoposition) -> (
) { ) {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -179,7 +185,8 @@ impl CefWrap<*mut cef_get_geolocation_callback_t> for Option<CefGetGeolocationCa
} }
} }
unsafe fn to_rust(c_object: *mut cef_get_geolocation_callback_t) -> Option<CefGetGeolocationCallback> { unsafe fn to_rust(c_object: *mut cef_get_geolocation_callback_t) -> Option<CefGetGeolocationCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefGetGeolocationCallback::from_c_object_addref(c_object)) Some(CefGetGeolocationCallback::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -65,13 +66,13 @@ pub struct _cef_geolocation_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_geolocation_callback_t = _cef_geolocation_callback_t; pub type cef_geolocation_callback_t = _cef_geolocation_callback_t;
@ -87,7 +88,8 @@ pub struct CefGeolocationCallback {
impl Clone for CefGeolocationCallback { impl Clone for CefGeolocationCallback {
fn clone(&self) -> CefGeolocationCallback{ fn clone(&self) -> CefGeolocationCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefGeolocationCallback { CefGeolocationCallback {
@ -100,7 +102,8 @@ impl Clone for CefGeolocationCallback {
impl Drop for CefGeolocationCallback { impl Drop for CefGeolocationCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -115,7 +118,8 @@ impl CefGeolocationCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_callback_t) -> CefGeolocationCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_callback_t) -> CefGeolocationCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefGeolocationCallback { CefGeolocationCallback {
@ -129,7 +133,8 @@ impl CefGeolocationCallback {
pub fn c_object_addrefed(&self) -> *mut cef_geolocation_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_geolocation_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -137,17 +142,18 @@ impl CefGeolocationCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Call to allow or deny geolocation access. // Call to allow or deny geolocation access.
// //
pub fn cont(&self, allow: libc::c_int) -> () { pub fn cont(&self, allow: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -175,7 +181,8 @@ impl CefWrap<*mut cef_geolocation_callback_t> for Option<CefGeolocationCallback>
} }
} }
unsafe fn to_rust(c_object: *mut cef_geolocation_callback_t) -> Option<CefGeolocationCallback> { unsafe fn to_rust(c_object: *mut cef_geolocation_callback_t) -> Option<CefGeolocationCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefGeolocationCallback::from_c_object_addref(c_object)) Some(CefGeolocationCallback::from_c_object_addref(c_object))
@ -224,13 +231,13 @@ pub struct _cef_geolocation_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_geolocation_handler_t = _cef_geolocation_handler_t; pub type cef_geolocation_handler_t = _cef_geolocation_handler_t;
@ -247,7 +254,8 @@ pub struct CefGeolocationHandler {
impl Clone for CefGeolocationHandler { impl Clone for CefGeolocationHandler {
fn clone(&self) -> CefGeolocationHandler{ fn clone(&self) -> CefGeolocationHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefGeolocationHandler { CefGeolocationHandler {
@ -260,7 +268,8 @@ impl Clone for CefGeolocationHandler {
impl Drop for CefGeolocationHandler { impl Drop for CefGeolocationHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -275,7 +284,8 @@ impl CefGeolocationHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_handler_t) -> CefGeolocationHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_handler_t) -> CefGeolocationHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefGeolocationHandler { CefGeolocationHandler {
@ -289,7 +299,8 @@ impl CefGeolocationHandler {
pub fn c_object_addrefed(&self) -> *mut cef_geolocation_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_geolocation_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -297,10 +308,10 @@ impl CefGeolocationHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -315,7 +326,8 @@ impl CefGeolocationHandler {
browser: interfaces::CefBrowser, requesting_url: &[u16], browser: interfaces::CefBrowser, requesting_url: &[u16],
request_id: libc::c_int, request_id: libc::c_int,
callback: interfaces::CefGeolocationCallback) -> libc::c_int { callback: interfaces::CefGeolocationCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -337,7 +349,8 @@ impl CefGeolocationHandler {
pub fn on_cancel_geolocation_permission(&self, pub fn on_cancel_geolocation_permission(&self,
browser: interfaces::CefBrowser, requesting_url: &[u16], browser: interfaces::CefBrowser, requesting_url: &[u16],
request_id: libc::c_int) -> () { request_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -367,7 +380,8 @@ impl CefWrap<*mut cef_geolocation_handler_t> for Option<CefGeolocationHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_geolocation_handler_t) -> Option<CefGeolocationHandler> { unsafe fn to_rust(c_object: *mut cef_geolocation_handler_t) -> Option<CefGeolocationHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefGeolocationHandler::from_c_object_addref(c_object)) Some(CefGeolocationHandler::from_c_object_addref(c_object))

View file

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

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -81,13 +82,13 @@ pub struct _cef_keyboard_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_keyboard_handler_t = _cef_keyboard_handler_t; pub type cef_keyboard_handler_t = _cef_keyboard_handler_t;
@ -103,7 +104,8 @@ pub struct CefKeyboardHandler {
impl Clone for CefKeyboardHandler { impl Clone for CefKeyboardHandler {
fn clone(&self) -> CefKeyboardHandler{ fn clone(&self) -> CefKeyboardHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefKeyboardHandler { CefKeyboardHandler {
@ -116,7 +118,8 @@ impl Clone for CefKeyboardHandler {
impl Drop for CefKeyboardHandler { impl Drop for CefKeyboardHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -131,7 +134,8 @@ impl CefKeyboardHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_keyboard_handler_t) -> CefKeyboardHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_keyboard_handler_t) -> CefKeyboardHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefKeyboardHandler { CefKeyboardHandler {
@ -145,7 +149,8 @@ impl CefKeyboardHandler {
pub fn c_object_addrefed(&self) -> *mut cef_keyboard_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_keyboard_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -153,10 +158,10 @@ impl CefKeyboardHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// Called before a keyboard event is sent to the renderer. |event| contains // Called before a keyboard event is sent to the renderer. |event| contains
@ -167,7 +172,8 @@ impl CefKeyboardHandler {
pub fn on_pre_key_event(&self, browser: interfaces::CefBrowser, pub fn on_pre_key_event(&self, browser: interfaces::CefBrowser,
event: &interfaces::CefKeyEvent, os_event: types::cef_event_handle_t, event: &interfaces::CefKeyEvent, os_event: types::cef_event_handle_t,
is_keyboard_shortcut: &mut libc::c_int) -> libc::c_int { is_keyboard_shortcut: &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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -190,7 +196,8 @@ impl CefKeyboardHandler {
pub fn on_key_event(&self, browser: interfaces::CefBrowser, pub fn on_key_event(&self, browser: interfaces::CefBrowser,
event: &interfaces::CefKeyEvent, event: &interfaces::CefKeyEvent,
os_event: types::cef_event_handle_t) -> libc::c_int { os_event: types::cef_event_handle_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -220,7 +227,8 @@ impl CefWrap<*mut cef_keyboard_handler_t> for Option<CefKeyboardHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_keyboard_handler_t) -> Option<CefKeyboardHandler> { unsafe fn to_rust(c_object: *mut cef_keyboard_handler_t) -> Option<CefKeyboardHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefKeyboardHandler::from_c_object_addref(c_object)) Some(CefKeyboardHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -175,13 +176,13 @@ pub struct _cef_life_span_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_life_span_handler_t = _cef_life_span_handler_t; pub type cef_life_span_handler_t = _cef_life_span_handler_t;
@ -198,7 +199,8 @@ pub struct CefLifeSpanHandler {
impl Clone for CefLifeSpanHandler { impl Clone for CefLifeSpanHandler {
fn clone(&self) -> CefLifeSpanHandler{ fn clone(&self) -> CefLifeSpanHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefLifeSpanHandler { CefLifeSpanHandler {
@ -211,7 +213,8 @@ impl Clone for CefLifeSpanHandler {
impl Drop for CefLifeSpanHandler { impl Drop for CefLifeSpanHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -226,7 +229,8 @@ impl CefLifeSpanHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_life_span_handler_t) -> CefLifeSpanHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_life_span_handler_t) -> CefLifeSpanHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefLifeSpanHandler { CefLifeSpanHandler {
@ -240,7 +244,8 @@ impl CefLifeSpanHandler {
pub fn c_object_addrefed(&self) -> *mut cef_life_span_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_life_span_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -248,10 +253,10 @@ impl CefLifeSpanHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -280,7 +285,8 @@ impl CefLifeSpanHandler {
client: interfaces::CefClient, client: interfaces::CefClient,
settings: &mut interfaces::CefBrowserSettings, settings: &mut interfaces::CefBrowserSettings,
no_javascript_access: &mut libc::c_int) -> libc::c_int { no_javascript_access: &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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -305,7 +311,8 @@ impl CefLifeSpanHandler {
// Called after a new browser is created. // Called after a new browser is created.
// //
pub fn on_after_created(&self, browser: interfaces::CefBrowser) -> () { pub fn on_after_created(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -322,7 +329,8 @@ impl CefLifeSpanHandler {
// implementation or true (1) to use a custom implementation. // implementation or true (1) to use a custom implementation.
// //
pub fn run_modal(&self, browser: interfaces::CefBrowser) -> libc::c_int { pub fn run_modal(&self, browser: interfaces::CefBrowser) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -391,7 +399,8 @@ impl CefLifeSpanHandler {
// exist. // exist.
// //
pub fn do_close(&self, browser: interfaces::CefBrowser) -> libc::c_int { pub fn do_close(&self, browser: interfaces::CefBrowser) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -411,7 +420,8 @@ impl CefLifeSpanHandler {
// additional usage information. // additional usage information.
// //
pub fn on_before_close(&self, browser: interfaces::CefBrowser) -> () { pub fn on_before_close(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -439,7 +449,8 @@ impl CefWrap<*mut cef_life_span_handler_t> for Option<CefLifeSpanHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_life_span_handler_t) -> Option<CefLifeSpanHandler> { unsafe fn to_rust(c_object: *mut cef_life_span_handler_t) -> Option<CefLifeSpanHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefLifeSpanHandler::from_c_object_addref(c_object)) Some(CefLifeSpanHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -108,13 +109,13 @@ pub struct _cef_load_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_load_handler_t = _cef_load_handler_t; pub type cef_load_handler_t = _cef_load_handler_t;
@ -131,7 +132,8 @@ pub struct CefLoadHandler {
impl Clone for CefLoadHandler { impl Clone for CefLoadHandler {
fn clone(&self) -> CefLoadHandler{ fn clone(&self) -> CefLoadHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefLoadHandler { CefLoadHandler {
@ -144,7 +146,8 @@ impl Clone for CefLoadHandler {
impl Drop for CefLoadHandler { impl Drop for CefLoadHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -159,7 +162,8 @@ impl CefLoadHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_load_handler_t) -> CefLoadHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_load_handler_t) -> CefLoadHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefLoadHandler { CefLoadHandler {
@ -173,7 +177,8 @@ impl CefLoadHandler {
pub fn c_object_addrefed(&self) -> *mut cef_load_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_load_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -181,10 +186,10 @@ impl CefLoadHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -196,7 +201,8 @@ impl CefLoadHandler {
pub fn on_loading_state_change(&self, browser: interfaces::CefBrowser, pub fn on_loading_state_change(&self, browser: interfaces::CefBrowser,
isLoading: libc::c_int, canGoBack: libc::c_int, isLoading: libc::c_int, canGoBack: libc::c_int,
canGoForward: libc::c_int) -> () { canGoForward: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -221,7 +227,8 @@ impl CefLoadHandler {
// //
pub fn on_load_start(&self, browser: interfaces::CefBrowser, pub fn on_load_start(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame) -> () { frame: interfaces::CefFrame) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -243,7 +250,8 @@ impl CefLoadHandler {
// //
pub fn on_load_end(&self, browser: interfaces::CefBrowser, pub fn on_load_end(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, httpStatusCode: libc::c_int) -> () { frame: interfaces::CefFrame, httpStatusCode: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -265,7 +273,8 @@ impl CefLoadHandler {
pub fn on_load_error(&self, browser: interfaces::CefBrowser, pub fn on_load_error(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, errorCode: types::cef_errorcode_t, frame: interfaces::CefFrame, errorCode: types::cef_errorcode_t,
errorText: &[u16], failedUrl: &[u16]) -> () { errorText: &[u16], failedUrl: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -297,7 +306,8 @@ impl CefWrap<*mut cef_load_handler_t> for Option<CefLoadHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_load_handler_t) -> Option<CefLoadHandler> { unsafe fn to_rust(c_object: *mut cef_load_handler_t) -> Option<CefLoadHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefLoadHandler::from_c_object_addref(c_object)) Some(CefLoadHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -401,13 +402,13 @@ pub struct _cef_menu_model_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_menu_model_t = _cef_menu_model_t; pub type cef_menu_model_t = _cef_menu_model_t;
@ -425,7 +426,8 @@ pub struct CefMenuModel {
impl Clone for CefMenuModel { impl Clone for CefMenuModel {
fn clone(&self) -> CefMenuModel{ fn clone(&self) -> CefMenuModel{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefMenuModel { CefMenuModel {
@ -438,7 +440,8 @@ impl Clone for CefMenuModel {
impl Drop for CefMenuModel { impl Drop for CefMenuModel {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -453,7 +456,8 @@ impl CefMenuModel {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_menu_model_t) -> CefMenuModel { pub unsafe fn from_c_object_addref(c_object: *mut cef_menu_model_t) -> CefMenuModel {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefMenuModel { CefMenuModel {
@ -467,7 +471,8 @@ impl CefMenuModel {
pub fn c_object_addrefed(&self) -> *mut cef_menu_model_t { pub fn c_object_addrefed(&self) -> *mut cef_menu_model_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -475,17 +480,18 @@ impl CefMenuModel {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Clears the menu. Returns true (1) on success. // Clears the menu. Returns true (1) on success.
// //
pub fn clear(&self) -> libc::c_int { pub fn clear(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -499,7 +505,8 @@ impl CefMenuModel {
// Returns the number of items in this menu. // Returns the number of items in this menu.
// //
pub fn get_count(&self) -> libc::c_int { pub fn get_count(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -513,7 +520,8 @@ impl CefMenuModel {
// Add a separator to the menu. Returns true (1) on success. // Add a separator to the menu. Returns true (1) on success.
// //
pub fn add_separator(&self) -> libc::c_int { pub fn add_separator(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -528,7 +536,8 @@ impl CefMenuModel {
// //
pub fn add_item(&self, command_id: libc::c_int, pub fn add_item(&self, command_id: libc::c_int,
label: &[u16]) -> libc::c_int { label: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -545,7 +554,8 @@ impl CefMenuModel {
// //
pub fn add_check_item(&self, command_id: libc::c_int, pub fn add_check_item(&self, command_id: libc::c_int,
label: &[u16]) -> libc::c_int { label: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -563,7 +573,8 @@ impl CefMenuModel {
// //
pub fn add_radio_item(&self, command_id: libc::c_int, label: &[u16], pub fn add_radio_item(&self, command_id: libc::c_int, label: &[u16],
group_id: libc::c_int) -> libc::c_int { group_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -581,7 +592,8 @@ impl CefMenuModel {
// //
pub fn add_sub_menu(&self, command_id: libc::c_int, pub fn add_sub_menu(&self, command_id: libc::c_int,
label: &[u16]) -> interfaces::CefMenuModel { label: &[u16]) -> interfaces::CefMenuModel {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -598,7 +610,8 @@ impl CefMenuModel {
// on success. // on success.
// //
pub fn insert_separator_at(&self, index: libc::c_int) -> libc::c_int { pub fn insert_separator_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -615,7 +628,8 @@ impl CefMenuModel {
// //
pub fn insert_item_at(&self, index: libc::c_int, command_id: libc::c_int, pub fn insert_item_at(&self, index: libc::c_int, command_id: libc::c_int,
label: &[u16]) -> libc::c_int { label: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -634,7 +648,8 @@ impl CefMenuModel {
// //
pub fn insert_check_item_at(&self, index: libc::c_int, pub fn insert_check_item_at(&self, index: libc::c_int,
command_id: libc::c_int, label: &[u16]) -> libc::c_int { command_id: libc::c_int, label: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -655,7 +670,8 @@ impl CefMenuModel {
pub fn insert_radio_item_at(&self, index: libc::c_int, pub fn insert_radio_item_at(&self, index: libc::c_int,
command_id: libc::c_int, label: &[u16], command_id: libc::c_int, label: &[u16],
group_id: libc::c_int) -> libc::c_int { group_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -675,7 +691,8 @@ impl CefMenuModel {
// //
pub fn insert_sub_menu_at(&self, index: libc::c_int, command_id: libc::c_int, pub fn insert_sub_menu_at(&self, index: libc::c_int, command_id: libc::c_int,
label: &[u16]) -> interfaces::CefMenuModel { label: &[u16]) -> interfaces::CefMenuModel {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -693,7 +710,8 @@ impl CefMenuModel {
// success. // success.
// //
pub fn remove(&self, command_id: libc::c_int) -> libc::c_int { pub fn remove(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -708,7 +726,8 @@ impl CefMenuModel {
// Removes the item at the specified |index|. Returns true (1) on success. // Removes the item at the specified |index|. Returns true (1) on success.
// //
pub fn remove_at(&self, index: libc::c_int) -> libc::c_int { pub fn remove_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -724,7 +743,8 @@ impl CefMenuModel {
// found due to the command id not existing in the menu. // found due to the command id not existing in the menu.
// //
pub fn get_index_of(&self, command_id: libc::c_int) -> libc::c_int { pub fn get_index_of(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -740,7 +760,8 @@ impl CefMenuModel {
// invalid range or the index being a separator. // invalid range or the index being a separator.
// //
pub fn get_command_id_at(&self, index: libc::c_int) -> libc::c_int { pub fn get_command_id_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -756,7 +777,8 @@ impl CefMenuModel {
// //
pub fn set_command_id_at(&self, index: libc::c_int, pub fn set_command_id_at(&self, index: libc::c_int,
command_id: libc::c_int) -> libc::c_int { command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -773,7 +795,8 @@ impl CefMenuModel {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_label(&self, command_id: libc::c_int) -> String { pub fn get_label(&self, command_id: libc::c_int) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -790,7 +813,8 @@ impl CefMenuModel {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_label_at(&self, index: libc::c_int) -> String { pub fn get_label_at(&self, index: libc::c_int) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -806,7 +830,8 @@ impl CefMenuModel {
// //
pub fn set_label(&self, command_id: libc::c_int, pub fn set_label(&self, command_id: libc::c_int,
label: &[u16]) -> libc::c_int { label: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -822,7 +847,8 @@ impl CefMenuModel {
// Set the label at the specified |index|. Returns true (1) on success. // Set the label at the specified |index|. Returns true (1) on success.
// //
pub fn set_label_at(&self, index: libc::c_int, label: &[u16]) -> libc::c_int { pub fn set_label_at(&self, index: libc::c_int, label: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -839,7 +865,8 @@ impl CefMenuModel {
// //
pub fn get_type(&self, pub fn get_type(&self,
command_id: libc::c_int) -> types::cef_menu_item_type_t { command_id: libc::c_int) -> types::cef_menu_item_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -854,7 +881,8 @@ impl CefMenuModel {
// Returns the item type at the specified |index|. // Returns the item type at the specified |index|.
// //
pub fn get_type_at(&self, index: libc::c_int) -> types::cef_menu_item_type_t { pub fn get_type_at(&self, index: libc::c_int) -> types::cef_menu_item_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -869,7 +897,8 @@ impl CefMenuModel {
// Returns the group id for the specified |command_id| or -1 if invalid. // Returns the group id for the specified |command_id| or -1 if invalid.
// //
pub fn get_group_id(&self, command_id: libc::c_int) -> libc::c_int { pub fn get_group_id(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -884,7 +913,8 @@ impl CefMenuModel {
// Returns the group id at the specified |index| or -1 if invalid. // Returns the group id at the specified |index| or -1 if invalid.
// //
pub fn get_group_id_at(&self, index: libc::c_int) -> libc::c_int { pub fn get_group_id_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -901,7 +931,8 @@ impl CefMenuModel {
// //
pub fn set_group_id(&self, command_id: libc::c_int, pub fn set_group_id(&self, command_id: libc::c_int,
group_id: libc::c_int) -> libc::c_int { group_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -918,7 +949,8 @@ impl CefMenuModel {
// //
pub fn set_group_id_at(&self, index: libc::c_int, pub fn set_group_id_at(&self, index: libc::c_int,
group_id: libc::c_int) -> libc::c_int { group_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -935,7 +967,8 @@ impl CefMenuModel {
// //
pub fn get_sub_menu(&self, pub fn get_sub_menu(&self,
command_id: libc::c_int) -> interfaces::CefMenuModel { command_id: libc::c_int) -> interfaces::CefMenuModel {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -951,7 +984,8 @@ impl CefMenuModel {
// //
pub fn get_sub_menu_at(&self, pub fn get_sub_menu_at(&self,
index: libc::c_int) -> interfaces::CefMenuModel { index: libc::c_int) -> interfaces::CefMenuModel {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -966,7 +1000,8 @@ impl CefMenuModel {
// Returns true (1) if the specified |command_id| is visible. // Returns true (1) if the specified |command_id| is visible.
// //
pub fn is_visible(&self, command_id: libc::c_int) -> libc::c_int { pub fn is_visible(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -981,7 +1016,8 @@ impl CefMenuModel {
// Returns true (1) if the specified |index| is visible. // Returns true (1) if the specified |index| is visible.
// //
pub fn is_visible_at(&self, index: libc::c_int) -> libc::c_int { pub fn is_visible_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -998,7 +1034,8 @@ impl CefMenuModel {
// //
pub fn set_visible(&self, command_id: libc::c_int, pub fn set_visible(&self, command_id: libc::c_int,
visible: libc::c_int) -> libc::c_int { visible: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1016,7 +1053,8 @@ impl CefMenuModel {
// //
pub fn set_visible_at(&self, index: libc::c_int, pub fn set_visible_at(&self, index: libc::c_int,
visible: libc::c_int) -> libc::c_int { visible: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1032,7 +1070,8 @@ impl CefMenuModel {
// Returns true (1) if the specified |command_id| is enabled. // Returns true (1) if the specified |command_id| is enabled.
// //
pub fn is_enabled(&self, command_id: libc::c_int) -> libc::c_int { pub fn is_enabled(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1047,7 +1086,8 @@ impl CefMenuModel {
// Returns true (1) if the specified |index| is enabled. // Returns true (1) if the specified |index| is enabled.
// //
pub fn is_enabled_at(&self, index: libc::c_int) -> libc::c_int { pub fn is_enabled_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1064,7 +1104,8 @@ impl CefMenuModel {
// //
pub fn set_enabled(&self, command_id: libc::c_int, pub fn set_enabled(&self, command_id: libc::c_int,
enabled: libc::c_int) -> libc::c_int { enabled: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1082,7 +1123,8 @@ impl CefMenuModel {
// //
pub fn set_enabled_at(&self, index: libc::c_int, pub fn set_enabled_at(&self, index: libc::c_int,
enabled: libc::c_int) -> libc::c_int { enabled: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1099,7 +1141,8 @@ impl CefMenuModel {
// check and radio items. // check and radio items.
// //
pub fn is_checked(&self, command_id: libc::c_int) -> libc::c_int { pub fn is_checked(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1115,7 +1158,8 @@ impl CefMenuModel {
// and radio items. // and radio items.
// //
pub fn is_checked_at(&self, index: libc::c_int) -> libc::c_int { pub fn is_checked_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1132,7 +1176,8 @@ impl CefMenuModel {
// //
pub fn set_checked(&self, command_id: libc::c_int, pub fn set_checked(&self, command_id: libc::c_int,
checked: libc::c_int) -> libc::c_int { checked: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1150,7 +1195,8 @@ impl CefMenuModel {
// //
pub fn set_checked_at(&self, index: libc::c_int, pub fn set_checked_at(&self, index: libc::c_int,
checked: libc::c_int) -> libc::c_int { checked: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1167,7 +1213,8 @@ impl CefMenuModel {
// assigned. // assigned.
// //
pub fn has_accelerator(&self, command_id: libc::c_int) -> libc::c_int { pub fn has_accelerator(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1183,7 +1230,8 @@ impl CefMenuModel {
// assigned. // assigned.
// //
pub fn has_accelerator_at(&self, index: libc::c_int) -> libc::c_int { pub fn has_accelerator_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1201,7 +1249,8 @@ impl CefMenuModel {
pub fn set_accelerator(&self, command_id: libc::c_int, key_code: libc::c_int, pub fn set_accelerator(&self, command_id: libc::c_int, key_code: libc::c_int,
shift_pressed: libc::c_int, ctrl_pressed: libc::c_int, shift_pressed: libc::c_int, ctrl_pressed: libc::c_int,
alt_pressed: libc::c_int) -> libc::c_int { alt_pressed: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1223,7 +1272,8 @@ impl CefMenuModel {
pub fn set_accelerator_at(&self, index: libc::c_int, key_code: libc::c_int, pub fn set_accelerator_at(&self, index: libc::c_int, key_code: libc::c_int,
shift_pressed: libc::c_int, ctrl_pressed: libc::c_int, shift_pressed: libc::c_int, ctrl_pressed: libc::c_int,
alt_pressed: libc::c_int) -> libc::c_int { alt_pressed: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1243,7 +1293,8 @@ impl CefMenuModel {
// true (1) on success. // true (1) on success.
// //
pub fn remove_accelerator(&self, command_id: libc::c_int) -> libc::c_int { pub fn remove_accelerator(&self, command_id: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1259,7 +1310,8 @@ impl CefMenuModel {
// on success. // on success.
// //
pub fn remove_accelerator_at(&self, index: libc::c_int) -> libc::c_int { pub fn remove_accelerator_at(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1278,7 +1330,8 @@ impl CefMenuModel {
key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int, key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int,
ctrl_pressed: &mut libc::c_int, ctrl_pressed: &mut libc::c_int,
alt_pressed: &mut libc::c_int) -> libc::c_int { alt_pressed: &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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1301,7 +1354,8 @@ impl CefMenuModel {
key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int, key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int,
ctrl_pressed: &mut libc::c_int, ctrl_pressed: &mut libc::c_int,
alt_pressed: &mut libc::c_int) -> libc::c_int { alt_pressed: &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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1333,7 +1387,8 @@ impl CefWrap<*mut cef_menu_model_t> for Option<CefMenuModel> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_menu_model_t) -> Option<CefMenuModel> { unsafe fn to_rust(c_object: *mut cef_menu_model_t) -> Option<CefMenuModel> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefMenuModel::from_c_object_addref(c_object)) Some(CefMenuModel::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -131,13 +132,13 @@ pub struct _cef_navigation_entry_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_navigation_entry_t = _cef_navigation_entry_t; pub type cef_navigation_entry_t = _cef_navigation_entry_t;
@ -152,7 +153,8 @@ pub struct CefNavigationEntry {
impl Clone for CefNavigationEntry { impl Clone for CefNavigationEntry {
fn clone(&self) -> CefNavigationEntry{ fn clone(&self) -> CefNavigationEntry{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefNavigationEntry { CefNavigationEntry {
@ -165,7 +167,8 @@ impl Clone for CefNavigationEntry {
impl Drop for CefNavigationEntry { impl Drop for CefNavigationEntry {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -180,7 +183,8 @@ impl CefNavigationEntry {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_t) -> CefNavigationEntry { pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_t) -> CefNavigationEntry {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefNavigationEntry { CefNavigationEntry {
@ -194,7 +198,8 @@ impl CefNavigationEntry {
pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_t { pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -202,10 +207,10 @@ impl CefNavigationEntry {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -213,7 +218,8 @@ impl CefNavigationEntry {
// if this function returns false (0). // if this function returns false (0).
// //
pub fn is_valid(&self) -> libc::c_int { pub fn is_valid(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -229,7 +235,8 @@ impl CefNavigationEntry {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String { pub fn get_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -244,7 +251,8 @@ impl CefNavigationEntry {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_display_url(&self) -> String { pub fn get_display_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -259,7 +267,8 @@ impl CefNavigationEntry {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_original_url(&self) -> String { pub fn get_original_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -274,7 +283,8 @@ impl CefNavigationEntry {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_title(&self) -> String { pub fn get_title(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -289,7 +299,8 @@ impl CefNavigationEntry {
// this page from the previous page. // this page from the previous page.
// //
pub fn get_transition_type(&self) -> types::cef_transition_type_t { pub fn get_transition_type(&self) -> types::cef_transition_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -303,7 +314,8 @@ impl CefNavigationEntry {
// Returns true (1) if this navigation includes post data. // Returns true (1) if this navigation includes post data.
// //
pub fn has_post_data(&self) -> libc::c_int { pub fn has_post_data(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -319,7 +331,8 @@ impl CefNavigationEntry {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_frame_name(&self) -> String { pub fn get_frame_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -335,7 +348,8 @@ impl CefNavigationEntry {
// 0 if the navigation has not yet completed. // 0 if the navigation has not yet completed.
// //
pub fn get_completion_time(&self) -> types::cef_time_t { pub fn get_completion_time(&self) -> types::cef_time_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -351,7 +365,8 @@ impl CefNavigationEntry {
// navigation has not yet completed. // navigation has not yet completed.
// //
pub fn get_http_status_code(&self) -> libc::c_int { pub fn get_http_status_code(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -378,7 +393,8 @@ impl CefWrap<*mut cef_navigation_entry_t> for Option<CefNavigationEntry> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_navigation_entry_t) -> Option<CefNavigationEntry> { unsafe fn to_rust(c_object: *mut cef_navigation_entry_t) -> Option<CefNavigationEntry> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefNavigationEntry::from_c_object_addref(c_object)) Some(CefNavigationEntry::from_c_object_addref(c_object))

View file

@ -43,4 +43,5 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;

View file

@ -43,4 +43,5 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;

View file

@ -43,4 +43,5 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; 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! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_print_dialog_callback_t = _cef_print_dialog_callback_t; pub type cef_print_dialog_callback_t = _cef_print_dialog_callback_t;
@ -91,7 +92,8 @@ pub struct CefPrintDialogCallback {
impl Clone for CefPrintDialogCallback { impl Clone for CefPrintDialogCallback {
fn clone(&self) -> CefPrintDialogCallback{ fn clone(&self) -> CefPrintDialogCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefPrintDialogCallback { CefPrintDialogCallback {
@ -104,7 +106,8 @@ impl Clone for CefPrintDialogCallback {
impl Drop for CefPrintDialogCallback { impl Drop for CefPrintDialogCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*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 { 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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefPrintDialogCallback { CefPrintDialogCallback {
@ -133,7 +137,8 @@ impl CefPrintDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_print_dialog_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_print_dialog_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -141,17 +146,18 @@ impl CefPrintDialogCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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|. // Continue printing with the specified |settings|.
// //
pub fn cont(&self, settings: interfaces::CefPrintSettings) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -166,7 +172,8 @@ impl CefPrintDialogCallback {
// Cancel the printing. // Cancel the printing.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { 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> { 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 None
} else { } else {
Some(CefPrintDialogCallback::from_c_object_addref(c_object)) 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! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_print_job_callback_t = _cef_print_job_callback_t; pub type cef_print_job_callback_t = _cef_print_job_callback_t;
@ -241,7 +249,8 @@ pub struct CefPrintJobCallback {
impl Clone for CefPrintJobCallback { impl Clone for CefPrintJobCallback {
fn clone(&self) -> CefPrintJobCallback{ fn clone(&self) -> CefPrintJobCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefPrintJobCallback { CefPrintJobCallback {
@ -254,7 +263,8 @@ impl Clone for CefPrintJobCallback {
impl Drop for CefPrintJobCallback { impl Drop for CefPrintJobCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*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 { 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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefPrintJobCallback { CefPrintJobCallback {
@ -283,7 +294,8 @@ impl CefPrintJobCallback {
pub fn c_object_addrefed(&self) -> *mut cef_print_job_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_print_job_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -291,17 +303,18 @@ impl CefPrintJobCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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. // Indicate completion of the print job.
// //
pub fn cont(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { 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> { 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 None
} else { } else {
Some(CefPrintJobCallback::from_c_object_addref(c_object)) 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! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_print_handler_t = _cef_print_handler_t; pub type cef_print_handler_t = _cef_print_handler_t;
@ -407,7 +421,8 @@ pub struct CefPrintHandler {
impl Clone for CefPrintHandler { impl Clone for CefPrintHandler {
fn clone(&self) -> CefPrintHandler{ fn clone(&self) -> CefPrintHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefPrintHandler { CefPrintHandler {
@ -420,7 +435,8 @@ impl Clone for CefPrintHandler {
impl Drop for CefPrintHandler { impl Drop for CefPrintHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*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 { 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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefPrintHandler { CefPrintHandler {
@ -449,7 +466,8 @@ impl CefPrintHandler {
pub fn c_object_addrefed(&self) -> *mut cef_print_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_print_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -457,10 +475,10 @@ impl CefPrintHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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, pub fn on_print_settings(&self, settings: interfaces::CefPrintSettings,
get_defaults: libc::c_int) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -489,7 +508,8 @@ impl CefPrintHandler {
// //
pub fn on_print_dialog(&self, has_selection: libc::c_int, pub fn on_print_dialog(&self, has_selection: libc::c_int,
callback: interfaces::CefPrintDialogCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -508,7 +528,8 @@ impl CefPrintHandler {
// //
pub fn on_print_job(&self, document_name: &[u16], pdf_file_path: &[u16], pub fn on_print_job(&self, document_name: &[u16], pdf_file_path: &[u16],
callback: interfaces::CefPrintJobCallback) -> libc::c_int { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -525,7 +546,8 @@ impl CefPrintHandler {
// Reset client state related to printing. // Reset client state related to printing.
// //
pub fn on_print_reset(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { 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> { 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 None
} else { } else {
Some(CefPrintHandler::from_c_object_addref(c_object)) Some(CefPrintHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -206,13 +207,13 @@ pub struct _cef_print_settings_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_print_settings_t = _cef_print_settings_t; pub type cef_print_settings_t = _cef_print_settings_t;
@ -227,7 +228,8 @@ pub struct CefPrintSettings {
impl Clone for CefPrintSettings { impl Clone for CefPrintSettings {
fn clone(&self) -> CefPrintSettings{ fn clone(&self) -> CefPrintSettings{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefPrintSettings { CefPrintSettings {
@ -240,7 +242,8 @@ impl Clone for CefPrintSettings {
impl Drop for CefPrintSettings { impl Drop for CefPrintSettings {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -255,7 +258,8 @@ impl CefPrintSettings {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_settings_t) -> CefPrintSettings { pub unsafe fn from_c_object_addref(c_object: *mut cef_print_settings_t) -> CefPrintSettings {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefPrintSettings { CefPrintSettings {
@ -269,7 +273,8 @@ impl CefPrintSettings {
pub fn c_object_addrefed(&self) -> *mut cef_print_settings_t { pub fn c_object_addrefed(&self) -> *mut cef_print_settings_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -277,10 +282,10 @@ impl CefPrintSettings {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -288,7 +293,8 @@ impl CefPrintSettings {
// if this function returns false (0). // if this function returns false (0).
// //
pub fn is_valid(&self) -> libc::c_int { pub fn is_valid(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -303,7 +309,8 @@ impl CefPrintSettings {
// expose read-only objects. // expose read-only objects.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -317,7 +324,8 @@ impl CefPrintSettings {
// Returns a writable copy of this object. // Returns a writable copy of this object.
// //
pub fn copy(&self) -> interfaces::CefPrintSettings { pub fn copy(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -331,7 +339,8 @@ impl CefPrintSettings {
// Set the page orientation. // Set the page orientation.
// //
pub fn set_orientation(&self, landscape: libc::c_int) -> () { pub fn set_orientation(&self, landscape: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -346,7 +355,8 @@ impl CefPrintSettings {
// Returns true (1) if the orientation is landscape. // Returns true (1) if the orientation is landscape.
// //
pub fn is_landscape(&self) -> libc::c_int { pub fn is_landscape(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -365,7 +375,8 @@ impl CefPrintSettings {
physical_size_device_units: &types::cef_size_t, physical_size_device_units: &types::cef_size_t,
printable_area_device_units: &types::cef_rect_t, printable_area_device_units: &types::cef_rect_t,
landscape_needs_flip: libc::c_int) -> () { landscape_needs_flip: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -382,7 +393,8 @@ impl CefPrintSettings {
// Set the device name. // Set the device name.
// //
pub fn set_device_name(&self, name: &[u16]) -> () { pub fn set_device_name(&self, name: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -398,7 +410,8 @@ impl CefPrintSettings {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_device_name(&self) -> String { pub fn get_device_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -412,7 +425,8 @@ impl CefPrintSettings {
// Set the DPI (dots per inch). // Set the DPI (dots per inch).
// //
pub fn set_dpi(&self, dpi: libc::c_int) -> () { pub fn set_dpi(&self, dpi: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -427,7 +441,8 @@ impl CefPrintSettings {
// Get the DPI (dots per inch). // Get the DPI (dots per inch).
// //
pub fn get_dpi(&self) -> libc::c_int { pub fn get_dpi(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -442,7 +457,8 @@ impl CefPrintSettings {
// //
pub fn set_page_ranges(&self, ranges_count: libc::size_t, pub fn set_page_ranges(&self, ranges_count: libc::size_t,
ranges: *const types::cef_page_range_t) -> () { ranges: *const types::cef_page_range_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -458,7 +474,8 @@ impl CefPrintSettings {
// Returns the number of page ranges that currently exist. // Returns the number of page ranges that currently exist.
// //
pub fn get_page_ranges_count(&self) -> libc::size_t { pub fn get_page_ranges_count(&self) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -473,7 +490,8 @@ impl CefPrintSettings {
// //
pub fn get_page_ranges(&self, ranges_count: *mut libc::size_t, pub fn get_page_ranges(&self, ranges_count: *mut libc::size_t,
ranges: *mut types::cef_page_range_t) -> () { ranges: *mut types::cef_page_range_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -489,7 +507,8 @@ impl CefPrintSettings {
// Set whether only the selection will be printed. // Set whether only the selection will be printed.
// //
pub fn set_selection_only(&self, selection_only: libc::c_int) -> () { pub fn set_selection_only(&self, selection_only: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -504,7 +523,8 @@ impl CefPrintSettings {
// Returns true (1) if only the selection will be printed. // Returns true (1) if only the selection will be printed.
// //
pub fn is_selection_only(&self) -> libc::c_int { pub fn is_selection_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -518,7 +538,8 @@ impl CefPrintSettings {
// Set whether pages will be collated. // Set whether pages will be collated.
// //
pub fn set_collate(&self, collate: libc::c_int) -> () { pub fn set_collate(&self, collate: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -533,7 +554,8 @@ impl CefPrintSettings {
// Returns true (1) if pages will be collated. // Returns true (1) if pages will be collated.
// //
pub fn will_collate(&self) -> libc::c_int { pub fn will_collate(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -547,7 +569,8 @@ impl CefPrintSettings {
// Set the color model. // Set the color model.
// //
pub fn set_color_model(&self, model: types::cef_color_model_t) -> () { pub fn set_color_model(&self, model: types::cef_color_model_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -562,7 +585,8 @@ impl CefPrintSettings {
// Get the color model. // Get the color model.
// //
pub fn get_color_model(&self) -> types::cef_color_model_t { pub fn get_color_model(&self) -> types::cef_color_model_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -576,7 +600,8 @@ impl CefPrintSettings {
// Set the number of copies. // Set the number of copies.
// //
pub fn set_copies(&self, copies: libc::c_int) -> () { pub fn set_copies(&self, copies: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -591,7 +616,8 @@ impl CefPrintSettings {
// Get the number of copies. // Get the number of copies.
// //
pub fn get_copies(&self) -> libc::c_int { pub fn get_copies(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -605,7 +631,8 @@ impl CefPrintSettings {
// Set the duplex mode. // Set the duplex mode.
// //
pub fn set_duplex_mode(&self, mode: types::cef_duplex_mode_t) -> () { pub fn set_duplex_mode(&self, mode: types::cef_duplex_mode_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -620,7 +647,8 @@ impl CefPrintSettings {
// Get the duplex mode. // Get the duplex mode.
// //
pub fn get_duplex_mode(&self) -> types::cef_duplex_mode_t { pub fn get_duplex_mode(&self) -> types::cef_duplex_mode_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -658,7 +686,8 @@ impl CefWrap<*mut cef_print_settings_t> for Option<CefPrintSettings> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_print_settings_t) -> Option<CefPrintSettings> { unsafe fn to_rust(c_object: *mut cef_print_settings_t) -> Option<CefPrintSettings> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefPrintSettings::from_c_object_addref(c_object)) Some(CefPrintSettings::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -91,13 +92,13 @@ pub struct _cef_process_message_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_process_message_t = _cef_process_message_t; pub type cef_process_message_t = _cef_process_message_t;
@ -112,7 +113,8 @@ pub struct CefProcessMessage {
impl Clone for CefProcessMessage { impl Clone for CefProcessMessage {
fn clone(&self) -> CefProcessMessage{ fn clone(&self) -> CefProcessMessage{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefProcessMessage { CefProcessMessage {
@ -125,7 +127,8 @@ impl Clone for CefProcessMessage {
impl Drop for CefProcessMessage { impl Drop for CefProcessMessage {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -140,7 +143,8 @@ impl CefProcessMessage {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_process_message_t) -> CefProcessMessage { pub unsafe fn from_c_object_addref(c_object: *mut cef_process_message_t) -> CefProcessMessage {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefProcessMessage { CefProcessMessage {
@ -154,7 +158,8 @@ impl CefProcessMessage {
pub fn c_object_addrefed(&self) -> *mut cef_process_message_t { pub fn c_object_addrefed(&self) -> *mut cef_process_message_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -162,10 +167,10 @@ impl CefProcessMessage {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -173,7 +178,8 @@ impl CefProcessMessage {
// if this function returns false (0). // if this function returns false (0).
// //
pub fn is_valid(&self) -> libc::c_int { pub fn is_valid(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -188,7 +194,8 @@ impl CefProcessMessage {
// expose read-only objects. // expose read-only objects.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -202,7 +209,8 @@ impl CefProcessMessage {
// Returns a writable copy of this object. // Returns a writable copy of this object.
// //
pub fn copy(&self) -> interfaces::CefProcessMessage { pub fn copy(&self) -> interfaces::CefProcessMessage {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -217,7 +225,8 @@ impl CefProcessMessage {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String { pub fn get_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -231,7 +240,8 @@ impl CefProcessMessage {
// Returns the list of arguments. // Returns the list of arguments.
// //
pub fn get_argument_list(&self) -> interfaces::CefListValue { pub fn get_argument_list(&self) -> interfaces::CefListValue {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -269,7 +279,8 @@ impl CefWrap<*mut cef_process_message_t> for Option<CefProcessMessage> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_process_message_t) -> Option<CefProcessMessage> { unsafe fn to_rust(c_object: *mut cef_process_message_t) -> Option<CefProcessMessage> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefProcessMessage::from_c_object_addref(c_object)) Some(CefProcessMessage::from_c_object_addref(c_object))

View file

@ -43,4 +43,5 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -190,13 +191,13 @@ pub struct _cef_render_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_render_handler_t = _cef_render_handler_t; pub type cef_render_handler_t = _cef_render_handler_t;
@ -212,7 +213,8 @@ pub struct CefRenderHandler {
impl Clone for CefRenderHandler { impl Clone for CefRenderHandler {
fn clone(&self) -> CefRenderHandler{ fn clone(&self) -> CefRenderHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRenderHandler { CefRenderHandler {
@ -225,7 +227,8 @@ impl Clone for CefRenderHandler {
impl Drop for CefRenderHandler { impl Drop for CefRenderHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -240,7 +243,8 @@ impl CefRenderHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_render_handler_t) -> CefRenderHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_render_handler_t) -> CefRenderHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRenderHandler { CefRenderHandler {
@ -254,7 +258,8 @@ impl CefRenderHandler {
pub fn c_object_addrefed(&self) -> *mut cef_render_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_render_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -262,10 +267,10 @@ impl CefRenderHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -274,7 +279,8 @@ impl CefRenderHandler {
// //
pub fn get_root_screen_rect(&self, browser: interfaces::CefBrowser, pub fn get_root_screen_rect(&self, browser: interfaces::CefBrowser,
rect: &mut types::cef_rect_t) -> libc::c_int { rect: &mut types::cef_rect_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -292,7 +298,8 @@ impl CefRenderHandler {
// //
pub fn get_view_rect(&self, browser: interfaces::CefBrowser, pub fn get_view_rect(&self, browser: interfaces::CefBrowser,
rect: &mut types::cef_rect_t) -> libc::c_int { rect: &mut types::cef_rect_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -311,7 +318,8 @@ impl CefRenderHandler {
pub fn get_screen_point(&self, browser: interfaces::CefBrowser, pub fn get_screen_point(&self, browser: interfaces::CefBrowser,
viewX: libc::c_int, viewY: libc::c_int, screenX: &mut libc::c_int, viewX: libc::c_int, viewY: libc::c_int, screenX: &mut libc::c_int,
screenY: &mut libc::c_int) -> libc::c_int { screenY: &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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -337,7 +345,8 @@ impl CefRenderHandler {
// //
pub fn get_screen_info(&self, browser: interfaces::CefBrowser, pub fn get_screen_info(&self, browser: interfaces::CefBrowser,
screen_info: &mut interfaces::CefScreenInfo) -> libc::c_int { screen_info: &mut interfaces::CefScreenInfo) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -355,7 +364,8 @@ impl CefRenderHandler {
// //
pub fn on_popup_show(&self, browser: interfaces::CefBrowser, pub fn on_popup_show(&self, browser: interfaces::CefBrowser,
show: libc::c_int) -> () { show: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -373,7 +383,8 @@ impl CefRenderHandler {
// //
pub fn on_popup_size(&self, browser: interfaces::CefBrowser, pub fn on_popup_size(&self, browser: interfaces::CefBrowser,
rect: &types::cef_rect_t) -> () { rect: &types::cef_rect_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -399,7 +410,8 @@ impl CefRenderHandler {
ty: types::cef_paint_element_type_t, dirtyRects_count: libc::size_t, ty: types::cef_paint_element_type_t, dirtyRects_count: libc::size_t,
dirtyRects: *const types::cef_rect_t, buffer: &(), width: libc::c_int, dirtyRects: *const types::cef_rect_t, buffer: &(), width: libc::c_int,
height: libc::c_int) -> () { height: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -423,7 +435,8 @@ impl CefRenderHandler {
pub fn on_cursor_change(&self, browser: interfaces::CefBrowser, pub fn on_cursor_change(&self, browser: interfaces::CefBrowser,
cursor: types::cef_cursor_handle_t, ty: types::cef_cursor_type_t, cursor: types::cef_cursor_handle_t, ty: types::cef_cursor_type_t,
custom_cursor_info: &interfaces::CefCursorInfo) -> () { custom_cursor_info: &interfaces::CefCursorInfo) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -455,7 +468,8 @@ impl CefRenderHandler {
drag_data: interfaces::CefDragData, drag_data: interfaces::CefDragData,
allowed_ops: types::cef_drag_operations_mask_t, x: libc::c_int, allowed_ops: types::cef_drag_operations_mask_t, x: libc::c_int,
y: libc::c_int) -> libc::c_int { y: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -477,7 +491,8 @@ impl CefRenderHandler {
// //
pub fn update_drag_cursor(&self, browser: interfaces::CefBrowser, pub fn update_drag_cursor(&self, browser: interfaces::CefBrowser,
operation: types::cef_drag_operations_mask_t) -> () { operation: types::cef_drag_operations_mask_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -494,7 +509,8 @@ impl CefRenderHandler {
// //
pub fn on_scroll_offset_changed(&self, browser: interfaces::CefBrowser, pub fn on_scroll_offset_changed(&self, browser: interfaces::CefBrowser,
x: libc::c_double, y: libc::c_double) -> () { x: libc::c_double, y: libc::c_double) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -515,7 +531,8 @@ impl CefRenderHandler {
// //
pub fn get_backing_rect(&self, browser: interfaces::CefBrowser, pub fn get_backing_rect(&self, browser: interfaces::CefBrowser,
rect: &mut types::cef_rect_t) -> libc::c_int { rect: &mut types::cef_rect_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -532,7 +549,8 @@ impl CefRenderHandler {
// flip). This is called only during accelerated compositing. // flip). This is called only during accelerated compositing.
// //
pub fn on_present(&self, browser: interfaces::CefBrowser) -> () { pub fn on_present(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -560,7 +578,8 @@ impl CefWrap<*mut cef_render_handler_t> for Option<CefRenderHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_render_handler_t) -> Option<CefRenderHandler> { unsafe fn to_rust(c_object: *mut cef_render_handler_t) -> Option<CefRenderHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRenderHandler::from_c_object_addref(c_object)) Some(CefRenderHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -173,13 +174,13 @@ pub struct _cef_render_process_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_render_process_handler_t = _cef_render_process_handler_t; pub type cef_render_process_handler_t = _cef_render_process_handler_t;
@ -196,7 +197,8 @@ pub struct CefRenderProcessHandler {
impl Clone for CefRenderProcessHandler { impl Clone for CefRenderProcessHandler {
fn clone(&self) -> CefRenderProcessHandler{ fn clone(&self) -> CefRenderProcessHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRenderProcessHandler { CefRenderProcessHandler {
@ -209,7 +211,8 @@ impl Clone for CefRenderProcessHandler {
impl Drop for CefRenderProcessHandler { impl Drop for CefRenderProcessHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -224,7 +227,8 @@ impl CefRenderProcessHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_render_process_handler_t) -> CefRenderProcessHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_render_process_handler_t) -> CefRenderProcessHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRenderProcessHandler { CefRenderProcessHandler {
@ -238,7 +242,8 @@ impl CefRenderProcessHandler {
pub fn c_object_addrefed(&self) -> *mut cef_render_process_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_render_process_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -246,10 +251,10 @@ impl CefRenderProcessHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -260,7 +265,8 @@ impl CefRenderProcessHandler {
// //
pub fn on_render_thread_created(&self, pub fn on_render_thread_created(&self,
extra_info: interfaces::CefListValue) -> () { extra_info: interfaces::CefListValue) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -275,7 +281,8 @@ impl CefRenderProcessHandler {
// Called after WebKit has been initialized. // Called after WebKit has been initialized.
// //
pub fn on_web_kit_initialized(&self) -> () { pub fn on_web_kit_initialized(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -291,7 +298,8 @@ impl CefRenderProcessHandler {
// destroyed. // destroyed.
// //
pub fn on_browser_created(&self, browser: interfaces::CefBrowser) -> () { pub fn on_browser_created(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -306,7 +314,8 @@ impl CefRenderProcessHandler {
// Called before a browser is destroyed. // Called before a browser is destroyed.
// //
pub fn on_browser_destroyed(&self, browser: interfaces::CefBrowser) -> () { pub fn on_browser_destroyed(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -321,7 +330,8 @@ impl CefRenderProcessHandler {
// Return the handler for browser load status events. // Return the handler for browser load status events.
// //
pub fn get_load_handler(&self) -> interfaces::CefLoadHandler { pub fn get_load_handler(&self) -> interfaces::CefLoadHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -340,7 +350,8 @@ impl CefRenderProcessHandler {
frame: interfaces::CefFrame, request: interfaces::CefRequest, frame: interfaces::CefFrame, request: interfaces::CefRequest,
navigation_type: types::cef_navigation_type_t, navigation_type: types::cef_navigation_type_t,
is_redirect: libc::c_int) -> libc::c_int { is_redirect: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -365,7 +376,8 @@ impl CefRenderProcessHandler {
// //
pub fn on_context_created(&self, browser: interfaces::CefBrowser, pub fn on_context_created(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () { frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -384,7 +396,8 @@ impl CefRenderProcessHandler {
// //
pub fn on_context_released(&self, browser: interfaces::CefBrowser, pub fn on_context_released(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () { frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -406,7 +419,8 @@ impl CefRenderProcessHandler {
frame: interfaces::CefFrame, context: interfaces::CefV8Context, frame: interfaces::CefFrame, context: interfaces::CefV8Context,
exception: interfaces::CefV8Exception, exception: interfaces::CefV8Exception,
stackTrace: interfaces::CefV8StackTrace) -> () { stackTrace: interfaces::CefV8StackTrace) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -431,7 +445,8 @@ impl CefRenderProcessHandler {
// //
pub fn on_focused_node_changed(&self, browser: interfaces::CefBrowser, pub fn on_focused_node_changed(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, node: interfaces::CefDOMNode) -> () { frame: interfaces::CefFrame, node: interfaces::CefDOMNode) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -452,7 +467,8 @@ impl CefRenderProcessHandler {
pub fn on_process_message_received(&self, browser: interfaces::CefBrowser, pub fn on_process_message_received(&self, browser: interfaces::CefBrowser,
source_process: interfaces::CefProcessId, source_process: interfaces::CefProcessId,
message: interfaces::CefProcessMessage) -> libc::c_int { message: interfaces::CefProcessMessage) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -482,7 +498,8 @@ impl CefWrap<*mut cef_render_process_handler_t> for Option<CefRenderProcessHandl
} }
} }
unsafe fn to_rust(c_object: *mut cef_render_process_handler_t) -> Option<CefRenderProcessHandler> { unsafe fn to_rust(c_object: *mut cef_render_process_handler_t) -> Option<CefRenderProcessHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRenderProcessHandler::from_c_object_addref(c_object)) Some(CefRenderProcessHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -174,13 +175,13 @@ pub struct _cef_request_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_request_t = _cef_request_t; pub type cef_request_t = _cef_request_t;
@ -196,7 +197,8 @@ pub struct CefRequest {
impl Clone for CefRequest { impl Clone for CefRequest {
fn clone(&self) -> CefRequest{ fn clone(&self) -> CefRequest{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRequest { CefRequest {
@ -209,7 +211,8 @@ impl Clone for CefRequest {
impl Drop for CefRequest { impl Drop for CefRequest {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -224,7 +227,8 @@ impl CefRequest {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_t) -> CefRequest { pub unsafe fn from_c_object_addref(c_object: *mut cef_request_t) -> CefRequest {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRequest { CefRequest {
@ -238,7 +242,8 @@ impl CefRequest {
pub fn c_object_addrefed(&self) -> *mut cef_request_t { pub fn c_object_addrefed(&self) -> *mut cef_request_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -246,17 +251,18 @@ impl CefRequest {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns true (1) if this object is read-only. // Returns true (1) if this object is read-only.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -271,7 +277,8 @@ impl CefRequest {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String { pub fn get_url(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -285,7 +292,8 @@ impl CefRequest {
// Set the fully qualified URL. // Set the fully qualified URL.
// //
pub fn set_url(&self, url: &[u16]) -> () { pub fn set_url(&self, url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -302,7 +310,8 @@ impl CefRequest {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_method(&self) -> String { pub fn get_method(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -316,7 +325,8 @@ impl CefRequest {
// Set the request function type. // Set the request function type.
// //
pub fn set_method(&self, method: &[u16]) -> () { pub fn set_method(&self, method: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -331,7 +341,8 @@ impl CefRequest {
// Get the post data. // Get the post data.
// //
pub fn get_post_data(&self) -> interfaces::CefPostData { pub fn get_post_data(&self) -> interfaces::CefPostData {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -345,7 +356,8 @@ impl CefRequest {
// Set the post data. // Set the post data.
// //
pub fn set_post_data(&self, postData: interfaces::CefPostData) -> () { pub fn set_post_data(&self, postData: interfaces::CefPostData) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -360,7 +372,8 @@ impl CefRequest {
// Get the header values. // Get the header values.
// //
pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () { pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -375,7 +388,8 @@ impl CefRequest {
// Set the header values. // Set the header values.
// //
pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () { pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -392,7 +406,8 @@ impl CefRequest {
pub fn set(&self, url: &[u16], method: &[u16], pub fn set(&self, url: &[u16], method: &[u16],
postData: interfaces::CefPostData, headerMap: HashMap<String, postData: interfaces::CefPostData, headerMap: HashMap<String,
Vec<String>>) -> () { Vec<String>>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -411,7 +426,8 @@ impl CefRequest {
// cef_urlrequest_flags_t for supported values. // cef_urlrequest_flags_t for supported values.
// //
pub fn get_flags(&self) -> libc::c_int { pub fn get_flags(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -426,7 +442,8 @@ impl CefRequest {
// cef_urlrequest_flags_t for supported values. // cef_urlrequest_flags_t for supported values.
// //
pub fn set_flags(&self, flags: libc::c_int) -> () { pub fn set_flags(&self, flags: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -443,7 +460,8 @@ impl CefRequest {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_first_party_for_cookies(&self) -> String { pub fn get_first_party_for_cookies(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -458,7 +476,8 @@ impl CefRequest {
// cef_urlrequest_t. // cef_urlrequest_t.
// //
pub fn set_first_party_for_cookies(&self, url: &[u16]) -> () { pub fn set_first_party_for_cookies(&self, url: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -474,7 +493,8 @@ impl CefRequest {
// process. // process.
// //
pub fn get_resource_type(&self) -> types::cef_resource_type_t { pub fn get_resource_type(&self) -> types::cef_resource_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -490,7 +510,8 @@ impl CefRequest {
// frame navigation. // frame navigation.
// //
pub fn get_transition_type(&self) -> types::cef_transition_type_t { pub fn get_transition_type(&self) -> types::cef_transition_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -506,7 +527,8 @@ impl CefRequest {
// browser process to track a single request across multiple callbacks. // browser process to track a single request across multiple callbacks.
// //
pub fn get_identifier(&self) -> u64 { pub fn get_identifier(&self) -> u64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -544,7 +566,8 @@ impl CefWrap<*mut cef_request_t> for Option<CefRequest> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_request_t) -> Option<CefRequest> { unsafe fn to_rust(c_object: *mut cef_request_t) -> Option<CefRequest> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRequest::from_c_object_addref(c_object)) Some(CefRequest::from_c_object_addref(c_object))
@ -604,13 +627,13 @@ pub struct _cef_post_data_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_post_data_t = _cef_post_data_t; pub type cef_post_data_t = _cef_post_data_t;
@ -626,7 +649,8 @@ pub struct CefPostData {
impl Clone for CefPostData { impl Clone for CefPostData {
fn clone(&self) -> CefPostData{ fn clone(&self) -> CefPostData{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefPostData { CefPostData {
@ -639,7 +663,8 @@ impl Clone for CefPostData {
impl Drop for CefPostData { impl Drop for CefPostData {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -654,7 +679,8 @@ impl CefPostData {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_t) -> CefPostData { pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_t) -> CefPostData {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefPostData { CefPostData {
@ -668,7 +694,8 @@ impl CefPostData {
pub fn c_object_addrefed(&self) -> *mut cef_post_data_t { pub fn c_object_addrefed(&self) -> *mut cef_post_data_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -676,17 +703,18 @@ impl CefPostData {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns true (1) if this object is read-only. // Returns true (1) if this object is read-only.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -700,7 +728,8 @@ impl CefPostData {
// Returns the number of existing post data elements. // Returns the number of existing post data elements.
// //
pub fn get_element_count(&self) -> libc::size_t { pub fn get_element_count(&self) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -715,7 +744,8 @@ impl CefPostData {
// //
pub fn get_elements(&self, elements_count: *mut libc::size_t, pub fn get_elements(&self, elements_count: *mut libc::size_t,
elements: *mut interfaces::CefPostDataElement) -> () { elements: *mut interfaces::CefPostDataElement) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -733,7 +763,8 @@ impl CefPostData {
// //
pub fn remove_element(&self, pub fn remove_element(&self,
element: interfaces::CefPostDataElement) -> libc::c_int { element: interfaces::CefPostDataElement) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -749,7 +780,8 @@ impl CefPostData {
// //
pub fn add_element(&self, pub fn add_element(&self,
element: interfaces::CefPostDataElement) -> libc::c_int { element: interfaces::CefPostDataElement) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -764,7 +796,8 @@ impl CefPostData {
// Remove all existing post data elements. // Remove all existing post data elements.
// //
pub fn remove_elements(&self) -> () { pub fn remove_elements(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -802,7 +835,8 @@ impl CefWrap<*mut cef_post_data_t> for Option<CefPostData> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_post_data_t) -> Option<CefPostData> { unsafe fn to_rust(c_object: *mut cef_post_data_t) -> Option<CefPostData> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefPostData::from_c_object_addref(c_object)) Some(CefPostData::from_c_object_addref(c_object))
@ -876,13 +910,13 @@ pub struct _cef_post_data_element_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_post_data_element_t = _cef_post_data_element_t; pub type cef_post_data_element_t = _cef_post_data_element_t;
@ -898,7 +932,8 @@ pub struct CefPostDataElement {
impl Clone for CefPostDataElement { impl Clone for CefPostDataElement {
fn clone(&self) -> CefPostDataElement{ fn clone(&self) -> CefPostDataElement{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefPostDataElement { CefPostDataElement {
@ -911,7 +946,8 @@ impl Clone for CefPostDataElement {
impl Drop for CefPostDataElement { impl Drop for CefPostDataElement {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -926,7 +962,8 @@ impl CefPostDataElement {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_element_t) -> CefPostDataElement { pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_element_t) -> CefPostDataElement {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefPostDataElement { CefPostDataElement {
@ -940,7 +977,8 @@ impl CefPostDataElement {
pub fn c_object_addrefed(&self) -> *mut cef_post_data_element_t { pub fn c_object_addrefed(&self) -> *mut cef_post_data_element_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -948,17 +986,18 @@ impl CefPostDataElement {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns true (1) if this object is read-only. // Returns true (1) if this object is read-only.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -972,7 +1011,8 @@ impl CefPostDataElement {
// Remove all contents from the post data element. // Remove all contents from the post data element.
// //
pub fn set_to_empty(&self) -> () { pub fn set_to_empty(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -986,7 +1026,8 @@ impl CefPostDataElement {
// The post data element will represent a file. // The post data element will represent a file.
// //
pub fn set_to_file(&self, fileName: &[u16]) -> () { pub fn set_to_file(&self, fileName: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1002,7 +1043,8 @@ impl CefPostDataElement {
// copied. // copied.
// //
pub fn set_to_bytes(&self, size: libc::size_t, bytes: &()) -> () { pub fn set_to_bytes(&self, size: libc::size_t, bytes: &()) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1018,7 +1060,8 @@ impl CefPostDataElement {
// Return the type of this post data element. // Return the type of this post data element.
// //
pub fn get_type(&self) -> types::cef_postdataelement_type_t { pub fn get_type(&self) -> types::cef_postdataelement_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1033,7 +1076,8 @@ impl CefPostDataElement {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_file(&self) -> String { pub fn get_file(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1047,7 +1091,8 @@ impl CefPostDataElement {
// Return the number of bytes. // Return the number of bytes.
// //
pub fn get_bytes_count(&self) -> libc::size_t { pub fn get_bytes_count(&self) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1062,7 +1107,8 @@ impl CefPostDataElement {
// actually read. // actually read.
// //
pub fn get_bytes(&self, size: libc::size_t, bytes: &mut ()) -> libc::size_t { pub fn get_bytes(&self, size: libc::size_t, bytes: &mut ()) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1102,7 +1148,8 @@ impl CefWrap<*mut cef_post_data_element_t> for Option<CefPostDataElement> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_post_data_element_t) -> Option<CefPostDataElement> { unsafe fn to_rust(c_object: *mut cef_post_data_element_t) -> Option<CefPostDataElement> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefPostDataElement::from_c_object_addref(c_object)) Some(CefPostDataElement::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -144,13 +145,13 @@ pub struct _cef_request_context_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_request_context_t = _cef_request_context_t; pub type cef_request_context_t = _cef_request_context_t;
@ -178,7 +179,8 @@ pub struct CefRequestContext {
impl Clone for CefRequestContext { impl Clone for CefRequestContext {
fn clone(&self) -> CefRequestContext{ fn clone(&self) -> CefRequestContext{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRequestContext { CefRequestContext {
@ -191,7 +193,8 @@ impl Clone for CefRequestContext {
impl Drop for CefRequestContext { impl Drop for CefRequestContext {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -206,7 +209,8 @@ impl CefRequestContext {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_t) -> CefRequestContext { pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_t) -> CefRequestContext {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRequestContext { CefRequestContext {
@ -220,7 +224,8 @@ impl CefRequestContext {
pub fn c_object_addrefed(&self) -> *mut cef_request_context_t { pub fn c_object_addrefed(&self) -> *mut cef_request_context_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -228,10 +233,10 @@ impl CefRequestContext {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -239,7 +244,8 @@ impl CefRequestContext {
// object. // object.
// //
pub fn is_same(&self, other: interfaces::CefRequestContext) -> libc::c_int { pub fn is_same(&self, other: interfaces::CefRequestContext) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -256,7 +262,8 @@ impl CefRequestContext {
// //
pub fn is_sharing_with(&self, pub fn is_sharing_with(&self,
other: interfaces::CefRequestContext) -> libc::c_int { other: interfaces::CefRequestContext) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -273,7 +280,8 @@ impl CefRequestContext {
// context argument. // context argument.
// //
pub fn is_global(&self) -> libc::c_int { pub fn is_global(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -287,7 +295,8 @@ impl CefRequestContext {
// Returns the handler for this context if any. // Returns the handler for this context if any.
// //
pub fn get_handler(&self) -> interfaces::CefRequestContextHandler { pub fn get_handler(&self) -> interfaces::CefRequestContextHandler {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -303,7 +312,8 @@ impl CefRequestContext {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_cache_path(&self) -> String { pub fn get_cache_path(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -323,7 +333,8 @@ impl CefRequestContext {
// //
pub fn get_default_cookie_manager(&self, pub fn get_default_cookie_manager(&self,
callback: interfaces::CefCompletionCallback) -> interfaces::CefCookieManager { callback: interfaces::CefCompletionCallback) -> interfaces::CefCookieManager {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -350,7 +361,8 @@ impl CefRequestContext {
pub fn register_scheme_handler_factory(&self, scheme_name: &[u16], pub fn register_scheme_handler_factory(&self, scheme_name: &[u16],
domain_name: &[u16], domain_name: &[u16],
factory: interfaces::CefSchemeHandlerFactory) -> libc::c_int { factory: interfaces::CefSchemeHandlerFactory) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -368,7 +380,8 @@ impl CefRequestContext {
// This function may be called on any thread in the browser process. // This function may be called on any thread in the browser process.
// //
pub fn clear_scheme_handler_factories(&self) -> libc::c_int { pub fn clear_scheme_handler_factories(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -434,7 +447,8 @@ impl CefWrap<*mut cef_request_context_t> for Option<CefRequestContext> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_request_context_t) -> Option<CefRequestContext> { unsafe fn to_rust(c_object: *mut cef_request_context_t) -> Option<CefRequestContext> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRequestContext::from_c_object_addref(c_object)) Some(CefRequestContext::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -68,13 +69,13 @@ pub struct _cef_request_context_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_request_context_handler_t = _cef_request_context_handler_t; pub type cef_request_context_handler_t = _cef_request_context_handler_t;
@ -91,7 +92,8 @@ pub struct CefRequestContextHandler {
impl Clone for CefRequestContextHandler { impl Clone for CefRequestContextHandler {
fn clone(&self) -> CefRequestContextHandler{ fn clone(&self) -> CefRequestContextHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRequestContextHandler { CefRequestContextHandler {
@ -104,7 +106,8 @@ impl Clone for CefRequestContextHandler {
impl Drop for CefRequestContextHandler { impl Drop for CefRequestContextHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -119,7 +122,8 @@ impl CefRequestContextHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_handler_t) -> CefRequestContextHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_handler_t) -> CefRequestContextHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRequestContextHandler { CefRequestContextHandler {
@ -133,7 +137,8 @@ impl CefRequestContextHandler {
pub fn c_object_addrefed(&self) -> *mut cef_request_context_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_request_context_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -141,10 +146,10 @@ impl CefRequestContextHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -153,7 +158,8 @@ impl CefRequestContextHandler {
// cef_request_tContext::get_default_cookie_manager() will be used. // cef_request_tContext::get_default_cookie_manager() will be used.
// //
pub fn get_cookie_manager(&self) -> interfaces::CefCookieManager { pub fn get_cookie_manager(&self) -> interfaces::CefCookieManager {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -180,7 +186,8 @@ impl CefWrap<*mut cef_request_context_handler_t> for Option<CefRequestContextHan
} }
} }
unsafe fn to_rust(c_object: *mut cef_request_context_handler_t) -> Option<CefRequestContextHandler> { unsafe fn to_rust(c_object: *mut cef_request_context_handler_t) -> Option<CefRequestContextHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRequestContextHandler::from_c_object_addref(c_object)) Some(CefRequestContextHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -70,13 +71,13 @@ pub struct _cef_request_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_request_callback_t = _cef_request_callback_t; pub type cef_request_callback_t = _cef_request_callback_t;
@ -91,7 +92,8 @@ pub struct CefRequestCallback {
impl Clone for CefRequestCallback { impl Clone for CefRequestCallback {
fn clone(&self) -> CefRequestCallback{ fn clone(&self) -> CefRequestCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRequestCallback { CefRequestCallback {
@ -104,7 +106,8 @@ impl Clone for CefRequestCallback {
impl Drop for CefRequestCallback { impl Drop for CefRequestCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -119,7 +122,8 @@ impl CefRequestCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_callback_t) -> CefRequestCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_request_callback_t) -> CefRequestCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRequestCallback { CefRequestCallback {
@ -133,7 +137,8 @@ impl CefRequestCallback {
pub fn c_object_addrefed(&self) -> *mut cef_request_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_request_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -141,10 +146,10 @@ impl CefRequestCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -152,7 +157,8 @@ impl CefRequestCallback {
// continued. Otherwise, the request will be canceled. // continued. Otherwise, the request will be canceled.
// //
pub fn cont(&self, allow: libc::c_int) -> () { pub fn cont(&self, allow: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -167,7 +173,8 @@ impl CefRequestCallback {
// Cancel the url request. // Cancel the url request.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -194,7 +201,8 @@ impl CefWrap<*mut cef_request_callback_t> for Option<CefRequestCallback> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_request_callback_t) -> Option<CefRequestCallback> { unsafe fn to_rust(c_object: *mut cef_request_callback_t) -> Option<CefRequestCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRequestCallback::from_c_object_addref(c_object)) Some(CefRequestCallback::from_c_object_addref(c_object))
@ -396,13 +404,13 @@ pub struct _cef_request_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_request_handler_t = _cef_request_handler_t; pub type cef_request_handler_t = _cef_request_handler_t;
@ -418,7 +426,8 @@ pub struct CefRequestHandler {
impl Clone for CefRequestHandler { impl Clone for CefRequestHandler {
fn clone(&self) -> CefRequestHandler{ fn clone(&self) -> CefRequestHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefRequestHandler { CefRequestHandler {
@ -431,7 +440,8 @@ impl Clone for CefRequestHandler {
impl Drop for CefRequestHandler { impl Drop for CefRequestHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -446,7 +456,8 @@ impl CefRequestHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_handler_t) -> CefRequestHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_request_handler_t) -> CefRequestHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefRequestHandler { CefRequestHandler {
@ -460,7 +471,8 @@ impl CefRequestHandler {
pub fn c_object_addrefed(&self) -> *mut cef_request_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_request_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -468,10 +480,10 @@ impl CefRequestHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -487,7 +499,8 @@ impl CefRequestHandler {
pub fn on_before_browse(&self, browser: interfaces::CefBrowser, pub fn on_before_browse(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest, frame: interfaces::CefFrame, request: interfaces::CefRequest,
is_redirect: libc::c_int) -> libc::c_int { is_redirect: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -521,7 +534,8 @@ impl CefRequestHandler {
frame: interfaces::CefFrame, target_url: &[u16], frame: interfaces::CefFrame, target_url: &[u16],
target_disposition: types::cef_window_open_disposition_t, target_disposition: types::cef_window_open_disposition_t,
user_gesture: libc::c_int) -> libc::c_int { user_gesture: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -547,7 +561,8 @@ impl CefRequestHandler {
pub fn on_before_resource_load(&self, browser: interfaces::CefBrowser, pub fn on_before_resource_load(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest, frame: interfaces::CefFrame, request: interfaces::CefRequest,
callback: interfaces::CefRequestCallback) -> types::cef_return_value_t { callback: interfaces::CefRequestCallback) -> types::cef_return_value_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -570,7 +585,8 @@ impl CefRequestHandler {
pub fn get_resource_handler(&self, browser: interfaces::CefBrowser, pub fn get_resource_handler(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, frame: interfaces::CefFrame,
request: interfaces::CefRequest) -> interfaces::CefResourceHandler { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -592,7 +608,8 @@ impl CefRequestHandler {
pub fn on_resource_redirect(&self, browser: interfaces::CefBrowser, pub fn on_resource_redirect(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest, frame: interfaces::CefFrame, request: interfaces::CefRequest,
new_url: *mut types::cef_string_t) -> () { new_url: *mut types::cef_string_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -615,7 +632,8 @@ impl CefRequestHandler {
pub fn on_resource_response(&self, browser: interfaces::CefBrowser, pub fn on_resource_response(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest, frame: interfaces::CefFrame, request: interfaces::CefRequest,
response: interfaces::CefResponse) -> libc::c_int { response: interfaces::CefResponse) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -641,7 +659,8 @@ impl CefRequestHandler {
frame: interfaces::CefFrame, isProxy: libc::c_int, host: &[u16], frame: interfaces::CefFrame, isProxy: libc::c_int, host: &[u16],
port: libc::c_int, realm: &[u16], scheme: &[u16], port: libc::c_int, realm: &[u16], scheme: &[u16],
callback: interfaces::CefAuthCallback) -> libc::c_int { callback: interfaces::CefAuthCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -671,7 +690,8 @@ impl CefRequestHandler {
pub fn on_quota_request(&self, browser: interfaces::CefBrowser, pub fn on_quota_request(&self, browser: interfaces::CefBrowser,
origin_url: &[u16], new_size: i64, origin_url: &[u16], new_size: i64,
callback: interfaces::CefRequestCallback) -> libc::c_int { callback: interfaces::CefRequestCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -694,7 +714,8 @@ impl CefRequestHandler {
// //
pub fn on_protocol_execution(&self, browser: interfaces::CefBrowser, pub fn on_protocol_execution(&self, browser: interfaces::CefBrowser,
url: &[u16], allow_os_execution: &mut libc::c_int) -> () { url: &[u16], allow_os_execution: &mut 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -720,7 +741,8 @@ impl CefRequestHandler {
cert_error: types::cef_errorcode_t, request_url: &[u16], cert_error: types::cef_errorcode_t, request_url: &[u16],
ssl_info: interfaces::CefSSLInfo, ssl_info: interfaces::CefSSLInfo,
callback: interfaces::CefRequestCallback) -> libc::c_int { callback: interfaces::CefRequestCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -742,7 +764,8 @@ impl CefRequestHandler {
pub fn on_before_plugin_load(&self, browser: interfaces::CefBrowser, pub fn on_before_plugin_load(&self, browser: interfaces::CefBrowser,
url: &[u16], policy_url: &[u16], url: &[u16], policy_url: &[u16],
info: interfaces::CefWebPluginInfo) -> libc::c_int { info: interfaces::CefWebPluginInfo) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -762,7 +785,8 @@ impl CefRequestHandler {
// //
pub fn on_plugin_crashed(&self, browser: interfaces::CefBrowser, pub fn on_plugin_crashed(&self, browser: interfaces::CefBrowser,
plugin_path: &[u16]) -> () { plugin_path: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -780,7 +804,8 @@ impl CefRequestHandler {
// process. // process.
// //
pub fn on_render_view_ready(&self, browser: interfaces::CefBrowser) -> () { pub fn on_render_view_ready(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -797,7 +822,8 @@ impl CefRequestHandler {
// //
pub fn on_render_process_terminated(&self, browser: interfaces::CefBrowser, pub fn on_render_process_terminated(&self, browser: interfaces::CefBrowser,
status: types::cef_termination_status_t) -> () { status: types::cef_termination_status_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -826,7 +852,8 @@ impl CefWrap<*mut cef_request_handler_t> for Option<CefRequestHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_request_handler_t) -> Option<CefRequestHandler> { unsafe fn to_rust(c_object: *mut cef_request_handler_t) -> Option<CefRequestHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefRequestHandler::from_c_object_addref(c_object)) Some(CefRequestHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -82,13 +83,13 @@ pub struct _cef_resource_bundle_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_resource_bundle_handler_t = _cef_resource_bundle_handler_t; pub type cef_resource_bundle_handler_t = _cef_resource_bundle_handler_t;
@ -104,7 +105,8 @@ pub struct CefResourceBundleHandler {
impl Clone for CefResourceBundleHandler { impl Clone for CefResourceBundleHandler {
fn clone(&self) -> CefResourceBundleHandler{ fn clone(&self) -> CefResourceBundleHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefResourceBundleHandler { CefResourceBundleHandler {
@ -117,7 +119,8 @@ impl Clone for CefResourceBundleHandler {
impl Drop for CefResourceBundleHandler { impl Drop for CefResourceBundleHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -132,7 +135,8 @@ impl CefResourceBundleHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_bundle_handler_t) -> CefResourceBundleHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_bundle_handler_t) -> CefResourceBundleHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefResourceBundleHandler { CefResourceBundleHandler {
@ -146,7 +150,8 @@ impl CefResourceBundleHandler {
pub fn c_object_addrefed(&self) -> *mut cef_resource_bundle_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_resource_bundle_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -154,10 +159,10 @@ impl CefResourceBundleHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -168,7 +173,8 @@ impl CefResourceBundleHandler {
// //
pub fn get_localized_string(&self, message_id: libc::c_int, pub fn get_localized_string(&self, message_id: libc::c_int,
string: *mut types::cef_string_t) -> libc::c_int { string: *mut types::cef_string_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -191,7 +197,8 @@ impl CefResourceBundleHandler {
pub fn get_data_resource(&self, resource_id: libc::c_int, pub fn get_data_resource(&self, resource_id: libc::c_int,
data: &mut *mut libc::c_void, data: &mut *mut libc::c_void,
data_size: &mut libc::size_t) -> libc::c_int { data_size: &mut libc::size_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -221,7 +228,8 @@ impl CefWrap<*mut cef_resource_bundle_handler_t> for Option<CefResourceBundleHan
} }
} }
unsafe fn to_rust(c_object: *mut cef_resource_bundle_handler_t) -> Option<CefResourceBundleHandler> { unsafe fn to_rust(c_object: *mut cef_resource_bundle_handler_t) -> Option<CefResourceBundleHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefResourceBundleHandler::from_c_object_addref(c_object)) Some(CefResourceBundleHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -117,13 +118,13 @@ pub struct _cef_resource_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_resource_handler_t = _cef_resource_handler_t; pub type cef_resource_handler_t = _cef_resource_handler_t;
@ -139,7 +140,8 @@ pub struct CefResourceHandler {
impl Clone for CefResourceHandler { impl Clone for CefResourceHandler {
fn clone(&self) -> CefResourceHandler{ fn clone(&self) -> CefResourceHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefResourceHandler { CefResourceHandler {
@ -152,7 +154,8 @@ impl Clone for CefResourceHandler {
impl Drop for CefResourceHandler { impl Drop for CefResourceHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -167,7 +170,8 @@ impl CefResourceHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_handler_t) -> CefResourceHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_handler_t) -> CefResourceHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefResourceHandler { CefResourceHandler {
@ -181,7 +185,8 @@ impl CefResourceHandler {
pub fn c_object_addrefed(&self) -> *mut cef_resource_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_resource_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -189,10 +194,10 @@ impl CefResourceHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -204,7 +209,8 @@ impl CefResourceHandler {
// //
pub fn process_request(&self, request: interfaces::CefRequest, pub fn process_request(&self, request: interfaces::CefRequest,
callback: interfaces::CefCallback) -> libc::c_int { callback: interfaces::CefCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -229,7 +235,8 @@ impl CefResourceHandler {
pub fn get_response_headers(&self, response: interfaces::CefResponse, pub fn get_response_headers(&self, response: interfaces::CefResponse,
response_length: &mut i64, redirectUrl: *mut types::cef_string_t) -> ( response_length: &mut i64, redirectUrl: *mut types::cef_string_t) -> (
) { ) {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -252,7 +259,8 @@ impl CefResourceHandler {
pub fn read_response(&self, data_out: &mut (), bytes_to_read: libc::c_int, pub fn read_response(&self, data_out: &mut (), bytes_to_read: libc::c_int,
bytes_read: &mut libc::c_int, bytes_read: &mut libc::c_int,
callback: interfaces::CefCallback) -> libc::c_int { callback: interfaces::CefCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -272,7 +280,8 @@ impl CefResourceHandler {
// cookies will be sent with the request. // cookies will be sent with the request.
// //
pub fn can_get_cookie(&self, cookie: &interfaces::CefCookie) -> libc::c_int { pub fn can_get_cookie(&self, cookie: &interfaces::CefCookie) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -288,7 +297,8 @@ impl CefResourceHandler {
// set or false (0) otherwise. // set or false (0) otherwise.
// //
pub fn can_set_cookie(&self, cookie: &interfaces::CefCookie) -> libc::c_int { pub fn can_set_cookie(&self, cookie: &interfaces::CefCookie) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -303,7 +313,8 @@ impl CefResourceHandler {
// Request processing has been canceled. // Request processing has been canceled.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -330,7 +341,8 @@ impl CefWrap<*mut cef_resource_handler_t> for Option<CefResourceHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_resource_handler_t) -> Option<CefResourceHandler> { unsafe fn to_rust(c_object: *mut cef_resource_handler_t) -> Option<CefResourceHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefResourceHandler::from_c_object_addref(c_object)) Some(CefResourceHandler::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -122,13 +123,13 @@ pub struct _cef_response_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_response_t = _cef_response_t; pub type cef_response_t = _cef_response_t;
@ -144,7 +145,8 @@ pub struct CefResponse {
impl Clone for CefResponse { impl Clone for CefResponse {
fn clone(&self) -> CefResponse{ fn clone(&self) -> CefResponse{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefResponse { CefResponse {
@ -157,7 +159,8 @@ impl Clone for CefResponse {
impl Drop for CefResponse { impl Drop for CefResponse {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -172,7 +175,8 @@ impl CefResponse {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_response_t) -> CefResponse { pub unsafe fn from_c_object_addref(c_object: *mut cef_response_t) -> CefResponse {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefResponse { CefResponse {
@ -186,7 +190,8 @@ impl CefResponse {
pub fn c_object_addrefed(&self) -> *mut cef_response_t { pub fn c_object_addrefed(&self) -> *mut cef_response_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -194,17 +199,18 @@ impl CefResponse {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Returns true (1) if this object is read-only. // Returns true (1) if this object is read-only.
// //
pub fn is_read_only(&self) -> libc::c_int { pub fn is_read_only(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -218,7 +224,8 @@ impl CefResponse {
// Get the response status code. // Get the response status code.
// //
pub fn get_status(&self) -> libc::c_int { pub fn get_status(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -232,7 +239,8 @@ impl CefResponse {
// Set the response status code. // Set the response status code.
// //
pub fn set_status(&self, status: libc::c_int) -> () { pub fn set_status(&self, status: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -248,7 +256,8 @@ impl CefResponse {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_status_text(&self) -> String { pub fn get_status_text(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -262,7 +271,8 @@ impl CefResponse {
// Set the response status text. // Set the response status text.
// //
pub fn set_status_text(&self, statusText: &[u16]) -> () { pub fn set_status_text(&self, statusText: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -278,7 +288,8 @@ impl CefResponse {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_mime_type(&self) -> String { pub fn get_mime_type(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -292,7 +303,8 @@ impl CefResponse {
// Set the response mime type. // Set the response mime type.
// //
pub fn set_mime_type(&self, mimeType: &[u16]) -> () { pub fn set_mime_type(&self, mimeType: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -308,7 +320,8 @@ impl CefResponse {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_header(&self, name: &[u16]) -> String { pub fn get_header(&self, name: &[u16]) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -323,7 +336,8 @@ impl CefResponse {
// Get all response header fields. // Get all response header fields.
// //
pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () { pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -338,7 +352,8 @@ impl CefResponse {
// Set all response header fields. // Set all response header fields.
// //
pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () { pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -377,7 +392,8 @@ impl CefWrap<*mut cef_response_t> for Option<CefResponse> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_response_t) -> Option<CefResponse> { unsafe fn to_rust(c_object: *mut cef_response_t) -> Option<CefResponse> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefResponse::from_c_object_addref(c_object)) Some(CefResponse::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -108,13 +109,13 @@ pub struct _cef_scheme_registrar_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_scheme_registrar_t = _cef_scheme_registrar_t; pub type cef_scheme_registrar_t = _cef_scheme_registrar_t;
@ -129,7 +130,8 @@ pub struct CefSchemeRegistrar {
impl Clone for CefSchemeRegistrar { impl Clone for CefSchemeRegistrar {
fn clone(&self) -> CefSchemeRegistrar{ fn clone(&self) -> CefSchemeRegistrar{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefSchemeRegistrar { CefSchemeRegistrar {
@ -142,7 +144,8 @@ impl Clone for CefSchemeRegistrar {
impl Drop for CefSchemeRegistrar { impl Drop for CefSchemeRegistrar {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*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 { 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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefSchemeRegistrar { CefSchemeRegistrar {
@ -171,7 +175,8 @@ impl CefSchemeRegistrar {
pub fn c_object_addrefed(&self) -> *mut cef_scheme_registrar_t { pub fn c_object_addrefed(&self) -> *mut cef_scheme_registrar_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -179,10 +184,10 @@ impl CefSchemeRegistrar {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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, pub fn add_custom_scheme(&self, scheme_name: &[u16], is_standard: libc::c_int,
is_local: libc::c_int, is_local: libc::c_int,
is_display_isolated: libc::c_int) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { 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> { 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 None
} else { } else {
Some(CefSchemeRegistrar::from_c_object_addref(c_object)) 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! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_scheme_handler_factory_t = _cef_scheme_handler_factory_t; pub type cef_scheme_handler_factory_t = _cef_scheme_handler_factory_t;
@ -326,7 +333,8 @@ pub struct CefSchemeHandlerFactory {
impl Clone for CefSchemeHandlerFactory { impl Clone for CefSchemeHandlerFactory {
fn clone(&self) -> CefSchemeHandlerFactory{ fn clone(&self) -> CefSchemeHandlerFactory{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefSchemeHandlerFactory { CefSchemeHandlerFactory {
@ -339,7 +347,8 @@ impl Clone for CefSchemeHandlerFactory {
impl Drop for CefSchemeHandlerFactory { impl Drop for CefSchemeHandlerFactory {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*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 { 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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefSchemeHandlerFactory { CefSchemeHandlerFactory {
@ -368,7 +378,8 @@ impl CefSchemeHandlerFactory {
pub fn c_object_addrefed(&self) -> *mut cef_scheme_handler_factory_t { pub fn c_object_addrefed(&self) -> *mut cef_scheme_handler_factory_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -376,10 +387,10 @@ impl CefSchemeHandlerFactory {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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, pub fn create(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, scheme_name: &[u16], frame: interfaces::CefFrame, scheme_name: &[u16],
request: interfaces::CefRequest) -> interfaces::CefResourceHandler { 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") panic!("called a CEF method on a null object")
} }
unsafe { 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> { 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 None
} else { } else {
Some(CefSchemeHandlerFactory::from_c_object_addref(c_object)) Some(CefSchemeHandlerFactory::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -122,13 +123,13 @@ pub struct _cef_sslcert_principal_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_sslcert_principal_t = _cef_sslcert_principal_t; pub type cef_sslcert_principal_t = _cef_sslcert_principal_t;
@ -143,7 +144,8 @@ pub struct CefSSLCertPrincipal {
impl Clone for CefSSLCertPrincipal { impl Clone for CefSSLCertPrincipal {
fn clone(&self) -> CefSSLCertPrincipal{ fn clone(&self) -> CefSSLCertPrincipal{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefSSLCertPrincipal { CefSSLCertPrincipal {
@ -156,7 +158,8 @@ impl Clone for CefSSLCertPrincipal {
impl Drop for CefSSLCertPrincipal { impl Drop for CefSSLCertPrincipal {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -171,7 +174,8 @@ impl CefSSLCertPrincipal {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_sslcert_principal_t) -> CefSSLCertPrincipal { pub unsafe fn from_c_object_addref(c_object: *mut cef_sslcert_principal_t) -> CefSSLCertPrincipal {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefSSLCertPrincipal { CefSSLCertPrincipal {
@ -185,7 +189,8 @@ impl CefSSLCertPrincipal {
pub fn c_object_addrefed(&self) -> *mut cef_sslcert_principal_t { pub fn c_object_addrefed(&self) -> *mut cef_sslcert_principal_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -193,10 +198,10 @@ impl CefSSLCertPrincipal {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -205,7 +210,8 @@ impl CefSSLCertPrincipal {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_display_name(&self) -> String { pub fn get_display_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -220,7 +226,8 @@ impl CefSSLCertPrincipal {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_common_name(&self) -> String { pub fn get_common_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -235,7 +242,8 @@ impl CefSSLCertPrincipal {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_locality_name(&self) -> String { pub fn get_locality_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -250,7 +258,8 @@ impl CefSSLCertPrincipal {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_state_or_province_name(&self) -> String { pub fn get_state_or_province_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -265,7 +274,8 @@ impl CefSSLCertPrincipal {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_country_name(&self) -> String { pub fn get_country_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -279,7 +289,8 @@ impl CefSSLCertPrincipal {
// Retrieve the list of street addresses. // Retrieve the list of street addresses.
// //
pub fn get_street_addresses(&self, addresses: Vec<String>) -> () { pub fn get_street_addresses(&self, addresses: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -294,7 +305,8 @@ impl CefSSLCertPrincipal {
// Retrieve the list of organization names. // Retrieve the list of organization names.
// //
pub fn get_organization_names(&self, names: Vec<String>) -> () { pub fn get_organization_names(&self, names: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -309,7 +321,8 @@ impl CefSSLCertPrincipal {
// Retrieve the list of organization unit names. // Retrieve the list of organization unit names.
// //
pub fn get_organization_unit_names(&self, names: Vec<String>) -> () { pub fn get_organization_unit_names(&self, names: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -324,7 +337,8 @@ impl CefSSLCertPrincipal {
// Retrieve the list of domain components. // Retrieve the list of domain components.
// //
pub fn get_domain_components(&self, components: Vec<String>) -> () { pub fn get_domain_components(&self, components: Vec<String>) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -352,7 +366,8 @@ impl CefWrap<*mut cef_sslcert_principal_t> for Option<CefSSLCertPrincipal> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_sslcert_principal_t) -> Option<CefSSLCertPrincipal> { unsafe fn to_rust(c_object: *mut cef_sslcert_principal_t) -> Option<CefSSLCertPrincipal> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefSSLCertPrincipal::from_c_object_addref(c_object)) Some(CefSSLCertPrincipal::from_c_object_addref(c_object))
@ -421,13 +436,13 @@ pub struct _cef_sslinfo_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_sslinfo_t = _cef_sslinfo_t; pub type cef_sslinfo_t = _cef_sslinfo_t;
@ -442,7 +457,8 @@ pub struct CefSSLInfo {
impl Clone for CefSSLInfo { impl Clone for CefSSLInfo {
fn clone(&self) -> CefSSLInfo{ fn clone(&self) -> CefSSLInfo{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefSSLInfo { CefSSLInfo {
@ -455,7 +471,8 @@ impl Clone for CefSSLInfo {
impl Drop for CefSSLInfo { impl Drop for CefSSLInfo {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -470,7 +487,8 @@ impl CefSSLInfo {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_sslinfo_t) -> CefSSLInfo { pub unsafe fn from_c_object_addref(c_object: *mut cef_sslinfo_t) -> CefSSLInfo {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefSSLInfo { CefSSLInfo {
@ -484,7 +502,8 @@ impl CefSSLInfo {
pub fn c_object_addrefed(&self) -> *mut cef_sslinfo_t { pub fn c_object_addrefed(&self) -> *mut cef_sslinfo_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -492,10 +511,10 @@ impl CefSSLInfo {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -504,7 +523,8 @@ impl CefSSLInfo {
// match the host name of the web server. // match the host name of the web server.
// //
pub fn get_subject(&self) -> interfaces::CefSSLCertPrincipal { pub fn get_subject(&self) -> interfaces::CefSSLCertPrincipal {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -518,7 +538,8 @@ impl CefSSLInfo {
// Returns the issuer of the X.509 certificate. // Returns the issuer of the X.509 certificate.
// //
pub fn get_issuer(&self) -> interfaces::CefSSLCertPrincipal { pub fn get_issuer(&self) -> interfaces::CefSSLCertPrincipal {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -533,7 +554,8 @@ impl CefSSLInfo {
// possibly includes a leading 00 byte. // possibly includes a leading 00 byte.
// //
pub fn get_serial_number(&self) -> interfaces::CefBinaryValue { pub fn get_serial_number(&self) -> interfaces::CefBinaryValue {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -548,7 +570,8 @@ impl CefSSLInfo {
// CefTime.GetTimeT() will return 0 if no date was specified. // CefTime.GetTimeT() will return 0 if no date was specified.
// //
pub fn get_valid_start(&self) -> types::cef_time_t { pub fn get_valid_start(&self) -> types::cef_time_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -563,7 +586,8 @@ impl CefSSLInfo {
// CefTime.GetTimeT() will return 0 if no date was specified. // CefTime.GetTimeT() will return 0 if no date was specified.
// //
pub fn get_valid_expiry(&self) -> types::cef_time_t { pub fn get_valid_expiry(&self) -> types::cef_time_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -577,7 +601,8 @@ impl CefSSLInfo {
// Returns the DER encoded data for the X.509 certificate. // Returns the DER encoded data for the X.509 certificate.
// //
pub fn get_derencoded(&self) -> interfaces::CefBinaryValue { pub fn get_derencoded(&self) -> interfaces::CefBinaryValue {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -591,7 +616,8 @@ impl CefSSLInfo {
// Returns the PEM encoded data for the X.509 certificate. // Returns the PEM encoded data for the X.509 certificate.
// //
pub fn get_pemencoded(&self) -> interfaces::CefBinaryValue { pub fn get_pemencoded(&self) -> interfaces::CefBinaryValue {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -618,7 +644,8 @@ impl CefWrap<*mut cef_sslinfo_t> for Option<CefSSLInfo> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_sslinfo_t) -> Option<CefSSLInfo> { unsafe fn to_rust(c_object: *mut cef_sslinfo_t) -> Option<CefSSLInfo> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefSSLInfo::from_c_object_addref(c_object)) Some(CefSSLInfo::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -90,13 +91,13 @@ pub struct _cef_read_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_read_handler_t = _cef_read_handler_t; pub type cef_read_handler_t = _cef_read_handler_t;
@ -112,7 +113,8 @@ pub struct CefReadHandler {
impl Clone for CefReadHandler { impl Clone for CefReadHandler {
fn clone(&self) -> CefReadHandler{ fn clone(&self) -> CefReadHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefReadHandler { CefReadHandler {
@ -125,7 +127,8 @@ impl Clone for CefReadHandler {
impl Drop for CefReadHandler { impl Drop for CefReadHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -140,7 +143,8 @@ impl CefReadHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_read_handler_t) -> CefReadHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_read_handler_t) -> CefReadHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefReadHandler { CefReadHandler {
@ -154,7 +158,8 @@ impl CefReadHandler {
pub fn c_object_addrefed(&self) -> *mut cef_read_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_read_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -162,10 +167,10 @@ impl CefReadHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -173,7 +178,8 @@ impl CefReadHandler {
// //
pub fn read(&self, ptr: &mut (), size: libc::size_t, pub fn read(&self, ptr: &mut (), size: libc::size_t,
n: libc::size_t) -> libc::size_t { n: libc::size_t) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -191,7 +197,8 @@ impl CefReadHandler {
// SEEK_END or SEEK_SET. Return zero on success and non-zero on failure. // SEEK_END or SEEK_SET. Return zero on success and non-zero on failure.
// //
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int { pub fn seek(&self, offset: i64, whence: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -207,7 +214,8 @@ impl CefReadHandler {
// Return the current offset position. // Return the current offset position.
// //
pub fn tell(&self) -> i64 { pub fn tell(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -221,7 +229,8 @@ impl CefReadHandler {
// Return non-zero if at end of file. // Return non-zero if at end of file.
// //
pub fn eof(&self) -> libc::c_int { pub fn eof(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -237,7 +246,8 @@ impl CefReadHandler {
// the handler from. // the handler from.
// //
pub fn may_block(&self) -> libc::c_int { pub fn may_block(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -264,7 +274,8 @@ impl CefWrap<*mut cef_read_handler_t> for Option<CefReadHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_read_handler_t) -> Option<CefReadHandler> { unsafe fn to_rust(c_object: *mut cef_read_handler_t) -> Option<CefReadHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefReadHandler::from_c_object_addref(c_object)) Some(CefReadHandler::from_c_object_addref(c_object))
@ -318,13 +329,13 @@ pub struct _cef_stream_reader_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_stream_reader_t = _cef_stream_reader_t; pub type cef_stream_reader_t = _cef_stream_reader_t;
@ -340,7 +351,8 @@ pub struct CefStreamReader {
impl Clone for CefStreamReader { impl Clone for CefStreamReader {
fn clone(&self) -> CefStreamReader{ fn clone(&self) -> CefStreamReader{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefStreamReader { CefStreamReader {
@ -353,7 +365,8 @@ impl Clone for CefStreamReader {
impl Drop for CefStreamReader { impl Drop for CefStreamReader {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -368,7 +381,8 @@ impl CefStreamReader {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_reader_t) -> CefStreamReader { pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_reader_t) -> CefStreamReader {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefStreamReader { CefStreamReader {
@ -382,7 +396,8 @@ impl CefStreamReader {
pub fn c_object_addrefed(&self) -> *mut cef_stream_reader_t { pub fn c_object_addrefed(&self) -> *mut cef_stream_reader_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -390,10 +405,10 @@ impl CefStreamReader {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -401,7 +416,8 @@ impl CefStreamReader {
// //
pub fn read(&self, ptr: &mut (), size: libc::size_t, pub fn read(&self, ptr: &mut (), size: libc::size_t,
n: libc::size_t) -> libc::size_t { n: libc::size_t) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -419,7 +435,8 @@ impl CefStreamReader {
// SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure. // SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure.
// //
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int { pub fn seek(&self, offset: i64, whence: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -435,7 +452,8 @@ impl CefStreamReader {
// Return the current offset position. // Return the current offset position.
// //
pub fn tell(&self) -> i64 { pub fn tell(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -449,7 +467,8 @@ impl CefStreamReader {
// Return non-zero if at end of file. // Return non-zero if at end of file.
// //
pub fn eof(&self) -> libc::c_int { pub fn eof(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -465,7 +484,8 @@ impl CefStreamReader {
// the reader from. // the reader from.
// //
pub fn may_block(&self) -> libc::c_int { pub fn may_block(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -528,7 +548,8 @@ impl CefWrap<*mut cef_stream_reader_t> for Option<CefStreamReader> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_stream_reader_t) -> Option<CefStreamReader> { unsafe fn to_rust(c_object: *mut cef_stream_reader_t) -> Option<CefStreamReader> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefStreamReader::from_c_object_addref(c_object)) Some(CefStreamReader::from_c_object_addref(c_object))
@ -583,13 +604,13 @@ pub struct _cef_write_handler_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_write_handler_t = _cef_write_handler_t; pub type cef_write_handler_t = _cef_write_handler_t;
@ -605,7 +626,8 @@ pub struct CefWriteHandler {
impl Clone for CefWriteHandler { impl Clone for CefWriteHandler {
fn clone(&self) -> CefWriteHandler{ fn clone(&self) -> CefWriteHandler{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefWriteHandler { CefWriteHandler {
@ -618,7 +640,8 @@ impl Clone for CefWriteHandler {
impl Drop for CefWriteHandler { impl Drop for CefWriteHandler {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -633,7 +656,8 @@ impl CefWriteHandler {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_write_handler_t) -> CefWriteHandler { pub unsafe fn from_c_object_addref(c_object: *mut cef_write_handler_t) -> CefWriteHandler {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefWriteHandler { CefWriteHandler {
@ -647,7 +671,8 @@ impl CefWriteHandler {
pub fn c_object_addrefed(&self) -> *mut cef_write_handler_t { pub fn c_object_addrefed(&self) -> *mut cef_write_handler_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -655,10 +680,10 @@ impl CefWriteHandler {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -666,7 +691,8 @@ impl CefWriteHandler {
// //
pub fn write(&self, ptr: &(), size: libc::size_t, pub fn write(&self, ptr: &(), size: libc::size_t,
n: libc::size_t) -> libc::size_t { n: libc::size_t) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -684,7 +710,8 @@ impl CefWriteHandler {
// SEEK_END or SEEK_SET. Return zero on success and non-zero on failure. // SEEK_END or SEEK_SET. Return zero on success and non-zero on failure.
// //
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int { pub fn seek(&self, offset: i64, whence: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -700,7 +727,8 @@ impl CefWriteHandler {
// Return the current offset position. // Return the current offset position.
// //
pub fn tell(&self) -> i64 { pub fn tell(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -714,7 +742,8 @@ impl CefWriteHandler {
// Flush the stream. // Flush the stream.
// //
pub fn flush(&self) -> libc::c_int { pub fn flush(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -730,7 +759,8 @@ impl CefWriteHandler {
// the handler from. // the handler from.
// //
pub fn may_block(&self) -> libc::c_int { pub fn may_block(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -757,7 +787,8 @@ impl CefWrap<*mut cef_write_handler_t> for Option<CefWriteHandler> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_write_handler_t) -> Option<CefWriteHandler> { unsafe fn to_rust(c_object: *mut cef_write_handler_t) -> Option<CefWriteHandler> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefWriteHandler::from_c_object_addref(c_object)) Some(CefWriteHandler::from_c_object_addref(c_object))
@ -812,13 +843,13 @@ pub struct _cef_stream_writer_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_stream_writer_t = _cef_stream_writer_t; pub type cef_stream_writer_t = _cef_stream_writer_t;
@ -834,7 +865,8 @@ pub struct CefStreamWriter {
impl Clone for CefStreamWriter { impl Clone for CefStreamWriter {
fn clone(&self) -> CefStreamWriter{ fn clone(&self) -> CefStreamWriter{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefStreamWriter { CefStreamWriter {
@ -847,7 +879,8 @@ impl Clone for CefStreamWriter {
impl Drop for CefStreamWriter { impl Drop for CefStreamWriter {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -862,7 +895,8 @@ impl CefStreamWriter {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_writer_t) -> CefStreamWriter { pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_writer_t) -> CefStreamWriter {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefStreamWriter { CefStreamWriter {
@ -876,7 +910,8 @@ impl CefStreamWriter {
pub fn c_object_addrefed(&self) -> *mut cef_stream_writer_t { pub fn c_object_addrefed(&self) -> *mut cef_stream_writer_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -884,10 +919,10 @@ impl CefStreamWriter {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -895,7 +930,8 @@ impl CefStreamWriter {
// //
pub fn write(&self, ptr: &(), size: libc::size_t, pub fn write(&self, ptr: &(), size: libc::size_t,
n: libc::size_t) -> libc::size_t { n: libc::size_t) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -913,7 +949,8 @@ impl CefStreamWriter {
// SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure. // SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure.
// //
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int { pub fn seek(&self, offset: i64, whence: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -929,7 +966,8 @@ impl CefStreamWriter {
// Return the current offset position. // Return the current offset position.
// //
pub fn tell(&self) -> i64 { pub fn tell(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -943,7 +981,8 @@ impl CefStreamWriter {
// Flush the stream. // Flush the stream.
// //
pub fn flush(&self) -> libc::c_int { pub fn flush(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -959,7 +998,8 @@ impl CefStreamWriter {
// the writer from. // the writer from.
// //
pub fn may_block(&self) -> libc::c_int { pub fn may_block(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -1009,7 +1049,8 @@ impl CefWrap<*mut cef_stream_writer_t> for Option<CefStreamWriter> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_stream_writer_t) -> Option<CefStreamWriter> { unsafe fn to_rust(c_object: *mut cef_stream_writer_t) -> Option<CefStreamWriter> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefStreamWriter::from_c_object_addref(c_object)) Some(CefStreamWriter::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -64,13 +65,13 @@ pub struct _cef_string_visitor_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_string_visitor_t = _cef_string_visitor_t; pub type cef_string_visitor_t = _cef_string_visitor_t;
@ -85,7 +86,8 @@ pub struct CefStringVisitor {
impl Clone for CefStringVisitor { impl Clone for CefStringVisitor {
fn clone(&self) -> CefStringVisitor{ fn clone(&self) -> CefStringVisitor{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefStringVisitor { CefStringVisitor {
@ -98,7 +100,8 @@ impl Clone for CefStringVisitor {
impl Drop for CefStringVisitor { impl Drop for CefStringVisitor {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -113,7 +116,8 @@ impl CefStringVisitor {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_string_visitor_t) -> CefStringVisitor { pub unsafe fn from_c_object_addref(c_object: *mut cef_string_visitor_t) -> CefStringVisitor {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefStringVisitor { CefStringVisitor {
@ -127,7 +131,8 @@ impl CefStringVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_string_visitor_t { pub fn c_object_addrefed(&self) -> *mut cef_string_visitor_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -135,17 +140,18 @@ impl CefStringVisitor {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Method that will be executed. // Method that will be executed.
// //
pub fn visit(&self, string: &[u16]) -> () { pub fn visit(&self, string: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -173,7 +179,8 @@ impl CefWrap<*mut cef_string_visitor_t> for Option<CefStringVisitor> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_string_visitor_t) -> Option<CefStringVisitor> { unsafe fn to_rust(c_object: *mut cef_string_visitor_t) -> Option<CefStringVisitor> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefStringVisitor::from_c_object_addref(c_object)) Some(CefStringVisitor::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -68,13 +69,13 @@ pub struct _cef_task_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_task_t = _cef_task_t; pub type cef_task_t = _cef_task_t;
@ -94,7 +95,8 @@ pub struct CefTask {
impl Clone for CefTask { impl Clone for CefTask {
fn clone(&self) -> CefTask{ fn clone(&self) -> CefTask{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefTask { CefTask {
@ -107,7 +109,8 @@ impl Clone for CefTask {
impl Drop for CefTask { impl Drop for CefTask {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -122,7 +125,8 @@ impl CefTask {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_task_t) -> CefTask { pub unsafe fn from_c_object_addref(c_object: *mut cef_task_t) -> CefTask {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefTask { CefTask {
@ -136,7 +140,8 @@ impl CefTask {
pub fn c_object_addrefed(&self) -> *mut cef_task_t { pub fn c_object_addrefed(&self) -> *mut cef_task_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -144,17 +149,18 @@ impl CefTask {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
// Method that will be executed on the target thread. // Method that will be executed on the target thread.
// //
pub fn execute(&self) -> () { pub fn execute(&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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -181,7 +187,8 @@ impl CefWrap<*mut cef_task_t> for Option<CefTask> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_task_t) -> Option<CefTask> { unsafe fn to_rust(c_object: *mut cef_task_t) -> Option<CefTask> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefTask::from_c_object_addref(c_object)) Some(CefTask::from_c_object_addref(c_object))
@ -244,13 +251,13 @@ pub struct _cef_task_runner_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_task_runner_t = _cef_task_runner_t; pub type cef_task_runner_t = _cef_task_runner_t;
@ -271,7 +278,8 @@ pub struct CefTaskRunner {
impl Clone for CefTaskRunner { impl Clone for CefTaskRunner {
fn clone(&self) -> CefTaskRunner{ fn clone(&self) -> CefTaskRunner{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefTaskRunner { CefTaskRunner {
@ -284,7 +292,8 @@ impl Clone for CefTaskRunner {
impl Drop for CefTaskRunner { impl Drop for CefTaskRunner {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -299,7 +308,8 @@ impl CefTaskRunner {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_task_runner_t) -> CefTaskRunner { pub unsafe fn from_c_object_addref(c_object: *mut cef_task_runner_t) -> CefTaskRunner {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefTaskRunner { CefTaskRunner {
@ -313,7 +323,8 @@ impl CefTaskRunner {
pub fn c_object_addrefed(&self) -> *mut cef_task_runner_t { pub fn c_object_addrefed(&self) -> *mut cef_task_runner_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -321,10 +332,10 @@ impl CefTaskRunner {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -332,7 +343,8 @@ impl CefTaskRunner {
// |that| object. // |that| object.
// //
pub fn is_same(&self, that: interfaces::CefTaskRunner) -> libc::c_int { pub fn is_same(&self, that: interfaces::CefTaskRunner) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -347,7 +359,8 @@ impl CefTaskRunner {
// Returns true (1) if this task runner belongs to the current thread. // Returns true (1) if this task runner belongs to the current thread.
// //
pub fn belongs_to_current_thread(&self) -> libc::c_int { pub fn belongs_to_current_thread(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -362,7 +375,8 @@ impl CefTaskRunner {
// //
pub fn belongs_to_thread(&self, pub fn belongs_to_thread(&self,
threadId: types::cef_thread_id_t) -> libc::c_int { threadId: types::cef_thread_id_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -378,7 +392,8 @@ impl CefTaskRunner {
// Execution will occur asynchronously. // Execution will occur asynchronously.
// //
pub fn post_task(&self, task: interfaces::CefTask) -> libc::c_int { pub fn post_task(&self, task: interfaces::CefTask) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -397,7 +412,8 @@ impl CefTaskRunner {
// //
pub fn post_delayed_task(&self, task: interfaces::CefTask, pub fn post_delayed_task(&self, task: interfaces::CefTask,
delay_ms: i64) -> libc::c_int { delay_ms: i64) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -451,7 +467,8 @@ impl CefWrap<*mut cef_task_runner_t> for Option<CefTaskRunner> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_task_runner_t) -> Option<CefTaskRunner> { unsafe fn to_rust(c_object: *mut cef_task_runner_t) -> Option<CefTaskRunner> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefTaskRunner::from_c_object_addref(c_object)) Some(CefTaskRunner::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -69,13 +70,13 @@ pub struct _cef_end_tracing_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_end_tracing_callback_t = _cef_end_tracing_callback_t; pub type cef_end_tracing_callback_t = _cef_end_tracing_callback_t;
@ -92,7 +93,8 @@ pub struct CefEndTracingCallback {
impl Clone for CefEndTracingCallback { impl Clone for CefEndTracingCallback {
fn clone(&self) -> CefEndTracingCallback{ fn clone(&self) -> CefEndTracingCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefEndTracingCallback { CefEndTracingCallback {
@ -105,7 +107,8 @@ impl Clone for CefEndTracingCallback {
impl Drop for CefEndTracingCallback { impl Drop for CefEndTracingCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -120,7 +123,8 @@ impl CefEndTracingCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_end_tracing_callback_t) -> CefEndTracingCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_end_tracing_callback_t) -> CefEndTracingCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefEndTracingCallback { CefEndTracingCallback {
@ -134,7 +138,8 @@ impl CefEndTracingCallback {
pub fn c_object_addrefed(&self) -> *mut cef_end_tracing_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_end_tracing_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -142,10 +147,10 @@ impl CefEndTracingCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -154,7 +159,8 @@ impl CefEndTracingCallback {
// deleting |tracing_file|. // deleting |tracing_file|.
// //
pub fn on_end_tracing_complete(&self, tracing_file: &[u16]) -> () { pub fn on_end_tracing_complete(&self, tracing_file: &[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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -182,7 +188,8 @@ impl CefWrap<*mut cef_end_tracing_callback_t> for Option<CefEndTracingCallback>
} }
} }
unsafe fn to_rust(c_object: *mut cef_end_tracing_callback_t) -> Option<CefEndTracingCallback> { unsafe fn to_rust(c_object: *mut cef_end_tracing_callback_t) -> Option<CefEndTracingCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefEndTracingCallback::from_c_object_addref(c_object)) Some(CefEndTracingCallback::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -101,13 +102,13 @@ pub struct _cef_urlrequest_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_urlrequest_t = _cef_urlrequest_t; pub type cef_urlrequest_t = _cef_urlrequest_t;
@ -126,7 +127,8 @@ pub struct CefURLRequest {
impl Clone for CefURLRequest { impl Clone for CefURLRequest {
fn clone(&self) -> CefURLRequest{ fn clone(&self) -> CefURLRequest{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefURLRequest { CefURLRequest {
@ -139,7 +141,8 @@ impl Clone for CefURLRequest {
impl Drop for CefURLRequest { impl Drop for CefURLRequest {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -154,7 +157,8 @@ impl CefURLRequest {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_t) -> CefURLRequest { pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_t) -> CefURLRequest {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefURLRequest { CefURLRequest {
@ -168,7 +172,8 @@ impl CefURLRequest {
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_t { pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -176,10 +181,10 @@ impl CefURLRequest {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -187,7 +192,8 @@ impl CefURLRequest {
// object is read-only and should not be modified. // object is read-only and should not be modified.
// //
pub fn get_request(&self) -> interfaces::CefRequest { pub fn get_request(&self) -> interfaces::CefRequest {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -201,7 +207,8 @@ impl CefURLRequest {
// Returns the client. // Returns the client.
// //
pub fn get_client(&self) -> interfaces::CefURLRequestClient { pub fn get_client(&self) -> interfaces::CefURLRequestClient {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -215,7 +222,8 @@ impl CefURLRequest {
// Returns the request status. // Returns the request status.
// //
pub fn get_request_status(&self) -> types::cef_urlrequest_status_t { pub fn get_request_status(&self) -> types::cef_urlrequest_status_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -230,7 +238,8 @@ impl CefURLRequest {
// otherwise. // otherwise.
// //
pub fn get_request_error(&self) -> types::cef_errorcode_t { pub fn get_request_error(&self) -> types::cef_errorcode_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -246,7 +255,8 @@ impl CefURLRequest {
// The returned object is read-only and should not be modified. // The returned object is read-only and should not be modified.
// //
pub fn get_response(&self) -> interfaces::CefResponse { pub fn get_response(&self) -> interfaces::CefResponse {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -260,7 +270,8 @@ impl CefURLRequest {
// Cancel the request. // Cancel the request.
// //
pub fn cancel(&self) -> () { 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -314,7 +325,8 @@ impl CefWrap<*mut cef_urlrequest_t> for Option<CefURLRequest> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_urlrequest_t) -> Option<CefURLRequest> { unsafe fn to_rust(c_object: *mut cef_urlrequest_t) -> Option<CefURLRequest> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefURLRequest::from_c_object_addref(c_object)) Some(CefURLRequest::from_c_object_addref(c_object))
@ -392,13 +404,13 @@ pub struct _cef_urlrequest_client_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_urlrequest_client_t = _cef_urlrequest_client_t; pub type cef_urlrequest_client_t = _cef_urlrequest_client_t;
@ -415,7 +427,8 @@ pub struct CefURLRequestClient {
impl Clone for CefURLRequestClient { impl Clone for CefURLRequestClient {
fn clone(&self) -> CefURLRequestClient{ fn clone(&self) -> CefURLRequestClient{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefURLRequestClient { CefURLRequestClient {
@ -428,7 +441,8 @@ impl Clone for CefURLRequestClient {
impl Drop for CefURLRequestClient { impl Drop for CefURLRequestClient {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -443,7 +457,8 @@ impl CefURLRequestClient {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_client_t) -> CefURLRequestClient { pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_client_t) -> CefURLRequestClient {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefURLRequestClient { CefURLRequestClient {
@ -457,7 +472,8 @@ impl CefURLRequestClient {
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_client_t { pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_client_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -465,10 +481,10 @@ impl CefURLRequestClient {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -477,7 +493,8 @@ impl CefURLRequestClient {
// successful or not. // successful or not.
// //
pub fn on_request_complete(&self, request: interfaces::CefURLRequest) -> () { pub fn on_request_complete(&self, request: interfaces::CefURLRequest) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -496,7 +513,8 @@ impl CefURLRequestClient {
// //
pub fn on_upload_progress(&self, request: interfaces::CefURLRequest, pub fn on_upload_progress(&self, request: interfaces::CefURLRequest,
current: i64, total: i64) -> () { current: i64, total: i64) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -516,7 +534,8 @@ impl CefURLRequestClient {
// //
pub fn on_download_progress(&self, request: interfaces::CefURLRequest, pub fn on_download_progress(&self, request: interfaces::CefURLRequest,
current: i64, total: i64) -> () { current: i64, total: i64) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -536,7 +555,8 @@ impl CefURLRequestClient {
// //
pub fn on_download_data(&self, request: interfaces::CefURLRequest, data: &(), pub fn on_download_data(&self, request: interfaces::CefURLRequest, data: &(),
data_length: libc::size_t) -> () { data_length: libc::size_t) -> () {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -561,7 +581,8 @@ impl CefURLRequestClient {
pub fn get_auth_credentials(&self, isProxy: libc::c_int, host: &[u16], pub fn get_auth_credentials(&self, isProxy: libc::c_int, host: &[u16],
port: libc::c_int, realm: &[u16], scheme: &[u16], port: libc::c_int, realm: &[u16], scheme: &[u16],
callback: interfaces::CefAuthCallback) -> libc::c_int { callback: interfaces::CefAuthCallback) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -594,7 +615,8 @@ impl CefWrap<*mut cef_urlrequest_client_t> for Option<CefURLRequestClient> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_urlrequest_client_t) -> Option<CefURLRequestClient> { unsafe fn to_rust(c_object: *mut cef_urlrequest_client_t) -> Option<CefURLRequestClient> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefURLRequestClient::from_c_object_addref(c_object)) Some(CefURLRequestClient::from_c_object_addref(c_object))

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -86,13 +87,13 @@ pub struct _cef_web_plugin_info_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_web_plugin_info_t = _cef_web_plugin_info_t; pub type cef_web_plugin_info_t = _cef_web_plugin_info_t;
@ -107,7 +108,8 @@ pub struct CefWebPluginInfo {
impl Clone for CefWebPluginInfo { impl Clone for CefWebPluginInfo {
fn clone(&self) -> CefWebPluginInfo{ fn clone(&self) -> CefWebPluginInfo{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefWebPluginInfo { CefWebPluginInfo {
@ -120,7 +122,8 @@ impl Clone for CefWebPluginInfo {
impl Drop for CefWebPluginInfo { impl Drop for CefWebPluginInfo {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -135,7 +138,8 @@ impl CefWebPluginInfo {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_t) -> CefWebPluginInfo { pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_t) -> CefWebPluginInfo {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefWebPluginInfo { CefWebPluginInfo {
@ -149,7 +153,8 @@ impl CefWebPluginInfo {
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_t { pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -157,10 +162,10 @@ impl CefWebPluginInfo {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -168,7 +173,8 @@ impl CefWebPluginInfo {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String { pub fn get_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -183,7 +189,8 @@ impl CefWebPluginInfo {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_path(&self) -> String { pub fn get_path(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -198,7 +205,8 @@ impl CefWebPluginInfo {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_version(&self) -> String { pub fn get_version(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -213,7 +221,8 @@ impl CefWebPluginInfo {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_description(&self) -> String { pub fn get_description(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -240,7 +249,8 @@ impl CefWrap<*mut cef_web_plugin_info_t> for Option<CefWebPluginInfo> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_web_plugin_info_t) -> Option<CefWebPluginInfo> { unsafe fn to_rust(c_object: *mut cef_web_plugin_info_t) -> Option<CefWebPluginInfo> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefWebPluginInfo::from_c_object_addref(c_object)) Some(CefWebPluginInfo::from_c_object_addref(c_object))
@ -273,13 +283,13 @@ pub struct _cef_web_plugin_info_visitor_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_web_plugin_info_visitor_t = _cef_web_plugin_info_visitor_t; pub type cef_web_plugin_info_visitor_t = _cef_web_plugin_info_visitor_t;
@ -295,7 +305,8 @@ pub struct CefWebPluginInfoVisitor {
impl Clone for CefWebPluginInfoVisitor { impl Clone for CefWebPluginInfoVisitor {
fn clone(&self) -> CefWebPluginInfoVisitor{ fn clone(&self) -> CefWebPluginInfoVisitor{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefWebPluginInfoVisitor { CefWebPluginInfoVisitor {
@ -308,7 +319,8 @@ impl Clone for CefWebPluginInfoVisitor {
impl Drop for CefWebPluginInfoVisitor { impl Drop for CefWebPluginInfoVisitor {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -323,7 +335,8 @@ impl CefWebPluginInfoVisitor {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_visitor_t) -> CefWebPluginInfoVisitor { pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_visitor_t) -> CefWebPluginInfoVisitor {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefWebPluginInfoVisitor { CefWebPluginInfoVisitor {
@ -337,7 +350,8 @@ impl CefWebPluginInfoVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_visitor_t { pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_visitor_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -345,10 +359,10 @@ impl CefWebPluginInfoVisitor {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -359,7 +373,8 @@ impl CefWebPluginInfoVisitor {
// //
pub fn visit(&self, info: interfaces::CefWebPluginInfo, count: libc::c_int, pub fn visit(&self, info: interfaces::CefWebPluginInfo, count: libc::c_int,
total: libc::c_int) -> libc::c_int { total: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -389,7 +404,8 @@ impl CefWrap<*mut cef_web_plugin_info_visitor_t> for Option<CefWebPluginInfoVisi
} }
} }
unsafe fn to_rust(c_object: *mut cef_web_plugin_info_visitor_t) -> Option<CefWebPluginInfoVisitor> { unsafe fn to_rust(c_object: *mut cef_web_plugin_info_visitor_t) -> Option<CefWebPluginInfoVisitor> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefWebPluginInfoVisitor::from_c_object_addref(c_object)) Some(CefWebPluginInfoVisitor::from_c_object_addref(c_object))
@ -421,13 +437,13 @@ pub struct _cef_web_plugin_unstable_callback_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_web_plugin_unstable_callback_t = _cef_web_plugin_unstable_callback_t; pub type cef_web_plugin_unstable_callback_t = _cef_web_plugin_unstable_callback_t;
@ -443,7 +459,8 @@ pub struct CefWebPluginUnstableCallback {
impl Clone for CefWebPluginUnstableCallback { impl Clone for CefWebPluginUnstableCallback {
fn clone(&self) -> CefWebPluginUnstableCallback{ fn clone(&self) -> CefWebPluginUnstableCallback{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefWebPluginUnstableCallback { CefWebPluginUnstableCallback {
@ -456,7 +473,8 @@ impl Clone for CefWebPluginUnstableCallback {
impl Drop for CefWebPluginUnstableCallback { impl Drop for CefWebPluginUnstableCallback {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -471,7 +489,8 @@ impl CefWebPluginUnstableCallback {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_unstable_callback_t) -> CefWebPluginUnstableCallback { pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_unstable_callback_t) -> CefWebPluginUnstableCallback {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefWebPluginUnstableCallback { CefWebPluginUnstableCallback {
@ -485,7 +504,8 @@ impl CefWebPluginUnstableCallback {
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_unstable_callback_t { pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_unstable_callback_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -493,10 +513,10 @@ impl CefWebPluginUnstableCallback {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -505,7 +525,8 @@ impl CefWebPluginUnstableCallback {
// 120 seconds. // 120 seconds.
// //
pub fn is_unstable(&self, path: &[u16], unstable: libc::c_int) -> () { pub fn is_unstable(&self, path: &[u16], unstable: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -534,7 +555,8 @@ impl CefWrap<*mut cef_web_plugin_unstable_callback_t> for Option<CefWebPluginUns
} }
} }
unsafe fn to_rust(c_object: *mut cef_web_plugin_unstable_callback_t) -> Option<CefWebPluginUnstableCallback> { unsafe fn to_rust(c_object: *mut cef_web_plugin_unstable_callback_t) -> Option<CefWebPluginUnstableCallback> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefWebPluginUnstableCallback::from_c_object_addref(c_object)) Some(CefWebPluginUnstableCallback::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -277,13 +278,13 @@ pub struct _cef_xml_reader_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_xml_reader_t = _cef_xml_reader_t; pub type cef_xml_reader_t = _cef_xml_reader_t;
@ -300,7 +301,8 @@ pub struct CefXmlReader {
impl Clone for CefXmlReader { impl Clone for CefXmlReader {
fn clone(&self) -> CefXmlReader{ fn clone(&self) -> CefXmlReader{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefXmlReader { CefXmlReader {
@ -313,7 +315,8 @@ impl Clone for CefXmlReader {
impl Drop for CefXmlReader { impl Drop for CefXmlReader {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -328,7 +331,8 @@ impl CefXmlReader {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_xml_reader_t) -> CefXmlReader { pub unsafe fn from_c_object_addref(c_object: *mut cef_xml_reader_t) -> CefXmlReader {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefXmlReader { CefXmlReader {
@ -342,7 +346,8 @@ impl CefXmlReader {
pub fn c_object_addrefed(&self) -> *mut cef_xml_reader_t { pub fn c_object_addrefed(&self) -> *mut cef_xml_reader_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -350,10 +355,10 @@ impl CefXmlReader {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -362,7 +367,8 @@ impl CefXmlReader {
// if the cursor position was set successfully. // if the cursor position was set successfully.
// //
pub fn move_to_next_node(&self) -> libc::c_int { pub fn move_to_next_node(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -377,7 +383,8 @@ impl CefXmlReader {
// occurs on the correct thread. // occurs on the correct thread.
// //
pub fn close(&self) -> libc::c_int { pub fn close(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -391,7 +398,8 @@ impl CefXmlReader {
// Returns true (1) if an error has been reported by the XML parser. // Returns true (1) if an error has been reported by the XML parser.
// //
pub fn has_error(&self) -> libc::c_int { pub fn has_error(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -406,7 +414,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_error(&self) -> String { pub fn get_error(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -424,7 +433,8 @@ impl CefXmlReader {
// Returns the node type. // Returns the node type.
// //
pub fn get_type(&self) -> types::cef_xml_node_type_t { pub fn get_type(&self) -> types::cef_xml_node_type_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -438,7 +448,8 @@ impl CefXmlReader {
// Returns the node depth. Depth starts at 0 for the root node. // Returns the node depth. Depth starts at 0 for the root node.
// //
pub fn get_depth(&self) -> libc::c_int { pub fn get_depth(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -454,7 +465,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_local_name(&self) -> String { pub fn get_local_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -470,7 +482,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_prefix(&self) -> String { pub fn get_prefix(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -486,7 +499,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_qualified_name(&self) -> String { pub fn get_qualified_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -502,7 +516,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_namespace_uri(&self) -> String { pub fn get_namespace_uri(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -518,7 +533,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_base_uri(&self) -> String { pub fn get_base_uri(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -534,7 +550,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_xml_lang(&self) -> String { pub fn get_xml_lang(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -549,7 +566,8 @@ impl CefXmlReader {
// NULL but <a></a> is not. // NULL but <a></a> is not.
// //
pub fn is_empty_element(&self) -> libc::c_int { pub fn is_empty_element(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -563,7 +581,8 @@ impl CefXmlReader {
// Returns true (1) if the node has a text value. // Returns true (1) if the node has a text value.
// //
pub fn has_value(&self) -> libc::c_int { pub fn has_value(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -578,7 +597,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_value(&self) -> String { pub fn get_value(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -592,7 +612,8 @@ impl CefXmlReader {
// Returns true (1) if the node has attributes. // Returns true (1) if the node has attributes.
// //
pub fn has_attributes(&self) -> libc::c_int { pub fn has_attributes(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -606,7 +627,8 @@ impl CefXmlReader {
// Returns the number of attributes. // Returns the number of attributes.
// //
pub fn get_attribute_count(&self) -> libc::size_t { pub fn get_attribute_count(&self) -> libc::size_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -621,7 +643,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_attribute_byindex(&self, index: libc::c_int) -> String { pub fn get_attribute_byindex(&self, index: libc::c_int) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -637,7 +660,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_attribute_byqname(&self, qualifiedName: &[u16]) -> String { pub fn get_attribute_byqname(&self, qualifiedName: &[u16]) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -655,7 +679,8 @@ impl CefXmlReader {
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_attribute_bylname(&self, localName: &[u16], pub fn get_attribute_bylname(&self, localName: &[u16],
namespaceURI: &[u16]) -> String { namespaceURI: &[u16]) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -672,7 +697,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_inner_xml(&self) -> String { pub fn get_inner_xml(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -687,7 +713,8 @@ impl CefXmlReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_outer_xml(&self) -> String { pub fn get_outer_xml(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -701,7 +728,8 @@ impl CefXmlReader {
// Returns the line number for the current node. // Returns the line number for the current node.
// //
pub fn get_line_number(&self) -> libc::c_int { pub fn get_line_number(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -722,7 +750,8 @@ impl CefXmlReader {
// true (1) if the cursor position was set successfully. // true (1) if the cursor position was set successfully.
// //
pub fn move_to_attribute_byindex(&self, index: libc::c_int) -> libc::c_int { pub fn move_to_attribute_byindex(&self, index: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -739,7 +768,8 @@ impl CefXmlReader {
// //
pub fn move_to_attribute_byqname(&self, pub fn move_to_attribute_byqname(&self,
qualifiedName: &[u16]) -> libc::c_int { qualifiedName: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -757,7 +787,8 @@ impl CefXmlReader {
// //
pub fn move_to_attribute_bylname(&self, localName: &[u16], pub fn move_to_attribute_bylname(&self, localName: &[u16],
namespaceURI: &[u16]) -> libc::c_int { namespaceURI: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -774,7 +805,8 @@ impl CefXmlReader {
// true (1) if the cursor position was set successfully. // true (1) if the cursor position was set successfully.
// //
pub fn move_to_first_attribute(&self) -> libc::c_int { pub fn move_to_first_attribute(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -789,7 +821,8 @@ impl CefXmlReader {
// (1) if the cursor position was set successfully. // (1) if the cursor position was set successfully.
// //
pub fn move_to_next_attribute(&self) -> libc::c_int { pub fn move_to_next_attribute(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -804,7 +837,8 @@ impl CefXmlReader {
// cursor position was set successfully. // cursor position was set successfully.
// //
pub fn move_to_carrying_element(&self) -> libc::c_int { pub fn move_to_carrying_element(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -847,7 +881,8 @@ impl CefWrap<*mut cef_xml_reader_t> for Option<CefXmlReader> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_xml_reader_t) -> Option<CefXmlReader> { unsafe fn to_rust(c_object: *mut cef_xml_reader_t) -> Option<CefXmlReader> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefXmlReader::from_c_object_addref(c_object)) Some(CefXmlReader::from_c_object_addref(c_object))

View file

@ -43,6 +43,7 @@ use wrappers::CefWrap;
use libc; use libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use std::ptr; use std::ptr;
// //
@ -140,13 +141,13 @@ pub struct _cef_zip_reader_t {
// //
// The reference count. This will only be present for Rust instances! // 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! // Extra data. This will only be present for Rust instances!
// //
pub extra: u8, pub extra: u8,
} }
pub type cef_zip_reader_t = _cef_zip_reader_t; pub type cef_zip_reader_t = _cef_zip_reader_t;
@ -163,7 +164,8 @@ pub struct CefZipReader {
impl Clone for CefZipReader { impl Clone for CefZipReader {
fn clone(&self) -> CefZipReader{ fn clone(&self) -> CefZipReader{
unsafe { 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); ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
} }
CefZipReader { CefZipReader {
@ -176,7 +178,8 @@ impl Clone for CefZipReader {
impl Drop for CefZipReader { impl Drop for CefZipReader {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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); ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
} }
} }
@ -191,7 +194,8 @@ impl CefZipReader {
} }
pub unsafe fn from_c_object_addref(c_object: *mut cef_zip_reader_t) -> CefZipReader { pub unsafe fn from_c_object_addref(c_object: *mut cef_zip_reader_t) -> CefZipReader {
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); ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
} }
CefZipReader { CefZipReader {
@ -205,7 +209,8 @@ impl CefZipReader {
pub fn c_object_addrefed(&self) -> *mut cef_zip_reader_t { pub fn c_object_addrefed(&self) -> *mut cef_zip_reader_t {
unsafe { 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); eutil::add_ref(self.c_object as *mut types::cef_base_t);
} }
self.c_object self.c_object
@ -213,10 +218,10 @@ impl CefZipReader {
} }
pub fn is_null_cef_object(&self) -> bool { 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 { 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
} }
// //
@ -224,7 +229,8 @@ impl CefZipReader {
// cursor position was set successfully. // cursor position was set successfully.
// //
pub fn move_to_first_file(&self) -> libc::c_int { pub fn move_to_first_file(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -239,7 +245,8 @@ impl CefZipReader {
// cursor position was set successfully. // cursor position was set successfully.
// //
pub fn move_to_next_file(&self) -> libc::c_int { pub fn move_to_next_file(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -256,7 +263,8 @@ impl CefZipReader {
// //
pub fn move_to_file(&self, fileName: &[u16], pub fn move_to_file(&self, fileName: &[u16],
caseSensitive: libc::c_int) -> libc::c_int { caseSensitive: 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -273,7 +281,8 @@ impl CefZipReader {
// occurs on the correct thread. // occurs on the correct thread.
// //
pub fn close(&self) -> libc::c_int { pub fn close(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -291,7 +300,8 @@ impl CefZipReader {
// //
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_file_name(&self) -> String { pub fn get_file_name(&self) -> String {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -305,7 +315,8 @@ impl CefZipReader {
// Returns the uncompressed size of the file. // Returns the uncompressed size of the file.
// //
pub fn get_file_size(&self) -> i64 { pub fn get_file_size(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -319,7 +330,8 @@ impl CefZipReader {
// Returns the last modified timestamp for the file. // Returns the last modified timestamp for the file.
// //
pub fn get_file_last_modified(&self) -> libc::time_t { pub fn get_file_last_modified(&self) -> libc::time_t {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -334,7 +346,8 @@ impl CefZipReader {
// optionally be specified. // optionally be specified.
// //
pub fn open_file(&self, password: &[u16]) -> libc::c_int { pub fn open_file(&self, password: &[u16]) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -349,7 +362,8 @@ impl CefZipReader {
// Closes the file. // Closes the file.
// //
pub fn close_file(&self) -> libc::c_int { pub fn close_file(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -365,7 +379,8 @@ impl CefZipReader {
// //
pub fn read_file(&self, buffer: &mut (), pub fn read_file(&self, buffer: &mut (),
bufferSize: libc::size_t) -> libc::c_int { bufferSize: libc::size_t) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -381,7 +396,8 @@ impl CefZipReader {
// Returns the current offset in the uncompressed file contents. // Returns the current offset in the uncompressed file contents.
// //
pub fn tell(&self) -> i64 { pub fn tell(&self) -> i64 {
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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -395,7 +411,8 @@ impl CefZipReader {
// Returns true (1) if at end of the file contents. // Returns true (1) if at end of the file contents.
// //
pub fn eof(&self) -> libc::c_int { pub fn eof(&self) -> 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") panic!("called a CEF method on a null object")
} }
unsafe { unsafe {
@ -435,7 +452,8 @@ impl CefWrap<*mut cef_zip_reader_t> for Option<CefZipReader> {
} }
} }
unsafe fn to_rust(c_object: *mut cef_zip_reader_t) -> Option<CefZipReader> { unsafe fn to_rust(c_object: *mut cef_zip_reader_t) -> Option<CefZipReader> {
if c_object.is_null() { if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None None
} else { } else {
Some(CefZipReader::from_c_object_addref(c_object)) Some(CefZipReader::from_c_object_addref(c_object))

View file

@ -13,7 +13,7 @@
#![feature(collections)] #![feature(collections)]
#![feature(negate_unsigned)] #![feature(negate_unsigned)]
#![feature(unicode)] #![feature(unicode)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![plugin(plugins)] #![plugin(plugins)]

View file

@ -66,7 +66,7 @@ macro_rules! full_cef_class_impl(
// Calculate the offset of the reference count. This is the size of the // Calculate the offset of the reference count. This is the size of the
// structure. // structure.
let null: *const $c_interface_name = ::std::ptr::null(); let null: *const $c_interface_name = ::std::ptr::null();
let offset: *const usize = &(*null).ref_count; let offset: *const u32 = &(*null).ref_count;
let size = (offset as ::libc::size_t) - (null as ::libc::size_t); let size = (offset as ::libc::size_t) - (null as ::libc::size_t);
$interface_name::from_c_object_addref( $interface_name::from_c_object_addref(
::eutil::create_cef_object::<$c_interface_name,$class_name>(size)) ::eutil::create_cef_object::<$c_interface_name,$class_name>(size))