servo: Merge #13055 - Update Rust to 1.13.0-nightly (198713106 2016-08-26) (from servo:rustup); r=metajack

(Do not merge) Update Rust to 1.13.0-nightly (198713106 2016-08-26)

Source-Repo: https://github.com/servo/servo
Source-Revision: 1c2b45f87f23278d365913506e9c1776799ec345
This commit is contained in:
Anthony Ramine 2016-08-28 07:53:33 -05:00
parent 92775a4a3b
commit 58640cfec1
64 changed files with 1428 additions and 2636 deletions

View File

@ -38,7 +38,7 @@ rustc-serialize = "0.3"
serde = "0.8"
serde_macros = "0.8"
smallvec = "0.1"
string_cache = {version = "0.2.23", features = ["heap_size"]}
string_cache = {version = "0.2.25", features = ["heap_size"]}
style = {path = "../style"}
style_traits = {path = "../style_traits"}
time = "0.1.12"

View File

@ -36,7 +36,7 @@ script_traits = {path = "../script_traits"}
selectors = {version = "0.11", features = ["heap_size"]}
serde_macros = "0.8"
smallvec = "0.1"
string_cache = {version = "0.2.23", features = ["heap_size"]}
string_cache = {version = "0.2.25", features = ["heap_size"]}
style = {path = "../style"}
style_traits = {path = "../style_traits"}
unicode-bidi = "0.2"

View File

@ -10,7 +10,6 @@
#![feature(plugin)]
#![feature(raw)]
#![feature(step_by)]
#![feature(unsafe_no_drop_flag)]
#![deny(unsafe_code)]

View File

@ -65,7 +65,7 @@ script_traits = {path = "../script_traits"}
selectors = {version = "0.11", features = ["heap_size"]}
serde = "0.8"
smallvec = "0.1"
string_cache = {version = "0.2.23", features = ["heap_size", "unstable"]}
string_cache = {version = "0.2.25", features = ["heap_size", "unstable"]}
style = {path = "../style"}
time = "0.1.12"
url = {version = "1.2", features = ["heap_size", "query_encoding"]}

View File

@ -28,7 +28,7 @@ profile_traits = {path = "../profile_traits"}
range = {path = "../range"}
script_traits = {path = "../script_traits"}
selectors = {version = "0.11", features = ["heap_size"]}
string_cache = {version = "0.2.23", features = ["heap_size"]}
string_cache = {version = "0.2.25", features = ["heap_size"]}
style = {path = "../style"}
url = {version = "1.2", features = ["heap_size"]}
util = {path = "../util"}

View File

@ -793,7 +793,7 @@ dependencies = [
"servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.1 (git+https://github.com/huonw/simd)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -959,8 +959,8 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1086,7 +1086,7 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.3"
source = "git+https://github.com/servo/rust-mozjs#9a200eab19b0035a0a1634ef527058be4738a0f6"
source = "git+https://github.com/servo/rust-mozjs#f06428fab33a6ae633584a1a7e1bf4e3ef7914b3"
dependencies = [
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1167,7 +1167,7 @@ dependencies = [
"selectors 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1938,7 +1938,7 @@ dependencies = [
"selectors 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
@ -1972,7 +1972,7 @@ dependencies = [
"range 0.0.1",
"script_traits 0.0.1",
"selectors 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@ -2031,7 +2031,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -2208,7 +2208,7 @@ dependencies = [
[[package]]
name = "string_cache"
version = "0.2.24"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2248,7 +2248,7 @@ dependencies = [
"serde 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2265,7 +2265,7 @@ dependencies = [
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2322,7 +2322,7 @@ dependencies = [
[[package]]
name = "tendril"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2714,8 +2714,8 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -44,7 +44,7 @@ selectors = "0.11"
serde = {version = "0.8", optional = true}
serde_macros = {version = "0.8", optional = true}
smallvec = "0.1"
string_cache = {version = "0.2.24", features = ["heap_size"], optional = true}
string_cache = {version = "0.2.25", features = ["heap_size"], optional = true}
style_traits = {path = "../style_traits"}
time = "0.1"
url = "1.2"

View File

@ -710,7 +710,7 @@ dependencies = [
"servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.1 (git+https://github.com/huonw/simd)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -867,8 +867,8 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -994,7 +994,7 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.3"
source = "git+https://github.com/servo/rust-mozjs#9a200eab19b0035a0a1634ef527058be4738a0f6"
source = "git+https://github.com/servo/rust-mozjs#f06428fab33a6ae633584a1a7e1bf4e3ef7914b3"
dependencies = [
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1075,7 +1075,7 @@ dependencies = [
"selectors 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1790,7 +1790,7 @@ dependencies = [
"selectors 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
@ -1824,7 +1824,7 @@ dependencies = [
"range 0.0.1",
"script_traits 0.0.1",
"selectors 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@ -1873,7 +1873,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -2091,7 +2091,7 @@ dependencies = [
[[package]]
name = "string_cache"
version = "0.2.24"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2131,7 +2131,7 @@ dependencies = [
"serde 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2189,7 +2189,7 @@ dependencies = [
[[package]]
name = "tendril"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2574,8 +2574,8 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -129,8 +129,7 @@ pub struct CefApp {
impl Clone for CefApp {
fn clone(&self) -> CefApp{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefApp {
@ -143,8 +142,7 @@ impl Clone for CefApp {
impl Drop for CefApp {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -159,8 +157,7 @@ impl CefApp {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_app_t) -> CefApp {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefApp {
@ -174,8 +171,7 @@ impl CefApp {
pub fn c_object_addrefed(&self) -> *mut cef_app_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -183,10 +179,10 @@ impl CefApp {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -202,8 +198,7 @@ impl CefApp {
//
pub fn on_before_command_line_processing(&self, process_type: &[u16],
command_line: interfaces::CefCommandLine) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -223,8 +218,7 @@ impl CefApp {
//
pub fn on_register_custom_schemes(&self,
registrar: interfaces::CefSchemeRegistrar) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -243,8 +237,7 @@ impl CefApp {
//
pub fn get_resource_bundle_handler(
&self) -> interfaces::CefResourceBundleHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -260,8 +253,7 @@ impl CefApp {
//
pub fn get_browser_process_handler(
&self) -> interfaces::CefBrowserProcessHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -277,8 +269,7 @@ impl CefApp {
//
pub fn get_render_process_handler(
&self) -> interfaces::CefRenderProcessHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -305,8 +296,7 @@ impl CefWrap<*mut cef_app_t> for Option<CefApp> {
}
}
unsafe fn to_rust(c_object: *mut cef_app_t) -> Option<CefApp> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefApp::from_c_object_addref(c_object))

View File

@ -94,8 +94,7 @@ pub struct CefAuthCallback {
impl Clone for CefAuthCallback {
fn clone(&self) -> CefAuthCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefAuthCallback {
@ -108,8 +107,7 @@ impl Clone for CefAuthCallback {
impl Drop for CefAuthCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -124,8 +122,7 @@ impl CefAuthCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_auth_callback_t) -> CefAuthCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefAuthCallback {
@ -139,8 +136,7 @@ impl CefAuthCallback {
pub fn c_object_addrefed(&self) -> *mut cef_auth_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -148,18 +144,17 @@ impl CefAuthCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Continue the authentication request.
//
pub fn cont(&self, username: &[u16], password: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -175,8 +170,7 @@ impl CefAuthCallback {
// Cancel the authentication request.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -203,8 +197,7 @@ impl CefWrap<*mut cef_auth_callback_t> for Option<CefAuthCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_auth_callback_t) -> Option<CefAuthCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefAuthCallback::from_c_object_addref(c_object))

View File

@ -211,8 +211,7 @@ pub struct CefBrowser {
impl Clone for CefBrowser {
fn clone(&self) -> CefBrowser{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefBrowser {
@ -225,8 +224,7 @@ impl Clone for CefBrowser {
impl Drop for CefBrowser {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -241,8 +239,7 @@ impl CefBrowser {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_t) -> CefBrowser {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefBrowser {
@ -256,8 +253,7 @@ impl CefBrowser {
pub fn c_object_addrefed(&self) -> *mut cef_browser_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -265,10 +261,10 @@ impl CefBrowser {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -276,8 +272,7 @@ impl CefBrowser {
// browser process.
//
pub fn get_host(&self) -> interfaces::CefBrowserHost {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -291,8 +286,7 @@ impl CefBrowser {
// Returns true (1) if the browser can navigate backwards.
//
pub fn can_go_back(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -306,8 +300,7 @@ impl CefBrowser {
// Navigate backwards.
//
pub fn go_back(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -321,8 +314,7 @@ impl CefBrowser {
// Returns true (1) if the browser can navigate forwards.
//
pub fn can_go_forward(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -336,8 +328,7 @@ impl CefBrowser {
// Navigate forwards.
//
pub fn go_forward(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -351,8 +342,7 @@ impl CefBrowser {
// Returns true (1) if the browser is currently loading.
//
pub fn is_loading(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -366,8 +356,7 @@ impl CefBrowser {
// Reload the current page.
//
pub fn reload(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -381,8 +370,7 @@ impl CefBrowser {
// Reload the current page ignoring any cached data.
//
pub fn reload_ignore_cache(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -396,8 +384,7 @@ impl CefBrowser {
// Stop loading the page.
//
pub fn stop_load(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -411,8 +398,7 @@ impl CefBrowser {
// Returns the globally unique identifier for this browser.
//
pub fn get_identifier(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -427,8 +413,7 @@ impl CefBrowser {
// object.
//
pub fn is_same(&self, that: interfaces::CefBrowser) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -443,8 +428,7 @@ impl CefBrowser {
// Returns true (1) if the window is a popup window.
//
pub fn is_popup(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -458,8 +442,7 @@ impl CefBrowser {
// Returns true (1) if a document has been loaded in the browser.
//
pub fn has_document(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -473,8 +456,7 @@ impl CefBrowser {
// Returns the main (top-level) frame for the browser window.
//
pub fn get_main_frame(&self) -> interfaces::CefFrame {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -488,8 +470,7 @@ impl CefBrowser {
// Returns the focused frame for the browser window.
//
pub fn get_focused_frame(&self) -> interfaces::CefFrame {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -503,8 +484,7 @@ impl CefBrowser {
// Returns the frame with the specified identifier, or NULL if not found.
//
pub fn get_frame_byident(&self, identifier: i64) -> interfaces::CefFrame {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -519,8 +499,7 @@ impl CefBrowser {
// Returns the frame with the specified name, or NULL if not found.
//
pub fn get_frame(&self, name: &[u16]) -> interfaces::CefFrame {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -535,8 +514,7 @@ impl CefBrowser {
// Returns the number of frames that currently exist.
//
pub fn get_frame_count(&self) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -551,8 +529,7 @@ impl CefBrowser {
//
pub fn get_frame_identifiers(&self, identifiers_count: *mut libc::size_t,
identifiers: *mut i64) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -568,8 +545,7 @@ impl CefBrowser {
// Returns the names of all existing frames.
//
pub fn get_frame_names(&self, names: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -586,8 +562,7 @@ impl CefBrowser {
//
pub fn send_process_message(&self, target_process: interfaces::CefProcessId,
message: interfaces::CefProcessMessage) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -616,8 +591,7 @@ impl CefWrap<*mut cef_browser_t> for Option<CefBrowser> {
}
}
unsafe fn to_rust(c_object: *mut cef_browser_t) -> Option<CefBrowser> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefBrowser::from_c_object_addref(c_object))
@ -674,8 +648,7 @@ pub struct CefRunFileDialogCallback {
impl Clone for CefRunFileDialogCallback {
fn clone(&self) -> CefRunFileDialogCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRunFileDialogCallback {
@ -688,8 +661,7 @@ impl Clone for CefRunFileDialogCallback {
impl Drop for CefRunFileDialogCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -704,8 +676,7 @@ impl CefRunFileDialogCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_run_file_dialog_callback_t) -> CefRunFileDialogCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRunFileDialogCallback {
@ -719,8 +690,7 @@ impl CefRunFileDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_run_file_dialog_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -728,10 +698,10 @@ impl CefRunFileDialogCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -743,8 +713,7 @@ impl CefRunFileDialogCallback {
//
pub fn on_file_dialog_dismissed(&self, selected_accept_filter: libc::c_int,
file_paths: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -773,8 +742,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRunFileDialogCallback::from_c_object_addref(c_object))
@ -830,8 +798,7 @@ pub struct CefNavigationEntryVisitor {
impl Clone for CefNavigationEntryVisitor {
fn clone(&self) -> CefNavigationEntryVisitor{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefNavigationEntryVisitor {
@ -844,8 +811,7 @@ impl Clone for CefNavigationEntryVisitor {
impl Drop for CefNavigationEntryVisitor {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -860,8 +826,7 @@ impl CefNavigationEntryVisitor {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_visitor_t) -> CefNavigationEntryVisitor {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefNavigationEntryVisitor {
@ -875,8 +840,7 @@ impl CefNavigationEntryVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_visitor_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -884,10 +848,10 @@ impl CefNavigationEntryVisitor {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -900,8 +864,7 @@ impl CefNavigationEntryVisitor {
pub fn visit(&self, entry: interfaces::CefNavigationEntry,
current: libc::c_int, index: libc::c_int,
total: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -932,8 +895,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefNavigationEntryVisitor::from_c_object_addref(c_object))
@ -987,8 +949,7 @@ pub struct CefPdfPrintCallback {
impl Clone for CefPdfPrintCallback {
fn clone(&self) -> CefPdfPrintCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefPdfPrintCallback {
@ -1001,8 +962,7 @@ impl Clone for CefPdfPrintCallback {
impl Drop for CefPdfPrintCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -1017,8 +977,7 @@ impl CefPdfPrintCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_pdf_print_callback_t) -> CefPdfPrintCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefPdfPrintCallback {
@ -1032,8 +991,7 @@ impl CefPdfPrintCallback {
pub fn c_object_addrefed(&self) -> *mut cef_pdf_print_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -1041,10 +999,10 @@ impl CefPdfPrintCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -1053,8 +1011,7 @@ impl CefPdfPrintCallback {
// successfully or false (0) otherwise.
//
pub fn on_pdf_print_finished(&self, path: &[u16], ok: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1083,8 +1040,7 @@ impl CefWrap<*mut cef_pdf_print_callback_t> for Option<CefPdfPrintCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_pdf_print_callback_t) -> Option<CefPdfPrintCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefPdfPrintCallback::from_c_object_addref(c_object))
@ -1544,8 +1500,7 @@ pub struct CefBrowserHost {
impl Clone for CefBrowserHost {
fn clone(&self) -> CefBrowserHost{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefBrowserHost {
@ -1558,8 +1513,7 @@ impl Clone for CefBrowserHost {
impl Drop for CefBrowserHost {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -1574,8 +1528,7 @@ impl CefBrowserHost {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_host_t) -> CefBrowserHost {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefBrowserHost {
@ -1589,8 +1542,7 @@ impl CefBrowserHost {
pub fn c_object_addrefed(&self) -> *mut cef_browser_host_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -1598,18 +1550,17 @@ impl CefBrowserHost {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns the hosted browser object.
//
pub fn get_browser(&self) -> interfaces::CefBrowser {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1630,8 +1581,7 @@ impl CefBrowserHost {
// information.
//
pub fn close_browser(&self, force_close: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1646,8 +1596,7 @@ impl CefBrowserHost {
// Set whether the browser is focused.
//
pub fn set_focus(&self, focus: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1663,8 +1612,7 @@ impl CefBrowserHost {
// (minimized/unminimized, app hidden/unhidden, etc). Only used on Mac OS X.
//
pub fn set_window_visibility(&self, visible: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1679,8 +1627,7 @@ impl CefBrowserHost {
// Retrieve the window handle for this browser.
//
pub fn get_window_handle(&self) -> types::cef_window_handle_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1696,8 +1643,7 @@ impl CefBrowserHost {
// with custom handling of modal windows.
//
pub fn get_opener_window_handle(&self) -> types::cef_window_handle_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1711,8 +1657,7 @@ impl CefBrowserHost {
// Returns the client for this browser.
//
pub fn get_client(&self) -> interfaces::CefClient {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1726,8 +1671,7 @@ impl CefBrowserHost {
// Returns the request context for this browser.
//
pub fn get_request_context(&self) -> interfaces::CefRequestContext {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1742,8 +1686,7 @@ impl CefBrowserHost {
// can only be called on the UI thread.
//
pub fn get_zoom_level(&self) -> libc::c_double {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1759,8 +1702,7 @@ impl CefBrowserHost {
// Otherwise, the change will be applied asynchronously on the UI thread.
//
pub fn set_zoom_level(&self, zoomLevel: libc::c_double) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1791,8 +1733,7 @@ impl CefBrowserHost {
title: &[u16], default_file_path: &[u16], accept_filters: &Vec<String>,
selected_accept_filter: libc::c_int,
callback: interfaces::CefRunFileDialogCallback) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1812,8 +1753,7 @@ impl CefBrowserHost {
// Download the file at |url| using cef_download_handler_t.
//
pub fn start_download(&self, url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1828,8 +1768,7 @@ impl CefBrowserHost {
// Print the current browser contents.
//
pub fn print(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1848,8 +1787,7 @@ impl CefBrowserHost {
pub fn print_to_pdf(&self, path: &[u16],
settings: &interfaces::CefPdfPrintSettings,
callback: interfaces::CefPdfPrintCallback) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1873,8 +1811,7 @@ impl CefBrowserHost {
pub fn find(&self, identifier: libc::c_int, searchText: &[u16],
forward: libc::c_int, matchCase: libc::c_int, findNext: libc::c_int) -> (
) {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1893,8 +1830,7 @@ impl CefBrowserHost {
// Cancel all searches that are currently going on.
//
pub fn stop_finding(&self, clearSelection: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1912,8 +1848,7 @@ impl CefBrowserHost {
pub fn show_dev_tools(&self, windowInfo: &interfaces::CefWindowInfo,
client: interfaces::CefClient, settings: &interfaces::CefBrowserSettings,
inspect_element_at: &types::cef_point_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1932,8 +1867,7 @@ impl CefBrowserHost {
// instance.
//
pub fn close_dev_tools(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1953,8 +1887,7 @@ impl CefBrowserHost {
pub fn get_navigation_entries(&self,
visitor: interfaces::CefNavigationEntryVisitor,
current_only: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1970,8 +1903,7 @@ impl CefBrowserHost {
// Set whether mouse cursor change is disabled.
//
pub fn set_mouse_cursor_change_disabled(&self, disabled: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1986,8 +1918,7 @@ impl CefBrowserHost {
// Returns true (1) if mouse cursor change is disabled.
//
pub fn is_mouse_cursor_change_disabled(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2002,8 +1933,7 @@ impl CefBrowserHost {
// function will replace it with the specified |word|.
//
pub fn replace_misspelling(&self, word: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2018,8 +1948,7 @@ impl CefBrowserHost {
// Add the specified |word| to the spelling dictionary.
//
pub fn add_word_to_dictionary(&self, word: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2034,8 +1963,7 @@ impl CefBrowserHost {
// Returns true (1) if window rendering is disabled.
//
pub fn is_window_rendering_disabled(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2052,8 +1980,7 @@ impl CefBrowserHost {
// function is only used when window rendering is disabled.
//
pub fn was_resized(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2069,8 +1996,7 @@ impl CefBrowserHost {
// hidden. This function is only used when window rendering is disabled.
//
pub fn was_hidden(&self, hidden: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2090,8 +2016,7 @@ impl CefBrowserHost {
// disabled.
//
pub fn notify_screen_info_changed(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2107,8 +2032,7 @@ impl CefBrowserHost {
// disabled.
//
pub fn invalidate(&self, ty: types::cef_paint_element_type_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2123,8 +2047,7 @@ impl CefBrowserHost {
// Send a key event to the browser.
//
pub fn send_key_event(&self, event: &interfaces::CefKeyEvent) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2142,8 +2065,7 @@ impl CefBrowserHost {
pub fn send_mouse_click_event(&self, event: &interfaces::CefMouseEvent,
ty: types::cef_mouse_button_type_t, mouseUp: libc::c_int,
clickCount: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2163,8 +2085,7 @@ impl CefBrowserHost {
//
pub fn send_mouse_move_event(&self, event: &interfaces::CefMouseEvent,
mouseLeave: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2185,8 +2106,7 @@ impl CefBrowserHost {
//
pub fn send_mouse_wheel_event(&self, event: &interfaces::CefMouseEvent,
deltaX: libc::c_int, deltaY: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2203,8 +2123,7 @@ impl CefBrowserHost {
// Send a focus event to the browser.
//
pub fn send_focus_event(&self, setFocus: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2219,8 +2138,7 @@ impl CefBrowserHost {
// Send a capture lost event to the browser.
//
pub fn send_capture_lost_event(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2235,8 +2153,7 @@ impl CefBrowserHost {
// resized. This function is only used on Windows and Linux.
//
pub fn notify_move_or_resize_started(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2254,8 +2171,7 @@ impl CefBrowserHost {
// 30). This function can only be called on the UI thread.
//
pub fn get_windowless_frame_rate(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2273,8 +2189,7 @@ impl CefBrowserHost {
// set at browser creation via cef_browser_tSettings.windowless_frame_rate.
//
pub fn set_windowless_frame_rate(&self, frame_rate: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2290,8 +2205,7 @@ impl CefBrowserHost {
// window rendering is disabled.
//
pub fn get_nstext_input_context(&self) -> types::cef_text_input_context_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2307,8 +2221,7 @@ impl CefBrowserHost {
//
pub fn handle_key_event_before_text_input_client(&self,
keyEvent: types::cef_event_handle_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2324,8 +2237,7 @@ impl CefBrowserHost {
//
pub fn handle_key_event_after_text_input_client(&self,
keyEvent: types::cef_event_handle_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2348,8 +2260,7 @@ impl CefBrowserHost {
pub fn drag_target_drag_enter(&self, drag_data: interfaces::CefDragData,
event: &interfaces::CefMouseEvent,
allowed_ops: types::cef_drag_operations_mask_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2370,8 +2281,7 @@ impl CefBrowserHost {
//
pub fn drag_target_drag_over(&self, event: &interfaces::CefMouseEvent,
allowed_ops: types::cef_drag_operations_mask_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2389,8 +2299,7 @@ impl CefBrowserHost {
// rendering is disabled.
//
pub fn drag_target_drag_leave(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2408,8 +2317,7 @@ impl CefBrowserHost {
// is disabled.
//
pub fn drag_target_drop(&self, event: &interfaces::CefMouseEvent) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2431,8 +2339,7 @@ impl CefBrowserHost {
//
pub fn drag_source_ended_at(&self, x: libc::c_int, y: libc::c_int,
op: types::cef_drag_operations_mask_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2454,8 +2361,7 @@ impl CefBrowserHost {
// This function is only used when window rendering is disabled.
//
pub fn drag_source_system_drag_ended(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2471,8 +2377,7 @@ impl CefBrowserHost {
// function.
//
pub fn composite(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2488,8 +2393,7 @@ impl CefBrowserHost {
// this function.
//
pub fn initialize_compositing(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -2558,8 +2462,7 @@ impl CefWrap<*mut cef_browser_host_t> for Option<CefBrowserHost> {
}
}
unsafe fn to_rust(c_object: *mut cef_browser_host_t) -> Option<CefBrowserHost> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefBrowserHost::from_c_object_addref(c_object))

View File

@ -127,8 +127,7 @@ pub struct CefBrowserProcessHandler {
impl Clone for CefBrowserProcessHandler {
fn clone(&self) -> CefBrowserProcessHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefBrowserProcessHandler {
@ -141,8 +140,7 @@ impl Clone for CefBrowserProcessHandler {
impl Drop for CefBrowserProcessHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -157,8 +155,7 @@ impl CefBrowserProcessHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_process_handler_t) -> CefBrowserProcessHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefBrowserProcessHandler {
@ -172,8 +169,7 @@ impl CefBrowserProcessHandler {
pub fn c_object_addrefed(&self) -> *mut cef_browser_process_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -181,10 +177,10 @@ impl CefBrowserProcessHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -192,8 +188,7 @@ impl CefBrowserProcessHandler {
// has been initialized.
//
pub fn on_context_initialized(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -212,8 +207,7 @@ impl CefBrowserProcessHandler {
//
pub fn on_before_child_process_launch(&self,
command_line: interfaces::CefCommandLine) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -233,8 +227,7 @@ impl CefBrowserProcessHandler {
//
pub fn on_render_process_thread_created(&self,
extra_info: interfaces::CefListValue) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -250,8 +243,7 @@ impl CefBrowserProcessHandler {
// provided then printing will not be supported on the Linux platform.
//
pub fn get_print_handler(&self) -> interfaces::CefPrintHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -266,8 +258,7 @@ impl CefBrowserProcessHandler {
// called from a thread.
//
pub fn on_work_available(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -294,8 +285,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefBrowserProcessHandler::from_c_object_addref(c_object))

View File

@ -90,8 +90,7 @@ pub struct CefCallback {
impl Clone for CefCallback {
fn clone(&self) -> CefCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefCallback {
@ -104,8 +103,7 @@ impl Clone for CefCallback {
impl Drop for CefCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -120,8 +118,7 @@ impl CefCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_callback_t) -> CefCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefCallback {
@ -135,8 +132,7 @@ impl CefCallback {
pub fn c_object_addrefed(&self) -> *mut cef_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -144,18 +140,17 @@ impl CefCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Continue processing.
//
pub fn cont(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -169,8 +164,7 @@ impl CefCallback {
// Cancel processing.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -197,8 +191,7 @@ impl CefWrap<*mut cef_callback_t> for Option<CefCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_callback_t) -> Option<CefCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefCallback::from_c_object_addref(c_object))
@ -247,8 +240,7 @@ pub struct CefCompletionCallback {
impl Clone for CefCompletionCallback {
fn clone(&self) -> CefCompletionCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefCompletionCallback {
@ -261,8 +253,7 @@ impl Clone for CefCompletionCallback {
impl Drop for CefCompletionCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -277,8 +268,7 @@ impl CefCompletionCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_completion_callback_t) -> CefCompletionCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefCompletionCallback {
@ -292,8 +282,7 @@ impl CefCompletionCallback {
pub fn c_object_addrefed(&self) -> *mut cef_completion_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -301,18 +290,17 @@ impl CefCompletionCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Method that will be called once the task is complete.
//
pub fn on_complete(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -339,8 +327,7 @@ impl CefWrap<*mut cef_completion_callback_t> for Option<CefCompletionCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_completion_callback_t) -> Option<CefCompletionCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefCompletionCallback::from_c_object_addref(c_object))

View File

@ -179,8 +179,7 @@ pub struct CefClient {
impl Clone for CefClient {
fn clone(&self) -> CefClient{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefClient {
@ -193,8 +192,7 @@ impl Clone for CefClient {
impl Drop for CefClient {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -209,8 +207,7 @@ impl CefClient {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_client_t) -> CefClient {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefClient {
@ -224,8 +221,7 @@ impl CefClient {
pub fn c_object_addrefed(&self) -> *mut cef_client_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -233,10 +229,10 @@ impl CefClient {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -244,8 +240,7 @@ impl CefClient {
// implementation will be used.
//
pub fn get_context_menu_handler(&self) -> interfaces::CefContextMenuHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -260,8 +255,7 @@ impl CefClient {
// implementation will be used.
//
pub fn get_dialog_handler(&self) -> interfaces::CefDialogHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -275,8 +269,7 @@ impl CefClient {
// Return the handler for browser display state events.
//
pub fn get_display_handler(&self) -> interfaces::CefDisplayHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -291,8 +284,7 @@ impl CefClient {
// will not be allowed.
//
pub fn get_download_handler(&self) -> interfaces::CefDownloadHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -306,8 +298,7 @@ impl CefClient {
// Return the handler for drag events.
//
pub fn get_drag_handler(&self) -> interfaces::CefDragHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -321,8 +312,7 @@ impl CefClient {
// Return the handler for find result events.
//
pub fn get_find_handler(&self) -> interfaces::CefFindHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -336,8 +326,7 @@ impl CefClient {
// Return the handler for focus events.
//
pub fn get_focus_handler(&self) -> interfaces::CefFocusHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -352,8 +341,7 @@ impl CefClient {
// provided geolocation access will be denied by default.
//
pub fn get_geolocation_handler(&self) -> interfaces::CefGeolocationHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -368,8 +356,7 @@ impl CefClient {
// default implementation will be used.
//
pub fn get_jsdialog_handler(&self) -> interfaces::CefJSDialogHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -383,8 +370,7 @@ impl CefClient {
// Return the handler for keyboard events.
//
pub fn get_keyboard_handler(&self) -> interfaces::CefKeyboardHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -398,8 +384,7 @@ impl CefClient {
// Return the handler for browser life span events.
//
pub fn get_life_span_handler(&self) -> interfaces::CefLifeSpanHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -413,8 +398,7 @@ impl CefClient {
// Return the handler for browser load status events.
//
pub fn get_load_handler(&self) -> interfaces::CefLoadHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -428,8 +412,7 @@ impl CefClient {
// Return the handler for off-screen rendering events.
//
pub fn get_render_handler(&self) -> interfaces::CefRenderHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -443,8 +426,7 @@ impl CefClient {
// Return the handler for browser request events.
//
pub fn get_request_handler(&self) -> interfaces::CefRequestHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -462,8 +444,7 @@ impl CefClient {
pub fn on_process_message_received(&self, browser: interfaces::CefBrowser,
source_process: interfaces::CefProcessId,
message: interfaces::CefProcessMessage) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -493,8 +474,7 @@ impl CefWrap<*mut cef_client_t> for Option<CefClient> {
}
}
unsafe fn to_rust(c_object: *mut cef_client_t) -> Option<CefClient> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefClient::from_c_object_addref(c_object))

View File

@ -229,8 +229,7 @@ pub struct CefCommandLine {
impl Clone for CefCommandLine {
fn clone(&self) -> CefCommandLine{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefCommandLine {
@ -243,8 +242,7 @@ impl Clone for CefCommandLine {
impl Drop for CefCommandLine {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -259,8 +257,7 @@ impl CefCommandLine {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_command_line_t) -> CefCommandLine {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefCommandLine {
@ -274,8 +271,7 @@ impl CefCommandLine {
pub fn c_object_addrefed(&self) -> *mut cef_command_line_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -283,10 +279,10 @@ impl CefCommandLine {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -294,8 +290,7 @@ impl CefCommandLine {
// if this function returns false (0).
//
pub fn is_valid(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -310,8 +305,7 @@ impl CefCommandLine {
// expose read-only objects.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -325,8 +319,7 @@ impl CefCommandLine {
// Returns a writable copy of this object.
//
pub fn copy(&self) -> interfaces::CefCommandLine {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -342,8 +335,7 @@ impl CefCommandLine {
// supported on non-Windows platforms.
//
pub fn init_from_argv(&self, argc: libc::c_int, argv: &&str) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -360,8 +352,7 @@ impl CefCommandLine {
// GetCommandLineW(). This function is only supported on Windows.
//
pub fn init_from_string(&self, command_line: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -377,8 +368,7 @@ impl CefCommandLine {
// component unchanged.
//
pub fn reset(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -393,8 +383,7 @@ impl CefCommandLine {
// array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
//
pub fn get_argv(&self, argv: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -411,8 +400,7 @@ impl CefCommandLine {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_command_line_string(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -427,8 +415,7 @@ impl CefCommandLine {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_program(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -442,8 +429,7 @@ impl CefCommandLine {
// Set the program part of the command line string (the first item).
//
pub fn set_program(&self, program: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -458,8 +444,7 @@ impl CefCommandLine {
// Returns true (1) if the command line has switches.
//
pub fn has_switches(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -473,8 +458,7 @@ impl CefCommandLine {
// Returns true (1) if the command line contains the given switch.
//
pub fn has_switch(&self, name: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -491,8 +475,7 @@ impl CefCommandLine {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_switch_value(&self, name: &[u16]) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -508,8 +491,7 @@ impl CefCommandLine {
// NULL string is returned.
//
pub fn get_switches(&self, switches: HashMap<String,String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -525,8 +507,7 @@ impl CefCommandLine {
// pass an NULL value string.
//
pub fn append_switch(&self, name: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -541,8 +522,7 @@ impl CefCommandLine {
// 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]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -558,8 +538,7 @@ impl CefCommandLine {
// True if there are remaining command line arguments.
//
pub fn has_arguments(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -573,8 +552,7 @@ impl CefCommandLine {
// Get the remaining command line arguments.
//
pub fn get_arguments(&self, arguments: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -589,8 +567,7 @@ impl CefCommandLine {
// Add an argument to the end of the command line.
//
pub fn append_argument(&self, argument: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -606,8 +583,7 @@ impl CefCommandLine {
// "valgrind" or "gdb --args".
//
pub fn prepend_wrapper(&self, wrapper: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -658,8 +634,7 @@ impl CefWrap<*mut cef_command_line_t> for Option<CefCommandLine> {
}
}
unsafe fn to_rust(c_object: *mut cef_command_line_t) -> Option<CefCommandLine> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefCommandLine::from_c_object_addref(c_object))

View File

@ -122,8 +122,7 @@ pub struct CefContextMenuHandler {
impl Clone for CefContextMenuHandler {
fn clone(&self) -> CefContextMenuHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefContextMenuHandler {
@ -136,8 +135,7 @@ impl Clone for CefContextMenuHandler {
impl Drop for CefContextMenuHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -152,8 +150,7 @@ impl CefContextMenuHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_handler_t) -> CefContextMenuHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefContextMenuHandler {
@ -167,8 +164,7 @@ impl CefContextMenuHandler {
pub fn c_object_addrefed(&self) -> *mut cef_context_menu_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -176,10 +172,10 @@ impl CefContextMenuHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -192,8 +188,7 @@ impl CefContextMenuHandler {
pub fn on_before_context_menu(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams,
model: interfaces::CefMenuModel) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -220,8 +215,7 @@ impl CefContextMenuHandler {
frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams,
command_id: libc::c_int,
event_flags: types::cef_event_flags_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -242,8 +236,7 @@ impl CefContextMenuHandler {
//
pub fn on_context_menu_dismissed(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -272,8 +265,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefContextMenuHandler::from_c_object_addref(c_object))
@ -450,8 +442,7 @@ pub struct CefContextMenuParams {
impl Clone for CefContextMenuParams {
fn clone(&self) -> CefContextMenuParams{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefContextMenuParams {
@ -464,8 +455,7 @@ impl Clone for CefContextMenuParams {
impl Drop for CefContextMenuParams {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -480,8 +470,7 @@ impl CefContextMenuParams {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_params_t) -> CefContextMenuParams {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefContextMenuParams {
@ -495,8 +484,7 @@ impl CefContextMenuParams {
pub fn c_object_addrefed(&self) -> *mut cef_context_menu_params_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -504,10 +492,10 @@ impl CefContextMenuParams {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -515,8 +503,7 @@ impl CefContextMenuParams {
// Coords are relative to the associated RenderView's origin.
//
pub fn get_xcoord(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -531,8 +518,7 @@ impl CefContextMenuParams {
// Coords are relative to the associated RenderView's origin.
//
pub fn get_ycoord(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -547,8 +533,7 @@ impl CefContextMenuParams {
// invoked on.
//
pub fn get_type_flags(&self) -> types::cef_context_menu_type_flags_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -564,8 +549,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -581,8 +565,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_unfiltered_link_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -598,8 +581,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_source_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -614,8 +596,7 @@ impl CefContextMenuParams {
// NULL contents.
//
pub fn has_image_contents(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -630,8 +611,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_page_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -646,8 +626,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_frame_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -663,8 +642,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_frame_charset(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -678,8 +656,7 @@ impl CefContextMenuParams {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -695,8 +672,7 @@ impl CefContextMenuParams {
//
pub fn get_media_state_flags(
&self) -> types::cef_context_menu_media_state_flags_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -712,8 +688,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_selection_text(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -729,8 +704,7 @@ impl CefContextMenuParams {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_misspelled_word(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -747,8 +721,7 @@ impl CefContextMenuParams {
//
pub fn get_dictionary_suggestions(&self,
suggestions: &Vec<String>) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -763,8 +736,7 @@ impl CefContextMenuParams {
// Returns true (1) if the context menu was invoked on an editable node.
//
pub fn is_editable(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -779,8 +751,7 @@ impl CefContextMenuParams {
// spell-check is enabled.
//
pub fn is_spell_check_enabled(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -796,8 +767,7 @@ impl CefContextMenuParams {
//
pub fn get_edit_state_flags(
&self) -> types::cef_context_menu_edit_state_flags_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -824,8 +794,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefContextMenuParams::from_c_object_addref(c_object))

View File

@ -161,8 +161,7 @@ pub struct CefCookieManager {
impl Clone for CefCookieManager {
fn clone(&self) -> CefCookieManager{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefCookieManager {
@ -175,8 +174,7 @@ impl Clone for CefCookieManager {
impl Drop for CefCookieManager {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -191,8 +189,7 @@ impl CefCookieManager {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_manager_t) -> CefCookieManager {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefCookieManager {
@ -206,8 +203,7 @@ impl CefCookieManager {
pub fn c_object_addrefed(&self) -> *mut cef_cookie_manager_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -215,10 +211,10 @@ impl CefCookieManager {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -229,8 +225,7 @@ impl CefCookieManager {
//
pub fn set_supported_schemes(&self, schemes: &Vec<String>,
callback: interfaces::CefCompletionCallback) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -249,8 +244,7 @@ impl CefCookieManager {
//
pub fn visit_all_cookies(&self,
visitor: interfaces::CefCookieVisitor) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -270,8 +264,7 @@ impl CefCookieManager {
//
pub fn visit_url_cookies(&self, url: &[u16], includeHttpOnly: libc::c_int,
visitor: interfaces::CefCookieVisitor) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -295,8 +288,7 @@ impl CefCookieManager {
//
pub fn set_cookie(&self, url: &[u16], cookie: &interfaces::CefCookie,
callback: interfaces::CefSetCookieCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -322,8 +314,7 @@ impl CefCookieManager {
//
pub fn delete_cookies(&self, url: &[u16], cookie_name: &[u16],
callback: interfaces::CefDeleteCookiesCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -349,8 +340,7 @@ impl CefCookieManager {
pub fn set_storage_path(&self, path: &[u16],
persist_session_cookies: libc::c_int,
callback: interfaces::CefCompletionCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -370,8 +360,7 @@ impl CefCookieManager {
//
pub fn flush_store(&self,
callback: interfaces::CefCompletionCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -436,8 +425,7 @@ impl CefWrap<*mut cef_cookie_manager_t> for Option<CefCookieManager> {
}
}
unsafe fn to_rust(c_object: *mut cef_cookie_manager_t) -> Option<CefCookieManager> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefCookieManager::from_c_object_addref(c_object))
@ -493,8 +481,7 @@ pub struct CefCookieVisitor {
impl Clone for CefCookieVisitor {
fn clone(&self) -> CefCookieVisitor{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefCookieVisitor {
@ -507,8 +494,7 @@ impl Clone for CefCookieVisitor {
impl Drop for CefCookieVisitor {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -523,8 +509,7 @@ impl CefCookieVisitor {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_visitor_t) -> CefCookieVisitor {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefCookieVisitor {
@ -538,8 +523,7 @@ impl CefCookieVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_cookie_visitor_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -547,10 +531,10 @@ impl CefCookieVisitor {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -562,8 +546,7 @@ impl CefCookieVisitor {
//
pub fn visit(&self, cookie: &interfaces::CefCookie, count: libc::c_int,
total: libc::c_int, deleteCookie: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -594,8 +577,7 @@ impl CefWrap<*mut cef_cookie_visitor_t> for Option<CefCookieVisitor> {
}
}
unsafe fn to_rust(c_object: *mut cef_cookie_visitor_t) -> Option<CefCookieVisitor> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefCookieVisitor::from_c_object_addref(c_object))
@ -647,8 +629,7 @@ pub struct CefSetCookieCallback {
impl Clone for CefSetCookieCallback {
fn clone(&self) -> CefSetCookieCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefSetCookieCallback {
@ -661,8 +642,7 @@ impl Clone for CefSetCookieCallback {
impl Drop for CefSetCookieCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -677,8 +657,7 @@ impl CefSetCookieCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_set_cookie_callback_t) -> CefSetCookieCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefSetCookieCallback {
@ -692,8 +671,7 @@ impl CefSetCookieCallback {
pub fn c_object_addrefed(&self) -> *mut cef_set_cookie_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -701,10 +679,10 @@ impl CefSetCookieCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -712,8 +690,7 @@ impl CefSetCookieCallback {
// the cookie was set successfully.
//
pub fn on_complete(&self, success: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -741,8 +718,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefSetCookieCallback::from_c_object_addref(c_object))
@ -795,8 +771,7 @@ pub struct CefDeleteCookiesCallback {
impl Clone for CefDeleteCookiesCallback {
fn clone(&self) -> CefDeleteCookiesCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDeleteCookiesCallback {
@ -809,8 +784,7 @@ impl Clone for CefDeleteCookiesCallback {
impl Drop for CefDeleteCookiesCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -825,8 +799,7 @@ impl CefDeleteCookiesCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_delete_cookies_callback_t) -> CefDeleteCookiesCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDeleteCookiesCallback {
@ -840,8 +813,7 @@ impl CefDeleteCookiesCallback {
pub fn c_object_addrefed(&self) -> *mut cef_delete_cookies_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -849,10 +821,10 @@ impl CefDeleteCookiesCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -860,8 +832,7 @@ impl CefDeleteCookiesCallback {
// number of cookies that were deleted or -1 if unknown.
//
pub fn on_complete(&self, num_deleted: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -889,8 +860,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDeleteCookiesCallback::from_c_object_addref(c_object))

View File

@ -97,8 +97,7 @@ pub struct CefFileDialogCallback {
impl Clone for CefFileDialogCallback {
fn clone(&self) -> CefFileDialogCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefFileDialogCallback {
@ -111,8 +110,7 @@ impl Clone for CefFileDialogCallback {
impl Drop for CefFileDialogCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -127,8 +125,7 @@ impl CefFileDialogCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_file_dialog_callback_t) -> CefFileDialogCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefFileDialogCallback {
@ -142,8 +139,7 @@ impl CefFileDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_file_dialog_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -151,10 +147,10 @@ impl CefFileDialogCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -166,8 +162,7 @@ impl CefFileDialogCallback {
//
pub fn cont(&self, selected_accept_filter: libc::c_int,
file_paths: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -183,8 +178,7 @@ impl CefFileDialogCallback {
// Cancel the file selection.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -211,8 +205,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefFileDialogCallback::from_c_object_addref(c_object))
@ -280,8 +273,7 @@ pub struct CefDialogHandler {
impl Clone for CefDialogHandler {
fn clone(&self) -> CefDialogHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDialogHandler {
@ -294,8 +286,7 @@ impl Clone for CefDialogHandler {
impl Drop for CefDialogHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -310,8 +301,7 @@ impl CefDialogHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_dialog_handler_t) -> CefDialogHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDialogHandler {
@ -325,8 +315,7 @@ impl CefDialogHandler {
pub fn c_object_addrefed(&self) -> *mut cef_dialog_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -334,10 +323,10 @@ impl CefDialogHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -360,8 +349,7 @@ impl CefDialogHandler {
default_file_path: &[u16], accept_filters: &Vec<String>,
selected_accept_filter: libc::c_int,
callback: interfaces::CefFileDialogCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -395,8 +383,7 @@ impl CefWrap<*mut cef_dialog_handler_t> for Option<CefDialogHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_dialog_handler_t) -> Option<CefDialogHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDialogHandler::from_c_object_addref(c_object))

View File

@ -144,8 +144,7 @@ pub struct CefDisplayHandler {
impl Clone for CefDisplayHandler {
fn clone(&self) -> CefDisplayHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDisplayHandler {
@ -158,8 +157,7 @@ impl Clone for CefDisplayHandler {
impl Drop for CefDisplayHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -174,8 +172,7 @@ impl CefDisplayHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_display_handler_t) -> CefDisplayHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDisplayHandler {
@ -189,8 +186,7 @@ impl CefDisplayHandler {
pub fn c_object_addrefed(&self) -> *mut cef_display_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -198,10 +194,10 @@ impl CefDisplayHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -209,8 +205,7 @@ impl CefDisplayHandler {
//
pub fn on_address_change(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -228,8 +223,7 @@ impl CefDisplayHandler {
//
pub fn on_title_change(&self, browser: interfaces::CefBrowser,
title: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -246,8 +240,7 @@ impl CefDisplayHandler {
//
pub fn on_favicon_urlchange(&self, browser: interfaces::CefBrowser,
icon_urls: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -268,8 +261,7 @@ impl CefDisplayHandler {
//
pub fn on_fullscreen_mode_change(&self, browser: interfaces::CefBrowser,
fullscreen: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -291,8 +283,7 @@ impl CefDisplayHandler {
//
pub fn on_tooltip(&self, browser: interfaces::CefBrowser,
text: *mut types::cef_string_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -310,8 +301,7 @@ impl CefDisplayHandler {
//
pub fn on_status_message(&self, browser: interfaces::CefBrowser,
value: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -329,8 +319,7 @@ impl CefDisplayHandler {
//
pub fn on_console_message(&self, browser: interfaces::CefBrowser,
message: &[u16], source: &[u16], line: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -361,8 +350,7 @@ impl CefWrap<*mut cef_display_handler_t> for Option<CefDisplayHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_display_handler_t) -> Option<CefDisplayHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDisplayHandler::from_c_object_addref(c_object))

View File

@ -92,8 +92,7 @@ pub struct CefDOMVisitor {
impl Clone for CefDOMVisitor {
fn clone(&self) -> CefDOMVisitor{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDOMVisitor {
@ -106,8 +105,7 @@ impl Clone for CefDOMVisitor {
impl Drop for CefDOMVisitor {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -122,8 +120,7 @@ impl CefDOMVisitor {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_domvisitor_t) -> CefDOMVisitor {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDOMVisitor {
@ -137,8 +134,7 @@ impl CefDOMVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_domvisitor_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -146,10 +142,10 @@ impl CefDOMVisitor {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -160,8 +156,7 @@ impl CefDOMVisitor {
// of this function.
//
pub fn visit(&self, document: interfaces::CefDOMDocument) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -189,8 +184,7 @@ impl CefWrap<*mut cef_domvisitor_t> for Option<CefDOMVisitor> {
}
}
unsafe fn to_rust(c_object: *mut cef_domvisitor_t) -> Option<CefDOMVisitor> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDOMVisitor::from_c_object_addref(c_object))
@ -325,8 +319,7 @@ pub struct CefDOMDocument {
impl Clone for CefDOMDocument {
fn clone(&self) -> CefDOMDocument{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDOMDocument {
@ -339,8 +332,7 @@ impl Clone for CefDOMDocument {
impl Drop for CefDOMDocument {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -355,8 +347,7 @@ impl CefDOMDocument {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_domdocument_t) -> CefDOMDocument {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDOMDocument {
@ -370,8 +361,7 @@ impl CefDOMDocument {
pub fn c_object_addrefed(&self) -> *mut cef_domdocument_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -379,18 +369,17 @@ impl CefDOMDocument {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns the document type.
//
pub fn get_type(&self) -> types::cef_dom_document_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -404,8 +393,7 @@ impl CefDOMDocument {
// Returns the root document node.
//
pub fn get_document(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -419,8 +407,7 @@ impl CefDOMDocument {
// Returns the BODY node of an HTML document.
//
pub fn get_body(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -434,8 +421,7 @@ impl CefDOMDocument {
// Returns the HEAD node of an HTML document.
//
pub fn get_head(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -450,8 +436,7 @@ impl CefDOMDocument {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_title(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -465,8 +450,7 @@ impl CefDOMDocument {
// Returns the document element with the specified ID value.
//
pub fn get_element_by_id(&self, id: &[u16]) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -481,8 +465,7 @@ impl CefDOMDocument {
// Returns the node that currently has keyboard focus.
//
pub fn get_focused_node(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -496,8 +479,7 @@ impl CefDOMDocument {
// Returns true (1) if a portion of the document is selected.
//
pub fn has_selection(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -511,8 +493,7 @@ impl CefDOMDocument {
// Returns the selection offset within the start node.
//
pub fn get_selection_start_offset(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -526,8 +507,7 @@ impl CefDOMDocument {
// Returns the selection offset within the end node.
//
pub fn get_selection_end_offset(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -542,8 +522,7 @@ impl CefDOMDocument {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_selection_as_markup(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -558,8 +537,7 @@ impl CefDOMDocument {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_selection_as_text(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -574,8 +552,7 @@ impl CefDOMDocument {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_base_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -591,8 +568,7 @@ impl CefDOMDocument {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_complete_url(&self, partialURL: &[u16]) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -620,8 +596,7 @@ impl CefWrap<*mut cef_domdocument_t> for Option<CefDOMDocument> {
}
}
unsafe fn to_rust(c_object: *mut cef_domdocument_t) -> Option<CefDOMDocument> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDOMDocument::from_c_object_addref(c_object))
@ -828,8 +803,7 @@ pub struct CefDOMNode {
impl Clone for CefDOMNode {
fn clone(&self) -> CefDOMNode{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDOMNode {
@ -842,8 +816,7 @@ impl Clone for CefDOMNode {
impl Drop for CefDOMNode {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -858,8 +831,7 @@ impl CefDOMNode {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_domnode_t) -> CefDOMNode {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDOMNode {
@ -873,8 +845,7 @@ impl CefDOMNode {
pub fn c_object_addrefed(&self) -> *mut cef_domnode_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -882,18 +853,17 @@ impl CefDOMNode {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns the type for this node.
//
pub fn get_type(&self) -> types::cef_dom_node_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -907,8 +877,7 @@ impl CefDOMNode {
// Returns true (1) if this is a text node.
//
pub fn is_text(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -922,8 +891,7 @@ impl CefDOMNode {
// Returns true (1) if this is an element node.
//
pub fn is_element(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -937,8 +905,7 @@ impl CefDOMNode {
// Returns true (1) if this is an editable node.
//
pub fn is_editable(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -952,8 +919,7 @@ impl CefDOMNode {
// Returns true (1) if this is a form control element node.
//
pub fn is_form_control_element(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -968,8 +934,7 @@ impl CefDOMNode {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_form_control_element_type(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -984,8 +949,7 @@ impl CefDOMNode {
// object.
//
pub fn is_same(&self, that: interfaces::CefDOMNode) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1001,8 +965,7 @@ impl CefDOMNode {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1017,8 +980,7 @@ impl CefDOMNode {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_value(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1032,8 +994,7 @@ impl CefDOMNode {
// Set the value of this node. Returns true (1) on success.
//
pub fn set_value(&self, value: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1049,8 +1010,7 @@ impl CefDOMNode {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_as_markup(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1064,8 +1024,7 @@ impl CefDOMNode {
// Returns the document associated with this node.
//
pub fn get_document(&self) -> interfaces::CefDOMDocument {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1079,8 +1038,7 @@ impl CefDOMNode {
// Returns the parent node.
//
pub fn get_parent(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1094,8 +1052,7 @@ impl CefDOMNode {
// Returns the previous sibling node.
//
pub fn get_previous_sibling(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1109,8 +1066,7 @@ impl CefDOMNode {
// Returns the next sibling node.
//
pub fn get_next_sibling(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1124,8 +1080,7 @@ impl CefDOMNode {
// Returns true (1) if this node has child nodes.
//
pub fn has_children(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1139,8 +1094,7 @@ impl CefDOMNode {
// Return the first child node.
//
pub fn get_first_child(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1154,8 +1108,7 @@ impl CefDOMNode {
// Returns the last child node.
//
pub fn get_last_child(&self) -> interfaces::CefDOMNode {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1173,8 +1126,7 @@ impl CefDOMNode {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_element_tag_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1188,8 +1140,7 @@ impl CefDOMNode {
// Returns true (1) if this element has attributes.
//
pub fn has_element_attributes(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1203,8 +1154,7 @@ impl CefDOMNode {
// Returns true (1) if this element has an attribute named |attrName|.
//
pub fn has_element_attribute(&self, attrName: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1220,8 +1170,7 @@ impl CefDOMNode {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_element_attribute(&self, attrName: &[u16]) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1236,8 +1185,7 @@ impl CefDOMNode {
// Returns a map of all element attributes.
//
pub fn get_element_attributes(&self, attrMap: HashMap<String,String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1254,8 +1202,7 @@ impl CefDOMNode {
//
pub fn set_element_attribute(&self, attrName: &[u16],
value: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1272,8 +1219,7 @@ impl CefDOMNode {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_element_inner_text(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -1300,8 +1246,7 @@ impl CefWrap<*mut cef_domnode_t> for Option<CefDOMNode> {
}
}
unsafe fn to_rust(c_object: *mut cef_domnode_t) -> Option<CefDOMNode> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDOMNode::from_c_object_addref(c_object))

View File

@ -90,8 +90,7 @@ pub struct CefBeforeDownloadCallback {
impl Clone for CefBeforeDownloadCallback {
fn clone(&self) -> CefBeforeDownloadCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefBeforeDownloadCallback {
@ -104,8 +103,7 @@ impl Clone for CefBeforeDownloadCallback {
impl Drop for CefBeforeDownloadCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -120,8 +118,7 @@ impl CefBeforeDownloadCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_before_download_callback_t) -> CefBeforeDownloadCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefBeforeDownloadCallback {
@ -135,8 +132,7 @@ impl CefBeforeDownloadCallback {
pub fn c_object_addrefed(&self) -> *mut cef_before_download_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -144,10 +140,10 @@ impl CefBeforeDownloadCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -157,8 +153,7 @@ impl CefBeforeDownloadCallback {
// (1) if you do wish to show the default "Save As" dialog.
//
pub fn cont(&self, download_path: &[u16], show_dialog: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -187,8 +182,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefBeforeDownloadCallback::from_c_object_addref(c_object))
@ -249,8 +243,7 @@ pub struct CefDownloadItemCallback {
impl Clone for CefDownloadItemCallback {
fn clone(&self) -> CefDownloadItemCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDownloadItemCallback {
@ -263,8 +256,7 @@ impl Clone for CefDownloadItemCallback {
impl Drop for CefDownloadItemCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -279,8 +271,7 @@ impl CefDownloadItemCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_callback_t) -> CefDownloadItemCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDownloadItemCallback {
@ -294,8 +285,7 @@ impl CefDownloadItemCallback {
pub fn c_object_addrefed(&self) -> *mut cef_download_item_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -303,18 +293,17 @@ impl CefDownloadItemCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Call to cancel the download.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -328,8 +317,7 @@ impl CefDownloadItemCallback {
// Call to pause the download.
//
pub fn pause(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -343,8 +331,7 @@ impl CefDownloadItemCallback {
// Call to resume the download.
//
pub fn resume(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -371,8 +358,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDownloadItemCallback::from_c_object_addref(c_object))
@ -444,8 +430,7 @@ pub struct CefDownloadHandler {
impl Clone for CefDownloadHandler {
fn clone(&self) -> CefDownloadHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDownloadHandler {
@ -458,8 +443,7 @@ impl Clone for CefDownloadHandler {
impl Drop for CefDownloadHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -474,8 +458,7 @@ impl CefDownloadHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_handler_t) -> CefDownloadHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDownloadHandler {
@ -489,8 +472,7 @@ impl CefDownloadHandler {
pub fn c_object_addrefed(&self) -> *mut cef_download_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -498,10 +480,10 @@ impl CefDownloadHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -514,8 +496,7 @@ impl CefDownloadHandler {
pub fn on_before_download(&self, browser: interfaces::CefBrowser,
download_item: interfaces::CefDownloadItem, suggested_name: &[u16],
callback: interfaces::CefBeforeDownloadCallback) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -539,8 +520,7 @@ impl CefDownloadHandler {
pub fn on_download_updated(&self, browser: interfaces::CefBrowser,
download_item: interfaces::CefDownloadItem,
callback: interfaces::CefDownloadItemCallback) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -570,8 +550,7 @@ impl CefWrap<*mut cef_download_handler_t> for Option<CefDownloadHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_download_handler_t) -> Option<CefDownloadHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDownloadHandler::from_c_object_addref(c_object))

View File

@ -189,8 +189,7 @@ pub struct CefDownloadItem {
impl Clone for CefDownloadItem {
fn clone(&self) -> CefDownloadItem{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDownloadItem {
@ -203,8 +202,7 @@ impl Clone for CefDownloadItem {
impl Drop for CefDownloadItem {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -219,8 +217,7 @@ impl CefDownloadItem {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_t) -> CefDownloadItem {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDownloadItem {
@ -234,8 +231,7 @@ impl CefDownloadItem {
pub fn c_object_addrefed(&self) -> *mut cef_download_item_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -243,10 +239,10 @@ impl CefDownloadItem {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -254,8 +250,7 @@ impl CefDownloadItem {
// if this function returns false (0).
//
pub fn is_valid(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -269,8 +264,7 @@ impl CefDownloadItem {
// Returns true (1) if the download is in progress.
//
pub fn is_in_progress(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -284,8 +278,7 @@ impl CefDownloadItem {
// Returns true (1) if the download is complete.
//
pub fn is_complete(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -299,8 +292,7 @@ impl CefDownloadItem {
// Returns true (1) if the download has been canceled or interrupted.
//
pub fn is_canceled(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -314,8 +306,7 @@ impl CefDownloadItem {
// Returns a simple speed estimate in bytes/s.
//
pub fn get_current_speed(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -330,8 +321,7 @@ impl CefDownloadItem {
// unknown.
//
pub fn get_percent_complete(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -345,8 +335,7 @@ impl CefDownloadItem {
// Returns the total number of bytes.
//
pub fn get_total_bytes(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -360,8 +349,7 @@ impl CefDownloadItem {
// Returns the number of received bytes.
//
pub fn get_received_bytes(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -375,8 +363,7 @@ impl CefDownloadItem {
// Returns the time that the download started.
//
pub fn get_start_time(&self) -> types::cef_time_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -390,8 +377,7 @@ impl CefDownloadItem {
// Returns the time that the download ended.
//
pub fn get_end_time(&self) -> types::cef_time_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -406,8 +392,7 @@ impl CefDownloadItem {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_full_path(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -421,8 +406,7 @@ impl CefDownloadItem {
// Returns the unique identifier for this download.
//
pub fn get_id(&self) -> u32 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -437,8 +421,7 @@ impl CefDownloadItem {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -453,8 +436,7 @@ impl CefDownloadItem {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_original_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -469,8 +451,7 @@ impl CefDownloadItem {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_suggested_file_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -485,8 +466,7 @@ impl CefDownloadItem {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_content_disposition(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -501,8 +481,7 @@ impl CefDownloadItem {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_mime_type(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -529,8 +508,7 @@ impl CefWrap<*mut cef_download_item_t> for Option<CefDownloadItem> {
}
}
unsafe fn to_rust(c_object: *mut cef_download_item_t) -> Option<CefDownloadItem> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDownloadItem::from_c_object_addref(c_object))

View File

@ -227,8 +227,7 @@ pub struct CefDragData {
impl Clone for CefDragData {
fn clone(&self) -> CefDragData{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDragData {
@ -241,8 +240,7 @@ impl Clone for CefDragData {
impl Drop for CefDragData {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -257,8 +255,7 @@ impl CefDragData {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_data_t) -> CefDragData {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDragData {
@ -272,8 +269,7 @@ impl CefDragData {
pub fn c_object_addrefed(&self) -> *mut cef_drag_data_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -281,18 +277,17 @@ impl CefDragData {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns a copy of the current object.
//
pub fn clone(&self) -> interfaces::CefDragData {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -306,8 +301,7 @@ impl CefDragData {
// Returns true (1) if this object is read-only.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -321,8 +315,7 @@ impl CefDragData {
// Returns true (1) if the drag data is a link.
//
pub fn is_link(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -336,8 +329,7 @@ impl CefDragData {
// Returns true (1) if the drag data is a text or html fragment.
//
pub fn is_fragment(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -351,8 +343,7 @@ impl CefDragData {
// Returns true (1) if the drag data is a file.
//
pub fn is_file(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -367,8 +358,7 @@ impl CefDragData {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -383,8 +373,7 @@ impl CefDragData {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_title(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -399,8 +388,7 @@ impl CefDragData {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_link_metadata(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -415,8 +403,7 @@ impl CefDragData {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_fragment_text(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -431,8 +418,7 @@ impl CefDragData {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_fragment_html(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -448,8 +434,7 @@ impl CefDragData {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_fragment_base_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -464,8 +449,7 @@ impl CefDragData {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_file_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -483,8 +467,7 @@ impl CefDragData {
//
pub fn get_file_contents(&self,
writer: interfaces::CefStreamWriter) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -500,8 +483,7 @@ impl CefDragData {
// window.
//
pub fn get_file_names(&self, names: &Vec<String>) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -516,8 +498,7 @@ impl CefDragData {
// Set the link URL that is being dragged.
//
pub fn set_link_url(&self, url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -532,8 +513,7 @@ impl CefDragData {
// Set the title associated with the link being dragged.
//
pub fn set_link_title(&self, title: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -548,8 +528,7 @@ impl CefDragData {
// Set the metadata associated with the link being dragged.
//
pub fn set_link_metadata(&self, data: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -564,8 +543,7 @@ impl CefDragData {
// Set the plain text fragment that is being dragged.
//
pub fn set_fragment_text(&self, text: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -580,8 +558,7 @@ impl CefDragData {
// Set the text/html fragment that is being dragged.
//
pub fn set_fragment_html(&self, html: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -596,8 +573,7 @@ impl CefDragData {
// Set the base URL that the fragment came from.
//
pub fn set_fragment_base_url(&self, base_url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -614,8 +590,7 @@ impl CefDragData {
// to drag in this kind of data.
//
pub fn reset_file_contents(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -629,8 +604,7 @@ impl CefDragData {
// Add a file that is being dragged into the webview.
//
pub fn add_file(&self, path: &[u16], display_name: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -670,8 +644,7 @@ impl CefWrap<*mut cef_drag_data_t> for Option<CefDragData> {
}
}
unsafe fn to_rust(c_object: *mut cef_drag_data_t) -> Option<CefDragData> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDragData::from_c_object_addref(c_object))

View File

@ -105,8 +105,7 @@ pub struct CefDragHandler {
impl Clone for CefDragHandler {
fn clone(&self) -> CefDragHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefDragHandler {
@ -119,8 +118,7 @@ impl Clone for CefDragHandler {
impl Drop for CefDragHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -135,8 +133,7 @@ impl CefDragHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_handler_t) -> CefDragHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefDragHandler {
@ -150,8 +147,7 @@ impl CefDragHandler {
pub fn c_object_addrefed(&self) -> *mut cef_drag_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -159,10 +155,10 @@ impl CefDragHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -174,8 +170,7 @@ impl CefDragHandler {
pub fn on_drag_enter(&self, browser: interfaces::CefBrowser,
dragData: interfaces::CefDragData,
mask: types::cef_drag_operations_mask_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -198,8 +193,7 @@ impl CefDragHandler {
pub fn on_draggable_regions_changed(&self, browser: interfaces::CefBrowser,
regions_count: libc::size_t,
regions: *const types::cef_draggable_region_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -229,8 +223,7 @@ impl CefWrap<*mut cef_drag_handler_t> for Option<CefDragHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_drag_handler_t) -> Option<CefDragHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefDragHandler::from_c_object_addref(c_object))

View File

@ -95,8 +95,7 @@ pub struct CefFindHandler {
impl Clone for CefFindHandler {
fn clone(&self) -> CefFindHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefFindHandler {
@ -109,8 +108,7 @@ impl Clone for CefFindHandler {
impl Drop for CefFindHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -125,8 +123,7 @@ impl CefFindHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_find_handler_t) -> CefFindHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefFindHandler {
@ -140,8 +137,7 @@ impl CefFindHandler {
pub fn c_object_addrefed(&self) -> *mut cef_find_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -149,10 +145,10 @@ impl CefFindHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -167,8 +163,7 @@ impl CefFindHandler {
identifier: libc::c_int, count: libc::c_int,
selectionRect: &types::cef_rect_t, activeMatchOrdinal: libc::c_int,
finalUpdate: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -201,8 +196,7 @@ impl CefWrap<*mut cef_find_handler_t> for Option<CefFindHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_find_handler_t) -> Option<CefFindHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefFindHandler::from_c_object_addref(c_object))

View File

@ -106,8 +106,7 @@ pub struct CefFocusHandler {
impl Clone for CefFocusHandler {
fn clone(&self) -> CefFocusHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefFocusHandler {
@ -120,8 +119,7 @@ impl Clone for CefFocusHandler {
impl Drop for CefFocusHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -136,8 +134,7 @@ impl CefFocusHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_focus_handler_t) -> CefFocusHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefFocusHandler {
@ -151,8 +148,7 @@ impl CefFocusHandler {
pub fn c_object_addrefed(&self) -> *mut cef_focus_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -160,10 +156,10 @@ impl CefFocusHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -174,8 +170,7 @@ impl CefFocusHandler {
//
pub fn on_take_focus(&self, browser: interfaces::CefBrowser,
next: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -194,8 +189,7 @@ impl CefFocusHandler {
//
pub fn on_set_focus(&self, browser: interfaces::CefBrowser,
source: types::cef_focus_source_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -211,8 +205,7 @@ impl CefFocusHandler {
// Called when the browser component has received focus.
//
pub fn on_got_focus(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -240,8 +233,7 @@ impl CefWrap<*mut cef_focus_handler_t> for Option<CefFocusHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_focus_handler_t) -> Option<CefFocusHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefFocusHandler::from_c_object_addref(c_object))

View File

@ -239,8 +239,7 @@ pub struct CefFrame {
impl Clone for CefFrame {
fn clone(&self) -> CefFrame{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefFrame {
@ -253,8 +252,7 @@ impl Clone for CefFrame {
impl Drop for CefFrame {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -269,8 +267,7 @@ impl CefFrame {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_frame_t) -> CefFrame {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefFrame {
@ -284,8 +281,7 @@ impl CefFrame {
pub fn c_object_addrefed(&self) -> *mut cef_frame_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -293,18 +289,17 @@ impl CefFrame {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// True if this object is currently attached to a valid frame.
//
pub fn is_valid(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -318,8 +313,7 @@ impl CefFrame {
// Execute undo in this frame.
//
pub fn undo(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -333,8 +327,7 @@ impl CefFrame {
// Execute redo in this frame.
//
pub fn redo(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -348,8 +341,7 @@ impl CefFrame {
// Execute cut in this frame.
//
pub fn cut(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -363,8 +355,7 @@ impl CefFrame {
// Execute copy in this frame.
//
pub fn copy(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -378,8 +369,7 @@ impl CefFrame {
// Execute paste in this frame.
//
pub fn paste(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -393,8 +383,7 @@ impl CefFrame {
// Execute delete in this frame.
//
pub fn del(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -408,8 +397,7 @@ impl CefFrame {
// Execute select all in this frame.
//
pub fn select_all(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -425,8 +413,7 @@ impl CefFrame {
// browser process.
//
pub fn view_source(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -441,8 +428,7 @@ impl CefFrame {
// visitor.
//
pub fn get_source(&self, visitor: interfaces::CefStringVisitor) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -458,8 +444,7 @@ impl CefFrame {
// visitor.
//
pub fn get_text(&self, visitor: interfaces::CefStringVisitor) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -474,8 +459,7 @@ impl CefFrame {
// Load the request represented by the |request| object.
//
pub fn load_request(&self, request: interfaces::CefRequest) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -490,8 +474,7 @@ impl CefFrame {
// Load the specified |url|.
//
pub fn load_url(&self, url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -508,8 +491,7 @@ impl CefFrame {
// link clicks and web security restrictions may not behave as expected.
//
pub fn load_string(&self, string_val: &[u16], url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -530,8 +512,7 @@ impl CefFrame {
//
pub fn execute_java_script(&self, code: &[u16], script_url: &[u16],
start_line: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -548,8 +529,7 @@ impl CefFrame {
// Returns true (1) if this is the main (top-level) frame.
//
pub fn is_main(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -563,8 +543,7 @@ impl CefFrame {
// Returns true (1) if this is the focused frame.
//
pub fn is_focused(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -583,8 +562,7 @@ impl CefFrame {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -598,8 +576,7 @@ impl CefFrame {
// Returns the globally unique identifier for this frame.
//
pub fn get_identifier(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -614,8 +591,7 @@ impl CefFrame {
// frame.
//
pub fn get_parent(&self) -> interfaces::CefFrame {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -630,8 +606,7 @@ impl CefFrame {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -645,8 +620,7 @@ impl CefFrame {
// Returns the browser that this frame belongs to.
//
pub fn get_browser(&self) -> interfaces::CefBrowser {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -661,8 +635,7 @@ impl CefFrame {
// called from the render process.
//
pub fn get_v8context(&self) -> interfaces::CefV8Context {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -677,8 +650,7 @@ impl CefFrame {
// process.
//
pub fn visit_dom(&self, visitor: interfaces::CefDOMVisitor) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -706,8 +678,7 @@ impl CefWrap<*mut cef_frame_t> for Option<CefFrame> {
}
}
unsafe fn to_rust(c_object: *mut cef_frame_t) -> Option<CefFrame> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefFrame::from_c_object_addref(c_object))

View File

@ -90,8 +90,7 @@ pub struct CefGetGeolocationCallback {
impl Clone for CefGetGeolocationCallback {
fn clone(&self) -> CefGetGeolocationCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefGetGeolocationCallback {
@ -104,8 +103,7 @@ impl Clone for CefGetGeolocationCallback {
impl Drop for CefGetGeolocationCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -120,8 +118,7 @@ impl CefGetGeolocationCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_get_geolocation_callback_t) -> CefGetGeolocationCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefGetGeolocationCallback {
@ -135,8 +132,7 @@ impl CefGetGeolocationCallback {
pub fn c_object_addrefed(&self) -> *mut cef_get_geolocation_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -144,10 +140,10 @@ impl CefGetGeolocationCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -156,8 +152,7 @@ impl CefGetGeolocationCallback {
//
pub fn on_location_update(&self, position: &interfaces::CefGeoposition) -> (
) {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -185,8 +180,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefGetGeolocationCallback::from_c_object_addref(c_object))

View File

@ -88,8 +88,7 @@ pub struct CefGeolocationCallback {
impl Clone for CefGeolocationCallback {
fn clone(&self) -> CefGeolocationCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefGeolocationCallback {
@ -102,8 +101,7 @@ impl Clone for CefGeolocationCallback {
impl Drop for CefGeolocationCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -118,8 +116,7 @@ impl CefGeolocationCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_callback_t) -> CefGeolocationCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefGeolocationCallback {
@ -133,8 +130,7 @@ impl CefGeolocationCallback {
pub fn c_object_addrefed(&self) -> *mut cef_geolocation_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -142,18 +138,17 @@ impl CefGeolocationCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Call to allow or deny geolocation access.
//
pub fn cont(&self, allow: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -181,8 +176,7 @@ impl CefWrap<*mut cef_geolocation_callback_t> for Option<CefGeolocationCallback>
}
}
unsafe fn to_rust(c_object: *mut cef_geolocation_callback_t) -> Option<CefGeolocationCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefGeolocationCallback::from_c_object_addref(c_object))
@ -254,8 +248,7 @@ pub struct CefGeolocationHandler {
impl Clone for CefGeolocationHandler {
fn clone(&self) -> CefGeolocationHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefGeolocationHandler {
@ -268,8 +261,7 @@ impl Clone for CefGeolocationHandler {
impl Drop for CefGeolocationHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -284,8 +276,7 @@ impl CefGeolocationHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_handler_t) -> CefGeolocationHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefGeolocationHandler {
@ -299,8 +290,7 @@ impl CefGeolocationHandler {
pub fn c_object_addrefed(&self) -> *mut cef_geolocation_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -308,10 +298,10 @@ impl CefGeolocationHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -326,8 +316,7 @@ impl CefGeolocationHandler {
browser: interfaces::CefBrowser, requesting_url: &[u16],
request_id: libc::c_int,
callback: interfaces::CefGeolocationCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -349,8 +338,7 @@ impl CefGeolocationHandler {
pub fn on_cancel_geolocation_permission(&self,
browser: interfaces::CefBrowser, requesting_url: &[u16],
request_id: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null(){
panic!("called a CEF method on a null object")
}
unsafe {
@ -380,8 +368,7 @@ impl CefWrap<*mut cef_geolocation_handler_t> for Option<CefGeolocationHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_geolocation_handler_t) -> Option<CefGeolocationHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefGeolocationHandler::from_c_object_addref(c_object))

View File

@ -89,8 +89,7 @@ pub struct CefJSDialogCallback {
impl Clone for CefJSDialogCallback {
fn clone(&self) -> CefJSDialogCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefJSDialogCallback {
@ -103,8 +102,7 @@ impl Clone for CefJSDialogCallback {
impl Drop for CefJSDialogCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -119,8 +117,7 @@ impl CefJSDialogCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_jsdialog_callback_t) -> CefJSDialogCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefJSDialogCallback {
@ -134,8 +131,7 @@ impl CefJSDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_jsdialog_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -143,10 +139,10 @@ impl CefJSDialogCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -154,8 +150,7 @@ impl CefJSDialogCallback {
// was pressed. The |user_input| value should be specified for prompt dialogs.
//
pub fn cont(&self, success: libc::c_int, user_input: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -184,8 +179,7 @@ impl CefWrap<*mut cef_jsdialog_callback_t> for Option<CefJSDialogCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_jsdialog_callback_t) -> Option<CefJSDialogCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefJSDialogCallback::from_c_object_addref(c_object))
@ -284,8 +278,7 @@ pub struct CefJSDialogHandler {
impl Clone for CefJSDialogHandler {
fn clone(&self) -> CefJSDialogHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefJSDialogHandler {
@ -298,8 +291,7 @@ impl Clone for CefJSDialogHandler {
impl Drop for CefJSDialogHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -314,8 +306,7 @@ impl CefJSDialogHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_jsdialog_handler_t) -> CefJSDialogHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefJSDialogHandler {
@ -329,8 +320,7 @@ impl CefJSDialogHandler {
pub fn c_object_addrefed(&self) -> *mut cef_jsdialog_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -338,10 +328,10 @@ impl CefJSDialogHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -364,8 +354,7 @@ impl CefJSDialogHandler {
message_text: &[u16], default_prompt_text: &[u16],
callback: interfaces::CefJSDialogCallback,
suppress_message: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -394,8 +383,7 @@ impl CefJSDialogHandler {
pub fn on_before_unload_dialog(&self, browser: interfaces::CefBrowser,
message_text: &[u16], is_reload: libc::c_int,
callback: interfaces::CefJSDialogCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -415,8 +403,7 @@ impl CefJSDialogHandler {
// dialogs are currently pending.
//
pub fn on_reset_dialog_state(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -431,8 +418,7 @@ impl CefJSDialogHandler {
// Called when the default implementation dialog is closed.
//
pub fn on_dialog_closed(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -460,8 +446,7 @@ impl CefWrap<*mut cef_jsdialog_handler_t> for Option<CefJSDialogHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_jsdialog_handler_t) -> Option<CefJSDialogHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefJSDialogHandler::from_c_object_addref(c_object))

View File

@ -104,8 +104,7 @@ pub struct CefKeyboardHandler {
impl Clone for CefKeyboardHandler {
fn clone(&self) -> CefKeyboardHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefKeyboardHandler {
@ -118,8 +117,7 @@ impl Clone for CefKeyboardHandler {
impl Drop for CefKeyboardHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -134,8 +132,7 @@ impl CefKeyboardHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_keyboard_handler_t) -> CefKeyboardHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefKeyboardHandler {
@ -149,8 +146,7 @@ impl CefKeyboardHandler {
pub fn c_object_addrefed(&self) -> *mut cef_keyboard_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -158,10 +154,10 @@ impl CefKeyboardHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
// Called before a keyboard event is sent to the renderer. |event| contains
@ -172,8 +168,7 @@ impl CefKeyboardHandler {
pub fn on_pre_key_event(&self, browser: interfaces::CefBrowser,
event: &interfaces::CefKeyEvent, os_event: types::cef_event_handle_t,
is_keyboard_shortcut: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -196,8 +191,7 @@ impl CefKeyboardHandler {
pub fn on_key_event(&self, browser: interfaces::CefBrowser,
event: &interfaces::CefKeyEvent,
os_event: types::cef_event_handle_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -227,8 +221,7 @@ impl CefWrap<*mut cef_keyboard_handler_t> for Option<CefKeyboardHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_keyboard_handler_t) -> Option<CefKeyboardHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefKeyboardHandler::from_c_object_addref(c_object))

View File

@ -199,8 +199,7 @@ pub struct CefLifeSpanHandler {
impl Clone for CefLifeSpanHandler {
fn clone(&self) -> CefLifeSpanHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefLifeSpanHandler {
@ -213,8 +212,7 @@ impl Clone for CefLifeSpanHandler {
impl Drop for CefLifeSpanHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -229,8 +227,7 @@ impl CefLifeSpanHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_life_span_handler_t) -> CefLifeSpanHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefLifeSpanHandler {
@ -244,8 +241,7 @@ impl CefLifeSpanHandler {
pub fn c_object_addrefed(&self) -> *mut cef_life_span_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -253,10 +249,10 @@ impl CefLifeSpanHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -285,8 +281,7 @@ impl CefLifeSpanHandler {
client: interfaces::CefClient,
settings: &mut interfaces::CefBrowserSettings,
no_javascript_access: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -311,8 +306,7 @@ impl CefLifeSpanHandler {
// Called after a new browser is created.
//
pub fn on_after_created(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -329,8 +323,7 @@ impl CefLifeSpanHandler {
// implementation or true (1) to use a custom implementation.
//
pub fn run_modal(&self, browser: interfaces::CefBrowser) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -399,8 +392,7 @@ impl CefLifeSpanHandler {
// exist.
//
pub fn do_close(&self, browser: interfaces::CefBrowser) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -420,8 +412,7 @@ impl CefLifeSpanHandler {
// additional usage information.
//
pub fn on_before_close(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -449,8 +440,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefLifeSpanHandler::from_c_object_addref(c_object))

View File

@ -132,8 +132,7 @@ pub struct CefLoadHandler {
impl Clone for CefLoadHandler {
fn clone(&self) -> CefLoadHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefLoadHandler {
@ -146,8 +145,7 @@ impl Clone for CefLoadHandler {
impl Drop for CefLoadHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -162,8 +160,7 @@ impl CefLoadHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_load_handler_t) -> CefLoadHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefLoadHandler {
@ -177,8 +174,7 @@ impl CefLoadHandler {
pub fn c_object_addrefed(&self) -> *mut cef_load_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -186,10 +182,10 @@ impl CefLoadHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -201,8 +197,7 @@ impl CefLoadHandler {
pub fn on_loading_state_change(&self, browser: interfaces::CefBrowser,
isLoading: libc::c_int, canGoBack: libc::c_int,
canGoForward: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -227,8 +222,7 @@ impl CefLoadHandler {
//
pub fn on_load_start(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -250,8 +244,7 @@ impl CefLoadHandler {
//
pub fn on_load_end(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, httpStatusCode: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -273,8 +266,7 @@ impl CefLoadHandler {
pub fn on_load_error(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, errorCode: types::cef_errorcode_t,
errorText: &[u16], failedUrl: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -306,8 +298,7 @@ impl CefWrap<*mut cef_load_handler_t> for Option<CefLoadHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_load_handler_t) -> Option<CefLoadHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefLoadHandler::from_c_object_addref(c_object))

View File

@ -426,8 +426,7 @@ pub struct CefMenuModel {
impl Clone for CefMenuModel {
fn clone(&self) -> CefMenuModel{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefMenuModel {
@ -440,8 +439,7 @@ impl Clone for CefMenuModel {
impl Drop for CefMenuModel {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -456,8 +454,7 @@ impl CefMenuModel {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_menu_model_t) -> CefMenuModel {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefMenuModel {
@ -471,8 +468,7 @@ impl CefMenuModel {
pub fn c_object_addrefed(&self) -> *mut cef_menu_model_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -480,18 +476,17 @@ impl CefMenuModel {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Clears the menu. Returns true (1) on success.
//
pub fn clear(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -505,8 +500,7 @@ impl CefMenuModel {
// Returns the number of items in this menu.
//
pub fn get_count(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -520,8 +514,7 @@ impl CefMenuModel {
// Add a separator to the menu. Returns true (1) on success.
//
pub fn add_separator(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -536,8 +529,7 @@ impl CefMenuModel {
//
pub fn add_item(&self, command_id: libc::c_int,
label: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -554,8 +546,7 @@ impl CefMenuModel {
//
pub fn add_check_item(&self, command_id: libc::c_int,
label: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -573,8 +564,7 @@ impl CefMenuModel {
//
pub fn add_radio_item(&self, command_id: libc::c_int, label: &[u16],
group_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -592,8 +582,7 @@ impl CefMenuModel {
//
pub fn add_sub_menu(&self, command_id: libc::c_int,
label: &[u16]) -> interfaces::CefMenuModel {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -610,8 +599,7 @@ impl CefMenuModel {
// on success.
//
pub fn insert_separator_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -628,8 +616,7 @@ impl CefMenuModel {
//
pub fn insert_item_at(&self, index: libc::c_int, command_id: libc::c_int,
label: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -648,8 +635,7 @@ impl CefMenuModel {
//
pub fn insert_check_item_at(&self, index: libc::c_int,
command_id: libc::c_int, label: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -670,8 +656,7 @@ impl CefMenuModel {
pub fn insert_radio_item_at(&self, index: libc::c_int,
command_id: libc::c_int, label: &[u16],
group_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -691,8 +676,7 @@ impl CefMenuModel {
//
pub fn insert_sub_menu_at(&self, index: libc::c_int, command_id: libc::c_int,
label: &[u16]) -> interfaces::CefMenuModel {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -710,8 +694,7 @@ impl CefMenuModel {
// success.
//
pub fn remove(&self, command_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -726,8 +709,7 @@ impl CefMenuModel {
// Removes the item at the specified |index|. Returns true (1) on success.
//
pub fn remove_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -743,8 +725,7 @@ impl CefMenuModel {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -760,8 +741,7 @@ impl CefMenuModel {
// invalid range or the index being a separator.
//
pub fn get_command_id_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -777,8 +757,7 @@ impl CefMenuModel {
//
pub fn set_command_id_at(&self, index: libc::c_int,
command_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -795,8 +774,7 @@ impl CefMenuModel {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_label(&self, command_id: libc::c_int) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -813,8 +791,7 @@ impl CefMenuModel {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_label_at(&self, index: libc::c_int) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -830,8 +807,7 @@ impl CefMenuModel {
//
pub fn set_label(&self, command_id: libc::c_int,
label: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -847,8 +823,7 @@ impl CefMenuModel {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -865,8 +840,7 @@ impl CefMenuModel {
//
pub fn get_type(&self,
command_id: libc::c_int) -> types::cef_menu_item_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -881,8 +855,7 @@ impl CefMenuModel {
// Returns the item type at the specified |index|.
//
pub fn get_type_at(&self, index: libc::c_int) -> types::cef_menu_item_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -897,8 +870,7 @@ impl CefMenuModel {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -913,8 +885,7 @@ impl CefMenuModel {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -931,8 +902,7 @@ impl CefMenuModel {
//
pub fn set_group_id(&self, command_id: libc::c_int,
group_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -949,8 +919,7 @@ impl CefMenuModel {
//
pub fn set_group_id_at(&self, index: libc::c_int,
group_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -967,8 +936,7 @@ impl CefMenuModel {
//
pub fn get_sub_menu(&self,
command_id: libc::c_int) -> interfaces::CefMenuModel {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -984,8 +952,7 @@ impl CefMenuModel {
//
pub fn get_sub_menu_at(&self,
index: libc::c_int) -> interfaces::CefMenuModel {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1000,8 +967,7 @@ impl CefMenuModel {
// Returns true (1) if the specified |command_id| is visible.
//
pub fn is_visible(&self, command_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1016,8 +982,7 @@ impl CefMenuModel {
// Returns true (1) if the specified |index| is visible.
//
pub fn is_visible_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1034,8 +999,7 @@ impl CefMenuModel {
//
pub fn set_visible(&self, command_id: libc::c_int,
visible: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1053,8 +1017,7 @@ impl CefMenuModel {
//
pub fn set_visible_at(&self, index: libc::c_int,
visible: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1070,8 +1033,7 @@ impl CefMenuModel {
// Returns true (1) if the specified |command_id| is enabled.
//
pub fn is_enabled(&self, command_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1086,8 +1048,7 @@ impl CefMenuModel {
// Returns true (1) if the specified |index| is enabled.
//
pub fn is_enabled_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1104,8 +1065,7 @@ impl CefMenuModel {
//
pub fn set_enabled(&self, command_id: libc::c_int,
enabled: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1123,8 +1083,7 @@ impl CefMenuModel {
//
pub fn set_enabled_at(&self, index: libc::c_int,
enabled: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1141,8 +1100,7 @@ impl CefMenuModel {
// check and radio items.
//
pub fn is_checked(&self, command_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1158,8 +1116,7 @@ impl CefMenuModel {
// and radio items.
//
pub fn is_checked_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1176,8 +1133,7 @@ impl CefMenuModel {
//
pub fn set_checked(&self, command_id: libc::c_int,
checked: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1195,8 +1151,7 @@ impl CefMenuModel {
//
pub fn set_checked_at(&self, index: libc::c_int,
checked: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1213,8 +1168,7 @@ impl CefMenuModel {
// assigned.
//
pub fn has_accelerator(&self, command_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1230,8 +1184,7 @@ impl CefMenuModel {
// assigned.
//
pub fn has_accelerator_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1249,8 +1202,7 @@ impl CefMenuModel {
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,
alt_pressed: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1272,8 +1224,7 @@ impl CefMenuModel {
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,
alt_pressed: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1293,8 +1244,7 @@ impl CefMenuModel {
// true (1) on success.
//
pub fn remove_accelerator(&self, command_id: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1310,8 +1260,7 @@ impl CefMenuModel {
// on success.
//
pub fn remove_accelerator_at(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1330,8 +1279,7 @@ impl CefMenuModel {
key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int,
ctrl_pressed: &mut libc::c_int,
alt_pressed: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1354,8 +1302,7 @@ impl CefMenuModel {
key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int,
ctrl_pressed: &mut libc::c_int,
alt_pressed: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1387,8 +1334,7 @@ impl CefWrap<*mut cef_menu_model_t> for Option<CefMenuModel> {
}
}
unsafe fn to_rust(c_object: *mut cef_menu_model_t) -> Option<CefMenuModel> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefMenuModel::from_c_object_addref(c_object))

View File

@ -145,8 +145,7 @@ pub struct CefNavigationEntry {
impl Clone for CefNavigationEntry {
fn clone(&self) -> CefNavigationEntry{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefNavigationEntry {
@ -159,8 +158,7 @@ impl Clone for CefNavigationEntry {
impl Drop for CefNavigationEntry {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -175,8 +173,7 @@ impl CefNavigationEntry {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_t) -> CefNavigationEntry {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefNavigationEntry {
@ -190,8 +187,7 @@ impl CefNavigationEntry {
pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -199,10 +195,10 @@ impl CefNavigationEntry {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -210,8 +206,7 @@ impl CefNavigationEntry {
// if this function returns false (0).
//
pub fn is_valid(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -227,8 +222,7 @@ impl CefNavigationEntry {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -243,8 +237,7 @@ impl CefNavigationEntry {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_display_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -259,8 +252,7 @@ impl CefNavigationEntry {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_original_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -275,8 +267,7 @@ impl CefNavigationEntry {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_title(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -291,8 +282,7 @@ impl CefNavigationEntry {
// this page from the previous page.
//
pub fn get_transition_type(&self) -> types::cef_transition_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -306,8 +296,7 @@ impl CefNavigationEntry {
// Returns true (1) if this navigation includes post data.
//
pub fn has_post_data(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -323,8 +312,7 @@ impl CefNavigationEntry {
// 0 if the navigation has not yet completed.
//
pub fn get_completion_time(&self) -> types::cef_time_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -340,8 +328,7 @@ impl CefNavigationEntry {
// navigation has not yet completed.
//
pub fn get_http_status_code(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -368,8 +355,7 @@ impl CefWrap<*mut cef_navigation_entry_t> for Option<CefNavigationEntry> {
}
}
unsafe fn to_rust(c_object: *mut cef_navigation_entry_t) -> Option<CefNavigationEntry> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefNavigationEntry::from_c_object_addref(c_object))

View File

@ -92,8 +92,7 @@ pub struct CefPrintDialogCallback {
impl Clone for CefPrintDialogCallback {
fn clone(&self) -> CefPrintDialogCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefPrintDialogCallback {
@ -106,8 +105,7 @@ impl Clone for CefPrintDialogCallback {
impl Drop for CefPrintDialogCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -122,8 +120,7 @@ impl CefPrintDialogCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_dialog_callback_t) -> CefPrintDialogCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefPrintDialogCallback {
@ -137,8 +134,7 @@ impl CefPrintDialogCallback {
pub fn c_object_addrefed(&self) -> *mut cef_print_dialog_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -146,18 +142,17 @@ impl CefPrintDialogCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Continue printing with the specified |settings|.
//
pub fn cont(&self, settings: interfaces::CefPrintSettings) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -172,8 +167,7 @@ impl CefPrintDialogCallback {
// Cancel the printing.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -200,8 +194,7 @@ impl CefWrap<*mut cef_print_dialog_callback_t> for Option<CefPrintDialogCallback
}
}
unsafe fn to_rust(c_object: *mut cef_print_dialog_callback_t) -> Option<CefPrintDialogCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefPrintDialogCallback::from_c_object_addref(c_object))
@ -249,8 +242,7 @@ pub struct CefPrintJobCallback {
impl Clone for CefPrintJobCallback {
fn clone(&self) -> CefPrintJobCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefPrintJobCallback {
@ -263,8 +255,7 @@ impl Clone for CefPrintJobCallback {
impl Drop for CefPrintJobCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -279,8 +270,7 @@ impl CefPrintJobCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_job_callback_t) -> CefPrintJobCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefPrintJobCallback {
@ -294,8 +284,7 @@ impl CefPrintJobCallback {
pub fn c_object_addrefed(&self) -> *mut cef_print_job_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -303,18 +292,17 @@ impl CefPrintJobCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Indicate completion of the print job.
//
pub fn cont(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -341,8 +329,7 @@ impl CefWrap<*mut cef_print_job_callback_t> for Option<CefPrintJobCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_print_job_callback_t) -> Option<CefPrintJobCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefPrintJobCallback::from_c_object_addref(c_object))
@ -428,8 +415,7 @@ pub struct CefPrintHandler {
impl Clone for CefPrintHandler {
fn clone(&self) -> CefPrintHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefPrintHandler {
@ -442,8 +428,7 @@ impl Clone for CefPrintHandler {
impl Drop for CefPrintHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -458,8 +443,7 @@ impl CefPrintHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_handler_t) -> CefPrintHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefPrintHandler {
@ -473,8 +457,7 @@ impl CefPrintHandler {
pub fn c_object_addrefed(&self) -> *mut cef_print_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -482,10 +465,10 @@ impl CefPrintHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -495,8 +478,7 @@ impl CefPrintHandler {
//
pub fn on_print_settings(&self, settings: interfaces::CefPrintSettings,
get_defaults: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -515,8 +497,7 @@ impl CefPrintHandler {
//
pub fn on_print_dialog(&self, has_selection: libc::c_int,
callback: interfaces::CefPrintDialogCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -535,8 +516,7 @@ impl CefPrintHandler {
//
pub fn on_print_job(&self, document_name: &[u16], pdf_file_path: &[u16],
callback: interfaces::CefPrintJobCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -553,8 +533,7 @@ impl CefPrintHandler {
// Reset client state related to printing.
//
pub fn on_print_reset(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -570,8 +549,7 @@ impl CefPrintHandler {
//
pub fn get_pdf_paper_size(&self,
device_units_per_inch: libc::c_int) -> types::cef_size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -599,8 +577,7 @@ impl CefWrap<*mut cef_print_handler_t> for Option<CefPrintHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_print_handler_t) -> Option<CefPrintHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefPrintHandler::from_c_object_addref(c_object))

View File

@ -228,8 +228,7 @@ pub struct CefPrintSettings {
impl Clone for CefPrintSettings {
fn clone(&self) -> CefPrintSettings{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefPrintSettings {
@ -242,8 +241,7 @@ impl Clone for CefPrintSettings {
impl Drop for CefPrintSettings {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -258,8 +256,7 @@ impl CefPrintSettings {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_settings_t) -> CefPrintSettings {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefPrintSettings {
@ -273,8 +270,7 @@ impl CefPrintSettings {
pub fn c_object_addrefed(&self) -> *mut cef_print_settings_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -282,10 +278,10 @@ impl CefPrintSettings {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -293,8 +289,7 @@ impl CefPrintSettings {
// if this function returns false (0).
//
pub fn is_valid(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -309,8 +304,7 @@ impl CefPrintSettings {
// expose read-only objects.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -324,8 +318,7 @@ impl CefPrintSettings {
// Returns a writable copy of this object.
//
pub fn copy(&self) -> interfaces::CefPrintSettings {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -339,8 +332,7 @@ impl CefPrintSettings {
// Set the page orientation.
//
pub fn set_orientation(&self, landscape: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -355,8 +347,7 @@ impl CefPrintSettings {
// Returns true (1) if the orientation is landscape.
//
pub fn is_landscape(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -375,8 +366,7 @@ impl CefPrintSettings {
physical_size_device_units: &types::cef_size_t,
printable_area_device_units: &types::cef_rect_t,
landscape_needs_flip: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -393,8 +383,7 @@ impl CefPrintSettings {
// Set the device name.
//
pub fn set_device_name(&self, name: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -410,8 +399,7 @@ impl CefPrintSettings {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_device_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -425,8 +413,7 @@ impl CefPrintSettings {
// Set the DPI (dots per inch).
//
pub fn set_dpi(&self, dpi: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -441,8 +428,7 @@ impl CefPrintSettings {
// Get the DPI (dots per inch).
//
pub fn get_dpi(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -457,8 +443,7 @@ impl CefPrintSettings {
//
pub fn set_page_ranges(&self, ranges_count: libc::size_t,
ranges: *const types::cef_page_range_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -474,8 +459,7 @@ impl CefPrintSettings {
// Returns the number of page ranges that currently exist.
//
pub fn get_page_ranges_count(&self) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -490,8 +474,7 @@ impl CefPrintSettings {
//
pub fn get_page_ranges(&self, ranges_count: *mut libc::size_t,
ranges: *mut types::cef_page_range_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -507,8 +490,7 @@ impl CefPrintSettings {
// Set whether only the selection will be printed.
//
pub fn set_selection_only(&self, selection_only: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -523,8 +505,7 @@ impl CefPrintSettings {
// Returns true (1) if only the selection will be printed.
//
pub fn is_selection_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -538,8 +519,7 @@ impl CefPrintSettings {
// Set whether pages will be collated.
//
pub fn set_collate(&self, collate: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -554,8 +534,7 @@ impl CefPrintSettings {
// Returns true (1) if pages will be collated.
//
pub fn will_collate(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -569,8 +548,7 @@ impl CefPrintSettings {
// Set the color model.
//
pub fn set_color_model(&self, model: types::cef_color_model_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -585,8 +563,7 @@ impl CefPrintSettings {
// Get the color model.
//
pub fn get_color_model(&self) -> types::cef_color_model_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -600,8 +577,7 @@ impl CefPrintSettings {
// Set the number of copies.
//
pub fn set_copies(&self, copies: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -616,8 +592,7 @@ impl CefPrintSettings {
// Get the number of copies.
//
pub fn get_copies(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -631,8 +606,7 @@ impl CefPrintSettings {
// Set the duplex mode.
//
pub fn set_duplex_mode(&self, mode: types::cef_duplex_mode_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -647,8 +621,7 @@ impl CefPrintSettings {
// Get the duplex mode.
//
pub fn get_duplex_mode(&self) -> types::cef_duplex_mode_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -686,8 +659,7 @@ impl CefWrap<*mut cef_print_settings_t> for Option<CefPrintSettings> {
}
}
unsafe fn to_rust(c_object: *mut cef_print_settings_t) -> Option<CefPrintSettings> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefPrintSettings::from_c_object_addref(c_object))

View File

@ -113,8 +113,7 @@ pub struct CefProcessMessage {
impl Clone for CefProcessMessage {
fn clone(&self) -> CefProcessMessage{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefProcessMessage {
@ -127,8 +126,7 @@ impl Clone for CefProcessMessage {
impl Drop for CefProcessMessage {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -143,8 +141,7 @@ impl CefProcessMessage {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_process_message_t) -> CefProcessMessage {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefProcessMessage {
@ -158,8 +155,7 @@ impl CefProcessMessage {
pub fn c_object_addrefed(&self) -> *mut cef_process_message_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -167,10 +163,10 @@ impl CefProcessMessage {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -178,8 +174,7 @@ impl CefProcessMessage {
// if this function returns false (0).
//
pub fn is_valid(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -194,8 +189,7 @@ impl CefProcessMessage {
// expose read-only objects.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -209,8 +203,7 @@ impl CefProcessMessage {
// Returns a writable copy of this object.
//
pub fn copy(&self) -> interfaces::CefProcessMessage {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -225,8 +218,7 @@ impl CefProcessMessage {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -240,8 +232,7 @@ impl CefProcessMessage {
// Returns the list of arguments.
//
pub fn get_argument_list(&self) -> interfaces::CefListValue {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -279,8 +270,7 @@ impl CefWrap<*mut cef_process_message_t> for Option<CefProcessMessage> {
}
}
unsafe fn to_rust(c_object: *mut cef_process_message_t) -> Option<CefProcessMessage> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefProcessMessage::from_c_object_addref(c_object))

View File

@ -213,8 +213,7 @@ pub struct CefRenderHandler {
impl Clone for CefRenderHandler {
fn clone(&self) -> CefRenderHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRenderHandler {
@ -227,8 +226,7 @@ impl Clone for CefRenderHandler {
impl Drop for CefRenderHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -243,8 +241,7 @@ impl CefRenderHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_render_handler_t) -> CefRenderHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRenderHandler {
@ -258,8 +255,7 @@ impl CefRenderHandler {
pub fn c_object_addrefed(&self) -> *mut cef_render_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -267,10 +263,10 @@ impl CefRenderHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -279,8 +275,7 @@ impl CefRenderHandler {
//
pub fn get_root_screen_rect(&self, browser: interfaces::CefBrowser,
rect: &mut types::cef_rect_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -298,8 +293,7 @@ impl CefRenderHandler {
//
pub fn get_view_rect(&self, browser: interfaces::CefBrowser,
rect: &mut types::cef_rect_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -318,8 +312,7 @@ impl CefRenderHandler {
pub fn get_screen_point(&self, browser: interfaces::CefBrowser,
viewX: libc::c_int, viewY: libc::c_int, screenX: &mut libc::c_int,
screenY: &mut libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -345,8 +338,7 @@ impl CefRenderHandler {
//
pub fn get_screen_info(&self, browser: interfaces::CefBrowser,
screen_info: &mut interfaces::CefScreenInfo) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -364,8 +356,7 @@ impl CefRenderHandler {
//
pub fn on_popup_show(&self, browser: interfaces::CefBrowser,
show: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -383,8 +374,7 @@ impl CefRenderHandler {
//
pub fn on_popup_size(&self, browser: interfaces::CefBrowser,
rect: &types::cef_rect_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -410,8 +400,7 @@ impl CefRenderHandler {
ty: types::cef_paint_element_type_t, dirtyRects_count: libc::size_t,
dirtyRects: *const types::cef_rect_t, buffer: &(), width: libc::c_int,
height: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -435,8 +424,7 @@ impl CefRenderHandler {
pub fn on_cursor_change(&self, browser: interfaces::CefBrowser,
cursor: types::cef_cursor_handle_t, ty: types::cef_cursor_type_t,
custom_cursor_info: &interfaces::CefCursorInfo) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -468,8 +456,7 @@ impl CefRenderHandler {
drag_data: interfaces::CefDragData,
allowed_ops: types::cef_drag_operations_mask_t, x: libc::c_int,
y: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -491,8 +478,7 @@ impl CefRenderHandler {
//
pub fn update_drag_cursor(&self, browser: interfaces::CefBrowser,
operation: types::cef_drag_operations_mask_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -509,8 +495,7 @@ impl CefRenderHandler {
//
pub fn on_scroll_offset_changed(&self, browser: interfaces::CefBrowser,
x: libc::c_double, y: libc::c_double) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -531,8 +516,7 @@ impl CefRenderHandler {
//
pub fn get_backing_rect(&self, browser: interfaces::CefBrowser,
rect: &mut types::cef_rect_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -549,8 +533,7 @@ impl CefRenderHandler {
// flip). This is called only during accelerated compositing.
//
pub fn on_present(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -578,8 +561,7 @@ impl CefWrap<*mut cef_render_handler_t> for Option<CefRenderHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_render_handler_t) -> Option<CefRenderHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRenderHandler::from_c_object_addref(c_object))

View File

@ -197,8 +197,7 @@ pub struct CefRenderProcessHandler {
impl Clone for CefRenderProcessHandler {
fn clone(&self) -> CefRenderProcessHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRenderProcessHandler {
@ -211,8 +210,7 @@ impl Clone for CefRenderProcessHandler {
impl Drop for CefRenderProcessHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -227,8 +225,7 @@ impl CefRenderProcessHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_render_process_handler_t) -> CefRenderProcessHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRenderProcessHandler {
@ -242,8 +239,7 @@ impl CefRenderProcessHandler {
pub fn c_object_addrefed(&self) -> *mut cef_render_process_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -251,10 +247,10 @@ impl CefRenderProcessHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -265,8 +261,7 @@ impl CefRenderProcessHandler {
//
pub fn on_render_thread_created(&self,
extra_info: interfaces::CefListValue) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -281,8 +276,7 @@ impl CefRenderProcessHandler {
// Called after WebKit has been initialized.
//
pub fn on_web_kit_initialized(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -298,8 +292,7 @@ impl CefRenderProcessHandler {
// destroyed.
//
pub fn on_browser_created(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -314,8 +307,7 @@ impl CefRenderProcessHandler {
// Called before a browser is destroyed.
//
pub fn on_browser_destroyed(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -330,8 +322,7 @@ impl CefRenderProcessHandler {
// Return the handler for browser load status events.
//
pub fn get_load_handler(&self) -> interfaces::CefLoadHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -350,8 +341,7 @@ impl CefRenderProcessHandler {
frame: interfaces::CefFrame, request: interfaces::CefRequest,
navigation_type: types::cef_navigation_type_t,
is_redirect: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -376,8 +366,7 @@ impl CefRenderProcessHandler {
//
pub fn on_context_created(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -396,8 +385,7 @@ impl CefRenderProcessHandler {
//
pub fn on_context_released(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -419,8 +407,7 @@ impl CefRenderProcessHandler {
frame: interfaces::CefFrame, context: interfaces::CefV8Context,
exception: interfaces::CefV8Exception,
stackTrace: interfaces::CefV8StackTrace) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -445,8 +432,7 @@ impl CefRenderProcessHandler {
//
pub fn on_focused_node_changed(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, node: interfaces::CefDOMNode) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -467,8 +453,7 @@ impl CefRenderProcessHandler {
pub fn on_process_message_received(&self, browser: interfaces::CefBrowser,
source_process: interfaces::CefProcessId,
message: interfaces::CefProcessMessage) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -498,8 +483,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRenderProcessHandler::from_c_object_addref(c_object))

View File

@ -197,8 +197,7 @@ pub struct CefRequest {
impl Clone for CefRequest {
fn clone(&self) -> CefRequest{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRequest {
@ -211,8 +210,7 @@ impl Clone for CefRequest {
impl Drop for CefRequest {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -227,8 +225,7 @@ impl CefRequest {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_t) -> CefRequest {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRequest {
@ -242,8 +239,7 @@ impl CefRequest {
pub fn c_object_addrefed(&self) -> *mut cef_request_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -251,18 +247,17 @@ impl CefRequest {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns true (1) if this object is read-only.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -277,8 +272,7 @@ impl CefRequest {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_url(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -292,8 +286,7 @@ impl CefRequest {
// Set the fully qualified URL.
//
pub fn set_url(&self, url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -310,8 +303,7 @@ impl CefRequest {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_method(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -325,8 +317,7 @@ impl CefRequest {
// Set the request function type.
//
pub fn set_method(&self, method: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -341,8 +332,7 @@ impl CefRequest {
// Get the post data.
//
pub fn get_post_data(&self) -> interfaces::CefPostData {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -356,8 +346,7 @@ impl CefRequest {
// Set the post data.
//
pub fn set_post_data(&self, postData: interfaces::CefPostData) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -372,8 +361,7 @@ impl CefRequest {
// Get the header values.
//
pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -388,8 +376,7 @@ impl CefRequest {
// Set the header values.
//
pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -406,8 +393,7 @@ impl CefRequest {
pub fn set(&self, url: &[u16], method: &[u16],
postData: interfaces::CefPostData, headerMap: HashMap<String,
Vec<String>>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -426,8 +412,7 @@ impl CefRequest {
// cef_urlrequest_flags_t for supported values.
//
pub fn get_flags(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -442,8 +427,7 @@ impl CefRequest {
// cef_urlrequest_flags_t for supported values.
//
pub fn set_flags(&self, flags: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -460,8 +444,7 @@ impl CefRequest {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_first_party_for_cookies(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -476,8 +459,7 @@ impl CefRequest {
// cef_urlrequest_t.
//
pub fn set_first_party_for_cookies(&self, url: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -493,8 +475,7 @@ impl CefRequest {
// process.
//
pub fn get_resource_type(&self) -> types::cef_resource_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -510,8 +491,7 @@ impl CefRequest {
// frame navigation.
//
pub fn get_transition_type(&self) -> types::cef_transition_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -527,8 +507,7 @@ impl CefRequest {
// browser process to track a single request across multiple callbacks.
//
pub fn get_identifier(&self) -> u64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -566,8 +545,7 @@ impl CefWrap<*mut cef_request_t> for Option<CefRequest> {
}
}
unsafe fn to_rust(c_object: *mut cef_request_t) -> Option<CefRequest> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRequest::from_c_object_addref(c_object))
@ -649,8 +627,7 @@ pub struct CefPostData {
impl Clone for CefPostData {
fn clone(&self) -> CefPostData{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefPostData {
@ -663,8 +640,7 @@ impl Clone for CefPostData {
impl Drop for CefPostData {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -679,8 +655,7 @@ impl CefPostData {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_t) -> CefPostData {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefPostData {
@ -694,8 +669,7 @@ impl CefPostData {
pub fn c_object_addrefed(&self) -> *mut cef_post_data_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -703,18 +677,17 @@ impl CefPostData {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns true (1) if this object is read-only.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -728,8 +701,7 @@ impl CefPostData {
// Returns the number of existing post data elements.
//
pub fn get_element_count(&self) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -744,8 +716,7 @@ impl CefPostData {
//
pub fn get_elements(&self, elements_count: *mut libc::size_t,
elements: *mut interfaces::CefPostDataElement) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -763,8 +734,7 @@ impl CefPostData {
//
pub fn remove_element(&self,
element: interfaces::CefPostDataElement) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -780,8 +750,7 @@ impl CefPostData {
//
pub fn add_element(&self,
element: interfaces::CefPostDataElement) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -796,8 +765,7 @@ impl CefPostData {
// Remove all existing post data elements.
//
pub fn remove_elements(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -835,8 +803,7 @@ impl CefWrap<*mut cef_post_data_t> for Option<CefPostData> {
}
}
unsafe fn to_rust(c_object: *mut cef_post_data_t) -> Option<CefPostData> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefPostData::from_c_object_addref(c_object))
@ -932,8 +899,7 @@ pub struct CefPostDataElement {
impl Clone for CefPostDataElement {
fn clone(&self) -> CefPostDataElement{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefPostDataElement {
@ -946,8 +912,7 @@ impl Clone for CefPostDataElement {
impl Drop for CefPostDataElement {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -962,8 +927,7 @@ impl CefPostDataElement {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_element_t) -> CefPostDataElement {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefPostDataElement {
@ -977,8 +941,7 @@ impl CefPostDataElement {
pub fn c_object_addrefed(&self) -> *mut cef_post_data_element_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -986,18 +949,17 @@ impl CefPostDataElement {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns true (1) if this object is read-only.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1011,8 +973,7 @@ impl CefPostDataElement {
// Remove all contents from the post data element.
//
pub fn set_to_empty(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1026,8 +987,7 @@ impl CefPostDataElement {
// The post data element will represent a file.
//
pub fn set_to_file(&self, fileName: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1043,8 +1003,7 @@ impl CefPostDataElement {
// copied.
//
pub fn set_to_bytes(&self, size: libc::size_t, bytes: &()) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1060,8 +1019,7 @@ impl CefPostDataElement {
// Return the type of this post data element.
//
pub fn get_type(&self) -> types::cef_postdataelement_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1076,8 +1034,7 @@ impl CefPostDataElement {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_file(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1091,8 +1048,7 @@ impl CefPostDataElement {
// Return the number of bytes.
//
pub fn get_bytes_count(&self) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1107,8 +1063,7 @@ impl CefPostDataElement {
// actually read.
//
pub fn get_bytes(&self, size: libc::size_t, bytes: &mut ()) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1148,8 +1103,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefPostDataElement::from_c_object_addref(c_object))

View File

@ -179,8 +179,7 @@ pub struct CefRequestContext {
impl Clone for CefRequestContext {
fn clone(&self) -> CefRequestContext{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRequestContext {
@ -193,8 +192,7 @@ impl Clone for CefRequestContext {
impl Drop for CefRequestContext {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -209,8 +207,7 @@ impl CefRequestContext {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_t) -> CefRequestContext {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRequestContext {
@ -224,8 +221,7 @@ impl CefRequestContext {
pub fn c_object_addrefed(&self) -> *mut cef_request_context_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -233,10 +229,10 @@ impl CefRequestContext {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -244,8 +240,7 @@ impl CefRequestContext {
// object.
//
pub fn is_same(&self, other: interfaces::CefRequestContext) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -262,8 +257,7 @@ impl CefRequestContext {
//
pub fn is_sharing_with(&self,
other: interfaces::CefRequestContext) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -280,8 +274,7 @@ impl CefRequestContext {
// context argument.
//
pub fn is_global(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -295,8 +288,7 @@ impl CefRequestContext {
// Returns the handler for this context if any.
//
pub fn get_handler(&self) -> interfaces::CefRequestContextHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -312,8 +304,7 @@ impl CefRequestContext {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_cache_path(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -333,8 +324,7 @@ impl CefRequestContext {
//
pub fn get_default_cookie_manager(&self,
callback: interfaces::CefCompletionCallback) -> interfaces::CefCookieManager {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -361,8 +351,7 @@ impl CefRequestContext {
pub fn register_scheme_handler_factory(&self, scheme_name: &[u16],
domain_name: &[u16],
factory: interfaces::CefSchemeHandlerFactory) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -380,8 +369,7 @@ impl CefRequestContext {
// This function may be called on any thread in the browser process.
//
pub fn clear_scheme_handler_factories(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -447,8 +435,7 @@ impl CefWrap<*mut cef_request_context_t> for Option<CefRequestContext> {
}
}
unsafe fn to_rust(c_object: *mut cef_request_context_t) -> Option<CefRequestContext> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRequestContext::from_c_object_addref(c_object))

View File

@ -92,8 +92,7 @@ pub struct CefRequestContextHandler {
impl Clone for CefRequestContextHandler {
fn clone(&self) -> CefRequestContextHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRequestContextHandler {
@ -106,8 +105,7 @@ impl Clone for CefRequestContextHandler {
impl Drop for CefRequestContextHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -122,8 +120,7 @@ impl CefRequestContextHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_handler_t) -> CefRequestContextHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRequestContextHandler {
@ -137,8 +134,7 @@ impl CefRequestContextHandler {
pub fn c_object_addrefed(&self) -> *mut cef_request_context_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -146,10 +142,10 @@ impl CefRequestContextHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -158,8 +154,7 @@ impl CefRequestContextHandler {
// cef_request_tContext::get_default_cookie_manager() will be used.
//
pub fn get_cookie_manager(&self) -> interfaces::CefCookieManager {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -186,8 +181,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRequestContextHandler::from_c_object_addref(c_object))

View File

@ -92,8 +92,7 @@ pub struct CefRequestCallback {
impl Clone for CefRequestCallback {
fn clone(&self) -> CefRequestCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRequestCallback {
@ -106,8 +105,7 @@ impl Clone for CefRequestCallback {
impl Drop for CefRequestCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -122,8 +120,7 @@ impl CefRequestCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_callback_t) -> CefRequestCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRequestCallback {
@ -137,8 +134,7 @@ impl CefRequestCallback {
pub fn c_object_addrefed(&self) -> *mut cef_request_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -146,10 +142,10 @@ impl CefRequestCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -157,8 +153,7 @@ impl CefRequestCallback {
// continued. Otherwise, the request will be canceled.
//
pub fn cont(&self, allow: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -173,8 +168,7 @@ impl CefRequestCallback {
// Cancel the url request.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -201,8 +195,7 @@ impl CefWrap<*mut cef_request_callback_t> for Option<CefRequestCallback> {
}
}
unsafe fn to_rust(c_object: *mut cef_request_callback_t) -> Option<CefRequestCallback> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRequestCallback::from_c_object_addref(c_object))
@ -426,8 +419,7 @@ pub struct CefRequestHandler {
impl Clone for CefRequestHandler {
fn clone(&self) -> CefRequestHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefRequestHandler {
@ -440,8 +432,7 @@ impl Clone for CefRequestHandler {
impl Drop for CefRequestHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -456,8 +447,7 @@ impl CefRequestHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_handler_t) -> CefRequestHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRequestHandler {
@ -471,8 +461,7 @@ impl CefRequestHandler {
pub fn c_object_addrefed(&self) -> *mut cef_request_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -480,10 +469,10 @@ impl CefRequestHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -499,8 +488,7 @@ impl CefRequestHandler {
pub fn on_before_browse(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest,
is_redirect: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -534,8 +522,7 @@ impl CefRequestHandler {
frame: interfaces::CefFrame, target_url: &[u16],
target_disposition: types::cef_window_open_disposition_t,
user_gesture: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -561,8 +548,7 @@ impl CefRequestHandler {
pub fn on_before_resource_load(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest,
callback: interfaces::CefRequestCallback) -> types::cef_return_value_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -585,8 +571,7 @@ impl CefRequestHandler {
pub fn get_resource_handler(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame,
request: interfaces::CefRequest) -> interfaces::CefResourceHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -608,8 +593,7 @@ impl CefRequestHandler {
pub fn on_resource_redirect(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest,
new_url: *mut types::cef_string_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -632,8 +616,7 @@ impl CefRequestHandler {
pub fn on_resource_response(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, request: interfaces::CefRequest,
response: interfaces::CefResponse) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -659,8 +642,7 @@ impl CefRequestHandler {
frame: interfaces::CefFrame, isProxy: libc::c_int, host: &[u16],
port: libc::c_int, realm: &[u16], scheme: &[u16],
callback: interfaces::CefAuthCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -690,8 +672,7 @@ impl CefRequestHandler {
pub fn on_quota_request(&self, browser: interfaces::CefBrowser,
origin_url: &[u16], new_size: i64,
callback: interfaces::CefRequestCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -714,8 +695,7 @@ impl CefRequestHandler {
//
pub fn on_protocol_execution(&self, browser: interfaces::CefBrowser,
url: &[u16], allow_os_execution: &mut libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -741,8 +721,7 @@ impl CefRequestHandler {
cert_error: types::cef_errorcode_t, request_url: &[u16],
ssl_info: interfaces::CefSSLInfo,
callback: interfaces::CefRequestCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -764,8 +743,7 @@ impl CefRequestHandler {
pub fn on_before_plugin_load(&self, browser: interfaces::CefBrowser,
url: &[u16], policy_url: &[u16],
info: interfaces::CefWebPluginInfo) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -785,8 +763,7 @@ impl CefRequestHandler {
//
pub fn on_plugin_crashed(&self, browser: interfaces::CefBrowser,
plugin_path: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -804,8 +781,7 @@ impl CefRequestHandler {
// process.
//
pub fn on_render_view_ready(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -822,8 +798,7 @@ impl CefRequestHandler {
//
pub fn on_render_process_terminated(&self, browser: interfaces::CefBrowser,
status: types::cef_termination_status_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -852,8 +827,7 @@ impl CefWrap<*mut cef_request_handler_t> for Option<CefRequestHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_request_handler_t) -> Option<CefRequestHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefRequestHandler::from_c_object_addref(c_object))

View File

@ -105,8 +105,7 @@ pub struct CefResourceBundleHandler {
impl Clone for CefResourceBundleHandler {
fn clone(&self) -> CefResourceBundleHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefResourceBundleHandler {
@ -119,8 +118,7 @@ impl Clone for CefResourceBundleHandler {
impl Drop for CefResourceBundleHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -135,8 +133,7 @@ impl CefResourceBundleHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_bundle_handler_t) -> CefResourceBundleHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefResourceBundleHandler {
@ -150,8 +147,7 @@ impl CefResourceBundleHandler {
pub fn c_object_addrefed(&self) -> *mut cef_resource_bundle_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -159,10 +155,10 @@ impl CefResourceBundleHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -173,8 +169,7 @@ impl CefResourceBundleHandler {
//
pub fn get_localized_string(&self, message_id: libc::c_int,
string: *mut types::cef_string_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -197,8 +192,7 @@ impl CefResourceBundleHandler {
pub fn get_data_resource(&self, resource_id: libc::c_int,
data: &mut *mut libc::c_void,
data_size: &mut libc::size_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -228,8 +222,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefResourceBundleHandler::from_c_object_addref(c_object))

View File

@ -140,8 +140,7 @@ pub struct CefResourceHandler {
impl Clone for CefResourceHandler {
fn clone(&self) -> CefResourceHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefResourceHandler {
@ -154,8 +153,7 @@ impl Clone for CefResourceHandler {
impl Drop for CefResourceHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -170,8 +168,7 @@ impl CefResourceHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_handler_t) -> CefResourceHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefResourceHandler {
@ -185,8 +182,7 @@ impl CefResourceHandler {
pub fn c_object_addrefed(&self) -> *mut cef_resource_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -194,10 +190,10 @@ impl CefResourceHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -209,8 +205,7 @@ impl CefResourceHandler {
//
pub fn process_request(&self, request: interfaces::CefRequest,
callback: interfaces::CefCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -235,8 +230,7 @@ impl CefResourceHandler {
pub fn get_response_headers(&self, response: interfaces::CefResponse,
response_length: &mut i64, redirectUrl: *mut types::cef_string_t) -> (
) {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -259,8 +253,7 @@ impl CefResourceHandler {
pub fn read_response(&self, data_out: &mut (), bytes_to_read: libc::c_int,
bytes_read: &mut libc::c_int,
callback: interfaces::CefCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -280,8 +273,7 @@ impl CefResourceHandler {
// cookies will be sent with the request.
//
pub fn can_get_cookie(&self, cookie: &interfaces::CefCookie) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -297,8 +289,7 @@ impl CefResourceHandler {
// set or false (0) otherwise.
//
pub fn can_set_cookie(&self, cookie: &interfaces::CefCookie) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -313,8 +304,7 @@ impl CefResourceHandler {
// Request processing has been canceled.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -341,8 +331,7 @@ impl CefWrap<*mut cef_resource_handler_t> for Option<CefResourceHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_resource_handler_t) -> Option<CefResourceHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefResourceHandler::from_c_object_addref(c_object))

View File

@ -145,8 +145,7 @@ pub struct CefResponse {
impl Clone for CefResponse {
fn clone(&self) -> CefResponse{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefResponse {
@ -159,8 +158,7 @@ impl Clone for CefResponse {
impl Drop for CefResponse {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -175,8 +173,7 @@ impl CefResponse {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_response_t) -> CefResponse {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefResponse {
@ -190,8 +187,7 @@ impl CefResponse {
pub fn c_object_addrefed(&self) -> *mut cef_response_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -199,18 +195,17 @@ impl CefResponse {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Returns true (1) if this object is read-only.
//
pub fn is_read_only(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -224,8 +219,7 @@ impl CefResponse {
// Get the response status code.
//
pub fn get_status(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -239,8 +233,7 @@ impl CefResponse {
// Set the response status code.
//
pub fn set_status(&self, status: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -256,8 +249,7 @@ impl CefResponse {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_status_text(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -271,8 +263,7 @@ impl CefResponse {
// Set the response status text.
//
pub fn set_status_text(&self, statusText: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -288,8 +279,7 @@ impl CefResponse {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_mime_type(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -303,8 +293,7 @@ impl CefResponse {
// Set the response mime type.
//
pub fn set_mime_type(&self, mimeType: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -320,8 +309,7 @@ impl CefResponse {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_header(&self, name: &[u16]) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -336,8 +324,7 @@ impl CefResponse {
// Get all response header fields.
//
pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -352,8 +339,7 @@ impl CefResponse {
// Set all response header fields.
//
pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -392,8 +378,7 @@ impl CefWrap<*mut cef_response_t> for Option<CefResponse> {
}
}
unsafe fn to_rust(c_object: *mut cef_response_t) -> Option<CefResponse> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefResponse::from_c_object_addref(c_object))

View File

@ -130,8 +130,7 @@ pub struct CefSchemeRegistrar {
impl Clone for CefSchemeRegistrar {
fn clone(&self) -> CefSchemeRegistrar{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefSchemeRegistrar {
@ -144,8 +143,7 @@ impl Clone for CefSchemeRegistrar {
impl Drop for CefSchemeRegistrar {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -160,8 +158,7 @@ impl CefSchemeRegistrar {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_scheme_registrar_t) -> CefSchemeRegistrar {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefSchemeRegistrar {
@ -175,8 +172,7 @@ impl CefSchemeRegistrar {
pub fn c_object_addrefed(&self) -> *mut cef_scheme_registrar_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -184,10 +180,10 @@ impl CefSchemeRegistrar {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -239,8 +235,7 @@ impl CefSchemeRegistrar {
pub fn add_custom_scheme(&self, scheme_name: &[u16], is_standard: libc::c_int,
is_local: libc::c_int,
is_display_isolated: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -271,8 +266,7 @@ impl CefWrap<*mut cef_scheme_registrar_t> for Option<CefSchemeRegistrar> {
}
}
unsafe fn to_rust(c_object: *mut cef_scheme_registrar_t) -> Option<CefSchemeRegistrar> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefSchemeRegistrar::from_c_object_addref(c_object))
@ -333,8 +327,7 @@ pub struct CefSchemeHandlerFactory {
impl Clone for CefSchemeHandlerFactory {
fn clone(&self) -> CefSchemeHandlerFactory{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefSchemeHandlerFactory {
@ -347,8 +340,7 @@ impl Clone for CefSchemeHandlerFactory {
impl Drop for CefSchemeHandlerFactory {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -363,8 +355,7 @@ impl CefSchemeHandlerFactory {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_scheme_handler_factory_t) -> CefSchemeHandlerFactory {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefSchemeHandlerFactory {
@ -378,8 +369,7 @@ impl CefSchemeHandlerFactory {
pub fn c_object_addrefed(&self) -> *mut cef_scheme_handler_factory_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -387,10 +377,10 @@ impl CefSchemeHandlerFactory {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -404,8 +394,7 @@ impl CefSchemeHandlerFactory {
pub fn create(&self, browser: interfaces::CefBrowser,
frame: interfaces::CefFrame, scheme_name: &[u16],
request: interfaces::CefRequest) -> interfaces::CefResourceHandler {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -436,8 +425,7 @@ impl CefWrap<*mut cef_scheme_handler_factory_t> for Option<CefSchemeHandlerFacto
}
}
unsafe fn to_rust(c_object: *mut cef_scheme_handler_factory_t) -> Option<CefSchemeHandlerFactory> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefSchemeHandlerFactory::from_c_object_addref(c_object))

View File

@ -144,8 +144,7 @@ pub struct CefSSLCertPrincipal {
impl Clone for CefSSLCertPrincipal {
fn clone(&self) -> CefSSLCertPrincipal{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefSSLCertPrincipal {
@ -158,8 +157,7 @@ impl Clone for CefSSLCertPrincipal {
impl Drop for CefSSLCertPrincipal {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -174,8 +172,7 @@ impl CefSSLCertPrincipal {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_sslcert_principal_t) -> CefSSLCertPrincipal {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefSSLCertPrincipal {
@ -189,8 +186,7 @@ impl CefSSLCertPrincipal {
pub fn c_object_addrefed(&self) -> *mut cef_sslcert_principal_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -198,10 +194,10 @@ impl CefSSLCertPrincipal {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -210,8 +206,7 @@ impl CefSSLCertPrincipal {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_display_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -226,8 +221,7 @@ impl CefSSLCertPrincipal {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_common_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -242,8 +236,7 @@ impl CefSSLCertPrincipal {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_locality_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -258,8 +251,7 @@ impl CefSSLCertPrincipal {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_state_or_province_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -274,8 +266,7 @@ impl CefSSLCertPrincipal {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_country_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -289,8 +280,7 @@ impl CefSSLCertPrincipal {
// Retrieve the list of street addresses.
//
pub fn get_street_addresses(&self, addresses: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -305,8 +295,7 @@ impl CefSSLCertPrincipal {
// Retrieve the list of organization names.
//
pub fn get_organization_names(&self, names: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -321,8 +310,7 @@ impl CefSSLCertPrincipal {
// Retrieve the list of organization unit names.
//
pub fn get_organization_unit_names(&self, names: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -337,8 +325,7 @@ impl CefSSLCertPrincipal {
// Retrieve the list of domain components.
//
pub fn get_domain_components(&self, components: &Vec<String>) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -366,8 +353,7 @@ impl CefWrap<*mut cef_sslcert_principal_t> for Option<CefSSLCertPrincipal> {
}
}
unsafe fn to_rust(c_object: *mut cef_sslcert_principal_t) -> Option<CefSSLCertPrincipal> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefSSLCertPrincipal::from_c_object_addref(c_object))
@ -457,8 +443,7 @@ pub struct CefSSLInfo {
impl Clone for CefSSLInfo {
fn clone(&self) -> CefSSLInfo{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefSSLInfo {
@ -471,8 +456,7 @@ impl Clone for CefSSLInfo {
impl Drop for CefSSLInfo {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -487,8 +471,7 @@ impl CefSSLInfo {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_sslinfo_t) -> CefSSLInfo {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefSSLInfo {
@ -502,8 +485,7 @@ impl CefSSLInfo {
pub fn c_object_addrefed(&self) -> *mut cef_sslinfo_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -511,10 +493,10 @@ impl CefSSLInfo {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -523,8 +505,7 @@ impl CefSSLInfo {
// match the host name of the web server.
//
pub fn get_subject(&self) -> interfaces::CefSSLCertPrincipal {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -538,8 +519,7 @@ impl CefSSLInfo {
// Returns the issuer of the X.509 certificate.
//
pub fn get_issuer(&self) -> interfaces::CefSSLCertPrincipal {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -554,8 +534,7 @@ impl CefSSLInfo {
// possibly includes a leading 00 byte.
//
pub fn get_serial_number(&self) -> interfaces::CefBinaryValue {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -570,8 +549,7 @@ impl CefSSLInfo {
// CefTime.GetTimeT() will return 0 if no date was specified.
//
pub fn get_valid_start(&self) -> types::cef_time_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -586,8 +564,7 @@ impl CefSSLInfo {
// CefTime.GetTimeT() will return 0 if no date was specified.
//
pub fn get_valid_expiry(&self) -> types::cef_time_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -601,8 +578,7 @@ impl CefSSLInfo {
// Returns the DER encoded data for the X.509 certificate.
//
pub fn get_derencoded(&self) -> interfaces::CefBinaryValue {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -616,8 +592,7 @@ impl CefSSLInfo {
// Returns the PEM encoded data for the X.509 certificate.
//
pub fn get_pemencoded(&self) -> interfaces::CefBinaryValue {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -644,8 +619,7 @@ impl CefWrap<*mut cef_sslinfo_t> for Option<CefSSLInfo> {
}
}
unsafe fn to_rust(c_object: *mut cef_sslinfo_t) -> Option<CefSSLInfo> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefSSLInfo::from_c_object_addref(c_object))

View File

@ -113,8 +113,7 @@ pub struct CefReadHandler {
impl Clone for CefReadHandler {
fn clone(&self) -> CefReadHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefReadHandler {
@ -127,8 +126,7 @@ impl Clone for CefReadHandler {
impl Drop for CefReadHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -143,8 +141,7 @@ impl CefReadHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_read_handler_t) -> CefReadHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefReadHandler {
@ -158,8 +155,7 @@ impl CefReadHandler {
pub fn c_object_addrefed(&self) -> *mut cef_read_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -167,10 +163,10 @@ impl CefReadHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -178,8 +174,7 @@ impl CefReadHandler {
//
pub fn read(&self, ptr: &mut (), size: libc::size_t,
n: libc::size_t) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -197,8 +192,7 @@ impl CefReadHandler {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -214,8 +208,7 @@ impl CefReadHandler {
// Return the current offset position.
//
pub fn tell(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -229,8 +222,7 @@ impl CefReadHandler {
// Return non-zero if at end of file.
//
pub fn eof(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -246,8 +238,7 @@ impl CefReadHandler {
// the handler from.
//
pub fn may_block(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -274,8 +265,7 @@ impl CefWrap<*mut cef_read_handler_t> for Option<CefReadHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_read_handler_t) -> Option<CefReadHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefReadHandler::from_c_object_addref(c_object))
@ -351,8 +341,7 @@ pub struct CefStreamReader {
impl Clone for CefStreamReader {
fn clone(&self) -> CefStreamReader{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefStreamReader {
@ -365,8 +354,7 @@ impl Clone for CefStreamReader {
impl Drop for CefStreamReader {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -381,8 +369,7 @@ impl CefStreamReader {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_reader_t) -> CefStreamReader {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefStreamReader {
@ -396,8 +383,7 @@ impl CefStreamReader {
pub fn c_object_addrefed(&self) -> *mut cef_stream_reader_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -405,10 +391,10 @@ impl CefStreamReader {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -416,8 +402,7 @@ impl CefStreamReader {
//
pub fn read(&self, ptr: &mut (), size: libc::size_t,
n: libc::size_t) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -435,8 +420,7 @@ impl CefStreamReader {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -452,8 +436,7 @@ impl CefStreamReader {
// Return the current offset position.
//
pub fn tell(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -467,8 +450,7 @@ impl CefStreamReader {
// Return non-zero if at end of file.
//
pub fn eof(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -484,8 +466,7 @@ impl CefStreamReader {
// the reader from.
//
pub fn may_block(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -548,8 +529,7 @@ impl CefWrap<*mut cef_stream_reader_t> for Option<CefStreamReader> {
}
}
unsafe fn to_rust(c_object: *mut cef_stream_reader_t) -> Option<CefStreamReader> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefStreamReader::from_c_object_addref(c_object))
@ -626,8 +606,7 @@ pub struct CefWriteHandler {
impl Clone for CefWriteHandler {
fn clone(&self) -> CefWriteHandler{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefWriteHandler {
@ -640,8 +619,7 @@ impl Clone for CefWriteHandler {
impl Drop for CefWriteHandler {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -656,8 +634,7 @@ impl CefWriteHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_write_handler_t) -> CefWriteHandler {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefWriteHandler {
@ -671,8 +648,7 @@ impl CefWriteHandler {
pub fn c_object_addrefed(&self) -> *mut cef_write_handler_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -680,10 +656,10 @@ impl CefWriteHandler {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -691,8 +667,7 @@ impl CefWriteHandler {
//
pub fn write(&self, ptr: &(), size: libc::size_t,
n: libc::size_t) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -710,8 +685,7 @@ impl CefWriteHandler {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -727,8 +701,7 @@ impl CefWriteHandler {
// Return the current offset position.
//
pub fn tell(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -742,8 +715,7 @@ impl CefWriteHandler {
// Flush the stream.
//
pub fn flush(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -759,8 +731,7 @@ impl CefWriteHandler {
// the handler from.
//
pub fn may_block(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -787,8 +758,7 @@ impl CefWrap<*mut cef_write_handler_t> for Option<CefWriteHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_write_handler_t) -> Option<CefWriteHandler> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefWriteHandler::from_c_object_addref(c_object))
@ -865,8 +835,7 @@ pub struct CefStreamWriter {
impl Clone for CefStreamWriter {
fn clone(&self) -> CefStreamWriter{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefStreamWriter {
@ -879,8 +848,7 @@ impl Clone for CefStreamWriter {
impl Drop for CefStreamWriter {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -895,8 +863,7 @@ impl CefStreamWriter {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_writer_t) -> CefStreamWriter {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefStreamWriter {
@ -910,8 +877,7 @@ impl CefStreamWriter {
pub fn c_object_addrefed(&self) -> *mut cef_stream_writer_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -919,10 +885,10 @@ impl CefStreamWriter {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -930,8 +896,7 @@ impl CefStreamWriter {
//
pub fn write(&self, ptr: &(), size: libc::size_t,
n: libc::size_t) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -949,8 +914,7 @@ impl CefStreamWriter {
// 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 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -966,8 +930,7 @@ impl CefStreamWriter {
// Return the current offset position.
//
pub fn tell(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -981,8 +944,7 @@ impl CefStreamWriter {
// Flush the stream.
//
pub fn flush(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -998,8 +960,7 @@ impl CefStreamWriter {
// the writer from.
//
pub fn may_block(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -1049,8 +1010,7 @@ impl CefWrap<*mut cef_stream_writer_t> for Option<CefStreamWriter> {
}
}
unsafe fn to_rust(c_object: *mut cef_stream_writer_t) -> Option<CefStreamWriter> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefStreamWriter::from_c_object_addref(c_object))

View File

@ -86,8 +86,7 @@ pub struct CefStringVisitor {
impl Clone for CefStringVisitor {
fn clone(&self) -> CefStringVisitor{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefStringVisitor {
@ -100,8 +99,7 @@ impl Clone for CefStringVisitor {
impl Drop for CefStringVisitor {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -116,8 +114,7 @@ impl CefStringVisitor {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_string_visitor_t) -> CefStringVisitor {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefStringVisitor {
@ -131,8 +128,7 @@ impl CefStringVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_string_visitor_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -140,18 +136,17 @@ impl CefStringVisitor {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Method that will be executed.
//
pub fn visit(&self, string: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -179,8 +174,7 @@ impl CefWrap<*mut cef_string_visitor_t> for Option<CefStringVisitor> {
}
}
unsafe fn to_rust(c_object: *mut cef_string_visitor_t) -> Option<CefStringVisitor> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefStringVisitor::from_c_object_addref(c_object))

View File

@ -95,8 +95,7 @@ pub struct CefTask {
impl Clone for CefTask {
fn clone(&self) -> CefTask{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefTask {
@ -109,8 +108,7 @@ impl Clone for CefTask {
impl Drop for CefTask {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -125,8 +123,7 @@ impl CefTask {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_task_t) -> CefTask {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefTask {
@ -140,8 +137,7 @@ impl CefTask {
pub fn c_object_addrefed(&self) -> *mut cef_task_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -149,18 +145,17 @@ impl CefTask {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
// Method that will be executed on the target thread.
//
pub fn execute(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -187,8 +182,7 @@ impl CefWrap<*mut cef_task_t> for Option<CefTask> {
}
}
unsafe fn to_rust(c_object: *mut cef_task_t) -> Option<CefTask> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefTask::from_c_object_addref(c_object))
@ -278,8 +272,7 @@ pub struct CefTaskRunner {
impl Clone for CefTaskRunner {
fn clone(&self) -> CefTaskRunner{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefTaskRunner {
@ -292,8 +285,7 @@ impl Clone for CefTaskRunner {
impl Drop for CefTaskRunner {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -308,8 +300,7 @@ impl CefTaskRunner {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_task_runner_t) -> CefTaskRunner {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefTaskRunner {
@ -323,8 +314,7 @@ impl CefTaskRunner {
pub fn c_object_addrefed(&self) -> *mut cef_task_runner_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -332,10 +322,10 @@ impl CefTaskRunner {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -343,8 +333,7 @@ impl CefTaskRunner {
// |that| object.
//
pub fn is_same(&self, that: interfaces::CefTaskRunner) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -359,8 +348,7 @@ impl CefTaskRunner {
// Returns true (1) if this task runner belongs to the current thread.
//
pub fn belongs_to_current_thread(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -375,8 +363,7 @@ impl CefTaskRunner {
//
pub fn belongs_to_thread(&self,
threadId: types::cef_thread_id_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -392,8 +379,7 @@ impl CefTaskRunner {
// Execution will occur asynchronously.
//
pub fn post_task(&self, task: interfaces::CefTask) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -412,8 +398,7 @@ impl CefTaskRunner {
//
pub fn post_delayed_task(&self, task: interfaces::CefTask,
delay_ms: i64) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -467,8 +452,7 @@ impl CefWrap<*mut cef_task_runner_t> for Option<CefTaskRunner> {
}
}
unsafe fn to_rust(c_object: *mut cef_task_runner_t) -> Option<CefTaskRunner> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefTaskRunner::from_c_object_addref(c_object))

View File

@ -93,8 +93,7 @@ pub struct CefEndTracingCallback {
impl Clone for CefEndTracingCallback {
fn clone(&self) -> CefEndTracingCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefEndTracingCallback {
@ -107,8 +106,7 @@ impl Clone for CefEndTracingCallback {
impl Drop for CefEndTracingCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -123,8 +121,7 @@ impl CefEndTracingCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_end_tracing_callback_t) -> CefEndTracingCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefEndTracingCallback {
@ -138,8 +135,7 @@ impl CefEndTracingCallback {
pub fn c_object_addrefed(&self) -> *mut cef_end_tracing_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -147,10 +143,10 @@ impl CefEndTracingCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -159,8 +155,7 @@ impl CefEndTracingCallback {
// deleting |tracing_file|.
//
pub fn on_end_tracing_complete(&self, tracing_file: &[u16]) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -188,8 +183,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefEndTracingCallback::from_c_object_addref(c_object))

View File

@ -127,8 +127,7 @@ pub struct CefURLRequest {
impl Clone for CefURLRequest {
fn clone(&self) -> CefURLRequest{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefURLRequest {
@ -141,8 +140,7 @@ impl Clone for CefURLRequest {
impl Drop for CefURLRequest {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -157,8 +155,7 @@ impl CefURLRequest {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_t) -> CefURLRequest {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefURLRequest {
@ -172,8 +169,7 @@ impl CefURLRequest {
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -181,10 +177,10 @@ impl CefURLRequest {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -192,8 +188,7 @@ impl CefURLRequest {
// object is read-only and should not be modified.
//
pub fn get_request(&self) -> interfaces::CefRequest {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -207,8 +202,7 @@ impl CefURLRequest {
// Returns the client.
//
pub fn get_client(&self) -> interfaces::CefURLRequestClient {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -222,8 +216,7 @@ impl CefURLRequest {
// Returns the request status.
//
pub fn get_request_status(&self) -> types::cef_urlrequest_status_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -238,8 +231,7 @@ impl CefURLRequest {
// otherwise.
//
pub fn get_request_error(&self) -> types::cef_errorcode_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -255,8 +247,7 @@ impl CefURLRequest {
// The returned object is read-only and should not be modified.
//
pub fn get_response(&self) -> interfaces::CefResponse {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -270,8 +261,7 @@ impl CefURLRequest {
// Cancel the request.
//
pub fn cancel(&self) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -325,8 +315,7 @@ impl CefWrap<*mut cef_urlrequest_t> for Option<CefURLRequest> {
}
}
unsafe fn to_rust(c_object: *mut cef_urlrequest_t) -> Option<CefURLRequest> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefURLRequest::from_c_object_addref(c_object))
@ -427,8 +416,7 @@ pub struct CefURLRequestClient {
impl Clone for CefURLRequestClient {
fn clone(&self) -> CefURLRequestClient{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefURLRequestClient {
@ -441,8 +429,7 @@ impl Clone for CefURLRequestClient {
impl Drop for CefURLRequestClient {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -457,8 +444,7 @@ impl CefURLRequestClient {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_client_t) -> CefURLRequestClient {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefURLRequestClient {
@ -472,8 +458,7 @@ impl CefURLRequestClient {
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_client_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -481,10 +466,10 @@ impl CefURLRequestClient {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -493,8 +478,7 @@ impl CefURLRequestClient {
// successful or not.
//
pub fn on_request_complete(&self, request: interfaces::CefURLRequest) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -513,8 +497,7 @@ impl CefURLRequestClient {
//
pub fn on_upload_progress(&self, request: interfaces::CefURLRequest,
current: i64, total: i64) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -534,8 +517,7 @@ impl CefURLRequestClient {
//
pub fn on_download_progress(&self, request: interfaces::CefURLRequest,
current: i64, total: i64) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -555,8 +537,7 @@ impl CefURLRequestClient {
//
pub fn on_download_data(&self, request: interfaces::CefURLRequest, data: &(),
data_length: libc::size_t) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -581,8 +562,7 @@ impl CefURLRequestClient {
pub fn get_auth_credentials(&self, isProxy: libc::c_int, host: &[u16],
port: libc::c_int, realm: &[u16], scheme: &[u16],
callback: interfaces::CefAuthCallback) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -615,8 +595,7 @@ impl CefWrap<*mut cef_urlrequest_client_t> for Option<CefURLRequestClient> {
}
}
unsafe fn to_rust(c_object: *mut cef_urlrequest_client_t) -> Option<CefURLRequestClient> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
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

@ -108,8 +108,7 @@ pub struct CefWebPluginInfo {
impl Clone for CefWebPluginInfo {
fn clone(&self) -> CefWebPluginInfo{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefWebPluginInfo {
@ -122,8 +121,7 @@ impl Clone for CefWebPluginInfo {
impl Drop for CefWebPluginInfo {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -138,8 +136,7 @@ impl CefWebPluginInfo {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_t) -> CefWebPluginInfo {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefWebPluginInfo {
@ -153,8 +150,7 @@ impl CefWebPluginInfo {
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -162,10 +158,10 @@ impl CefWebPluginInfo {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -173,8 +169,7 @@ impl CefWebPluginInfo {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -189,8 +184,7 @@ impl CefWebPluginInfo {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_path(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -205,8 +199,7 @@ impl CefWebPluginInfo {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_version(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -221,8 +214,7 @@ impl CefWebPluginInfo {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_description(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -249,8 +241,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefWebPluginInfo::from_c_object_addref(c_object))
@ -305,8 +296,7 @@ pub struct CefWebPluginInfoVisitor {
impl Clone for CefWebPluginInfoVisitor {
fn clone(&self) -> CefWebPluginInfoVisitor{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefWebPluginInfoVisitor {
@ -319,8 +309,7 @@ impl Clone for CefWebPluginInfoVisitor {
impl Drop for CefWebPluginInfoVisitor {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -335,8 +324,7 @@ impl CefWebPluginInfoVisitor {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_visitor_t) -> CefWebPluginInfoVisitor {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefWebPluginInfoVisitor {
@ -350,8 +338,7 @@ impl CefWebPluginInfoVisitor {
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_visitor_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -359,10 +346,10 @@ impl CefWebPluginInfoVisitor {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -373,8 +360,7 @@ impl CefWebPluginInfoVisitor {
//
pub fn visit(&self, info: interfaces::CefWebPluginInfo, count: libc::c_int,
total: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -404,8 +390,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefWebPluginInfoVisitor::from_c_object_addref(c_object))
@ -459,8 +444,7 @@ pub struct CefWebPluginUnstableCallback {
impl Clone for CefWebPluginUnstableCallback {
fn clone(&self) -> CefWebPluginUnstableCallback{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefWebPluginUnstableCallback {
@ -473,8 +457,7 @@ impl Clone for CefWebPluginUnstableCallback {
impl Drop for CefWebPluginUnstableCallback {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -489,8 +472,7 @@ impl CefWebPluginUnstableCallback {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_unstable_callback_t) -> CefWebPluginUnstableCallback {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefWebPluginUnstableCallback {
@ -504,8 +486,7 @@ impl CefWebPluginUnstableCallback {
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_unstable_callback_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -513,10 +494,10 @@ impl CefWebPluginUnstableCallback {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -525,8 +506,7 @@ impl CefWebPluginUnstableCallback {
// 120 seconds.
//
pub fn is_unstable(&self, path: &[u16], unstable: libc::c_int) -> () {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -555,8 +535,7 @@ 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> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefWebPluginUnstableCallback::from_c_object_addref(c_object))

View File

@ -301,8 +301,7 @@ pub struct CefXmlReader {
impl Clone for CefXmlReader {
fn clone(&self) -> CefXmlReader{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefXmlReader {
@ -315,8 +314,7 @@ impl Clone for CefXmlReader {
impl Drop for CefXmlReader {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -331,8 +329,7 @@ impl CefXmlReader {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_xml_reader_t) -> CefXmlReader {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefXmlReader {
@ -346,8 +343,7 @@ impl CefXmlReader {
pub fn c_object_addrefed(&self) -> *mut cef_xml_reader_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -355,10 +351,10 @@ impl CefXmlReader {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -367,8 +363,7 @@ impl CefXmlReader {
// if the cursor position was set successfully.
//
pub fn move_to_next_node(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -383,8 +378,7 @@ impl CefXmlReader {
// occurs on the correct thread.
//
pub fn close(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -398,8 +392,7 @@ impl CefXmlReader {
// Returns true (1) if an error has been reported by the XML parser.
//
pub fn has_error(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -414,8 +407,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_error(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -433,8 +425,7 @@ impl CefXmlReader {
// Returns the node type.
//
pub fn get_type(&self) -> types::cef_xml_node_type_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -448,8 +439,7 @@ impl CefXmlReader {
// Returns the node depth. Depth starts at 0 for the root node.
//
pub fn get_depth(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -465,8 +455,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_local_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -482,8 +471,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_prefix(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -499,8 +487,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_qualified_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -516,8 +503,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_namespace_uri(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -533,8 +519,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_base_uri(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -550,8 +535,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_xml_lang(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -566,8 +550,7 @@ impl CefXmlReader {
// NULL but <a></a> is not.
//
pub fn is_empty_element(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -581,8 +564,7 @@ impl CefXmlReader {
// Returns true (1) if the node has a text value.
//
pub fn has_value(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -597,8 +579,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_value(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -612,8 +593,7 @@ impl CefXmlReader {
// Returns true (1) if the node has attributes.
//
pub fn has_attributes(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -627,8 +607,7 @@ impl CefXmlReader {
// Returns the number of attributes.
//
pub fn get_attribute_count(&self) -> libc::size_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -643,8 +622,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_attribute_byindex(&self, index: libc::c_int) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -660,8 +638,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_attribute_byqname(&self, qualifiedName: &[u16]) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -679,8 +656,7 @@ impl CefXmlReader {
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_attribute_bylname(&self, localName: &[u16],
namespaceURI: &[u16]) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -697,8 +673,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_inner_xml(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -713,8 +688,7 @@ impl CefXmlReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_outer_xml(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -728,8 +702,7 @@ impl CefXmlReader {
// Returns the line number for the current node.
//
pub fn get_line_number(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -750,8 +723,7 @@ impl CefXmlReader {
// true (1) if the cursor position was set successfully.
//
pub fn move_to_attribute_byindex(&self, index: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -768,8 +740,7 @@ impl CefXmlReader {
//
pub fn move_to_attribute_byqname(&self,
qualifiedName: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -787,8 +758,7 @@ impl CefXmlReader {
//
pub fn move_to_attribute_bylname(&self, localName: &[u16],
namespaceURI: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -805,8 +775,7 @@ impl CefXmlReader {
// true (1) if the cursor position was set successfully.
//
pub fn move_to_first_attribute(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -821,8 +790,7 @@ impl CefXmlReader {
// (1) if the cursor position was set successfully.
//
pub fn move_to_next_attribute(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -837,8 +805,7 @@ impl CefXmlReader {
// cursor position was set successfully.
//
pub fn move_to_carrying_element(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -881,8 +848,7 @@ impl CefWrap<*mut cef_xml_reader_t> for Option<CefXmlReader> {
}
}
unsafe fn to_rust(c_object: *mut cef_xml_reader_t) -> Option<CefXmlReader> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefXmlReader::from_c_object_addref(c_object))

View File

@ -164,8 +164,7 @@ pub struct CefZipReader {
impl Clone for CefZipReader {
fn clone(&self) -> CefZipReader{
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
}
CefZipReader {
@ -178,8 +177,7 @@ impl Clone for CefZipReader {
impl Drop for CefZipReader {
fn drop(&mut self) {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
}
}
@ -194,8 +192,7 @@ impl CefZipReader {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_zip_reader_t) -> CefZipReader {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if !c_object.is_null() {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefZipReader {
@ -209,8 +206,7 @@ impl CefZipReader {
pub fn c_object_addrefed(&self) -> *mut cef_zip_reader_t {
unsafe {
if !self.c_object.is_null() &&
self.c_object as usize != mem::POST_DROP_USIZE {
if !self.c_object.is_null() {
eutil::add_ref(self.c_object as *mut types::cef_base_t);
}
self.c_object
@ -218,10 +214,10 @@ impl CefZipReader {
}
pub fn is_null_cef_object(&self) -> bool {
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
self.c_object.is_null()
}
pub fn is_not_null_cef_object(&self) -> bool {
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
!self.c_object.is_null()
}
//
@ -229,8 +225,7 @@ impl CefZipReader {
// cursor position was set successfully.
//
pub fn move_to_first_file(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -245,8 +240,7 @@ impl CefZipReader {
// cursor position was set successfully.
//
pub fn move_to_next_file(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -263,8 +257,7 @@ impl CefZipReader {
//
pub fn move_to_file(&self, fileName: &[u16],
caseSensitive: libc::c_int) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -281,8 +274,7 @@ impl CefZipReader {
// occurs on the correct thread.
//
pub fn close(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -300,8 +292,7 @@ impl CefZipReader {
//
// The resulting string must be freed by calling cef_string_userfree_free().
pub fn get_file_name(&self) -> String {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -315,8 +306,7 @@ impl CefZipReader {
// Returns the uncompressed size of the file.
//
pub fn get_file_size(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -330,8 +320,7 @@ impl CefZipReader {
// Returns the last modified timestamp for the file.
//
pub fn get_file_last_modified(&self) -> types::cef_time_t {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -346,8 +335,7 @@ impl CefZipReader {
// optionally be specified.
//
pub fn open_file(&self, password: &[u16]) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -362,8 +350,7 @@ impl CefZipReader {
// Closes the file.
//
pub fn close_file(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -379,8 +366,7 @@ impl CefZipReader {
//
pub fn read_file(&self, buffer: &mut (),
bufferSize: libc::size_t) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -396,8 +382,7 @@ impl CefZipReader {
// Returns the current offset in the uncompressed file contents.
//
pub fn tell(&self) -> i64 {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -411,8 +396,7 @@ impl CefZipReader {
// Returns true (1) if at end of the file contents.
//
pub fn eof(&self) -> libc::c_int {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
if self.c_object.is_null() {
panic!("called a CEF method on a null object")
}
unsafe {
@ -452,8 +436,7 @@ impl CefWrap<*mut cef_zip_reader_t> for Option<CefZipReader> {
}
}
unsafe fn to_rust(c_object: *mut cef_zip_reader_t) -> Option<CefZipReader> {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
if c_object.is_null() {
None
} else {
Some(CefZipReader::from_c_object_addref(c_object))

View File

@ -4,12 +4,10 @@
#![feature(box_syntax)]
#![feature(core_intrinsics)]
#![feature(filling_drop)]
#![feature(link_args)]
#![feature(plugin)]
#![feature(try_borrow)]
#![feature(unicode)]
#![feature(unsafe_no_drop_flag)]
#![allow(non_camel_case_types)]

View File

@ -327,7 +327,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -342,7 +342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "string_cache"
version = "0.2.24"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1 +1 @@
2016-08-23
2016-08-27

View File

@ -39,11 +39,11 @@ macro_rules! sizeof_checker (
// Update the sizes here
sizeof_checker!(size_event_target, EventTarget, 40);
sizeof_checker!(size_node, Node, 160);
sizeof_checker!(size_element, Element, 336);
sizeof_checker!(size_htmlelement, HTMLElement, 352);
sizeof_checker!(size_div, HTMLDivElement, 352);
sizeof_checker!(size_span, HTMLSpanElement, 352);
sizeof_checker!(size_text, Text, 192);
sizeof_checker!(size_characterdata, CharacterData, 192);
sizeof_checker!(size_node, Node, 152);
sizeof_checker!(size_element, Element, 328);
sizeof_checker!(size_htmlelement, HTMLElement, 344);
sizeof_checker!(size_div, HTMLDivElement, 344);
sizeof_checker!(size_span, HTMLSpanElement, 344);
sizeof_checker!(size_text, Text, 184);
sizeof_checker!(size_characterdata, CharacterData, 184);
sizeof_checker!(size_servothreadsafelayoutnode, ServoThreadSafeLayoutNode, 16);

View File

@ -15,7 +15,7 @@ cssparser = {version = "0.5.7", features = ["heap_size"]}
euclid = "0.10.1"
rustc-serialize = "0.3"
selectors = {version = "0.11", features = ["heap_size"]}
string_cache = {version = "0.2.23", features = ["heap_size"]}
string_cache = {version = "0.2.25", features = ["heap_size"]}
style = {path = "../../../components/style"}
style_traits = {path = "../../../components/style_traits"}
url = {version = "1.2", features = ["heap_size"]}