update embedding interfaces again to use filling_drop feature

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

View file

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