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;
//
@ -190,13 +191,13 @@ pub struct _cef_render_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_handler_t = _cef_render_handler_t;
@ -212,7 +213,8 @@ pub struct CefRenderHandler {
impl Clone for CefRenderHandler {
fn clone(&self) -> CefRenderHandler{
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);
}
CefRenderHandler {
@ -225,7 +227,8 @@ impl Clone for CefRenderHandler {
impl Drop for CefRenderHandler {
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);
}
}
@ -240,7 +243,8 @@ impl CefRenderHandler {
}
pub unsafe fn from_c_object_addref(c_object: *mut cef_render_handler_t) -> CefRenderHandler {
if !c_object.is_null() {
if !c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
}
CefRenderHandler {
@ -254,7 +258,8 @@ impl CefRenderHandler {
pub fn c_object_addrefed(&self) -> *mut cef_render_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
@ -262,10 +267,10 @@ impl CefRenderHandler {
}
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
}
//
@ -274,7 +279,8 @@ 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() {
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 {
@ -292,7 +298,8 @@ 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() {
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 {
@ -311,7 +318,8 @@ 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() {
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 {
@ -337,7 +345,8 @@ 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() {
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 {
@ -355,7 +364,8 @@ impl CefRenderHandler {
//
pub fn on_popup_show(&self, browser: interfaces::CefBrowser,
show: libc::c_int) -> () {
if self.c_object.is_null() {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
panic!("called a CEF method on a null object")
}
unsafe {
@ -373,7 +383,8 @@ impl CefRenderHandler {
//
pub fn on_popup_size(&self, browser: interfaces::CefBrowser,
rect: &types::cef_rect_t) -> () {
if self.c_object.is_null() {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
panic!("called a CEF method on a null object")
}
unsafe {
@ -399,7 +410,8 @@ 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() {
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 {
@ -423,7 +435,8 @@ 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() {
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 {
@ -455,7 +468,8 @@ 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() {
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 {
@ -477,7 +491,8 @@ impl CefRenderHandler {
//
pub fn update_drag_cursor(&self, browser: interfaces::CefBrowser,
operation: types::cef_drag_operations_mask_t) -> () {
if self.c_object.is_null() {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
panic!("called a CEF method on a null object")
}
unsafe {
@ -494,7 +509,8 @@ 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() {
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 {
@ -515,7 +531,8 @@ 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() {
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 {
@ -532,7 +549,8 @@ impl CefRenderHandler {
// flip). This is called only during accelerated compositing.
//
pub fn on_present(&self, browser: interfaces::CefBrowser) -> () {
if self.c_object.is_null() {
if self.c_object.is_null() ||
self.c_object as usize == mem::POST_DROP_USIZE {
panic!("called a CEF method on a null object")
}
unsafe {
@ -560,7 +578,8 @@ impl CefWrap<*mut cef_render_handler_t> for Option<CefRenderHandler> {
}
}
unsafe fn to_rust(c_object: *mut cef_render_handler_t) -> Option<CefRenderHandler> {
if c_object.is_null() {
if c_object.is_null() &&
c_object as usize != mem::POST_DROP_USIZE {
None
} else {
Some(CefRenderHandler::from_c_object_addref(c_object))