mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
update embedding interfaces again to use filling_drop feature
...and remove trailing whitespaces
This commit is contained in:
parent
efb2b37185
commit
745e3bd49f
57 changed files with 2797 additions and 1550 deletions
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -71,13 +72,13 @@ pub struct _cef_auth_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_auth_callback_t = _cef_auth_callback_t;
|
||||
|
||||
|
@ -93,7 +94,8 @@ pub struct CefAuthCallback {
|
|||
impl Clone for CefAuthCallback {
|
||||
fn clone(&self) -> CefAuthCallback{
|
||||
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);
|
||||
}
|
||||
CefAuthCallback {
|
||||
|
@ -106,7 +108,8 @@ impl Clone for CefAuthCallback {
|
|||
impl Drop for CefAuthCallback {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +124,8 @@ impl CefAuthCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_auth_callback_t) -> CefAuthCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefAuthCallback {
|
||||
|
@ -135,7 +139,8 @@ impl CefAuthCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_auth_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -143,17 +148,18 @@ impl CefAuthCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Continue the authentication request.
|
||||
//
|
||||
pub fn cont(&self, username: &[u16], password: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -169,7 +175,8 @@ impl CefAuthCallback {
|
|||
// Cancel the authentication request.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -196,7 +203,8 @@ impl CefWrap<*mut cef_auth_callback_t> for Option<CefAuthCallback> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_auth_callback_t) -> Option<CefAuthCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefAuthCallback::from_c_object_addref(c_object))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue