mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05: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;
|
||||
|
||||
//
|
||||
|
@ -138,13 +139,13 @@ pub struct _cef_cookie_manager_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_cookie_manager_t = _cef_cookie_manager_t;
|
||||
|
||||
|
@ -160,7 +161,8 @@ pub struct CefCookieManager {
|
|||
impl Clone for CefCookieManager {
|
||||
fn clone(&self) -> CefCookieManager{
|
||||
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);
|
||||
}
|
||||
CefCookieManager {
|
||||
|
@ -173,7 +175,8 @@ impl Clone for CefCookieManager {
|
|||
impl Drop for CefCookieManager {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +191,8 @@ impl CefCookieManager {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_manager_t) -> CefCookieManager {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefCookieManager {
|
||||
|
@ -202,7 +206,8 @@ impl CefCookieManager {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_cookie_manager_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
|
||||
|
@ -210,10 +215,10 @@ impl CefCookieManager {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -224,7 +229,8 @@ impl CefCookieManager {
|
|||
//
|
||||
pub fn set_supported_schemes(&self, schemes: Vec<String>,
|
||||
callback: interfaces::CefCompletionCallback) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -243,7 +249,8 @@ impl CefCookieManager {
|
|||
//
|
||||
pub fn visit_all_cookies(&self,
|
||||
visitor: interfaces::CefCookieVisitor) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -263,7 +270,8 @@ 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() {
|
||||
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 {
|
||||
|
@ -287,7 +295,8 @@ impl CefCookieManager {
|
|||
//
|
||||
pub fn set_cookie(&self, url: &[u16], cookie: &interfaces::CefCookie,
|
||||
callback: interfaces::CefSetCookieCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -313,7 +322,8 @@ impl CefCookieManager {
|
|||
//
|
||||
pub fn delete_cookies(&self, url: &[u16], cookie_name: &[u16],
|
||||
callback: interfaces::CefDeleteCookiesCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -339,7 +349,8 @@ 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() {
|
||||
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 {
|
||||
|
@ -359,7 +370,8 @@ impl CefCookieManager {
|
|||
//
|
||||
pub fn flush_store(&self,
|
||||
callback: interfaces::CefCompletionCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -424,7 +436,8 @@ impl CefWrap<*mut cef_cookie_manager_t> for Option<CefCookieManager> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_cookie_manager_t) -> Option<CefCookieManager> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCookieManager::from_c_object_addref(c_object))
|
||||
|
@ -458,13 +471,13 @@ pub struct _cef_cookie_visitor_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_cookie_visitor_t = _cef_cookie_visitor_t;
|
||||
|
||||
|
@ -480,7 +493,8 @@ pub struct CefCookieVisitor {
|
|||
impl Clone for CefCookieVisitor {
|
||||
fn clone(&self) -> CefCookieVisitor{
|
||||
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);
|
||||
}
|
||||
CefCookieVisitor {
|
||||
|
@ -493,7 +507,8 @@ impl Clone for CefCookieVisitor {
|
|||
impl Drop for CefCookieVisitor {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -508,7 +523,8 @@ impl CefCookieVisitor {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_visitor_t) -> CefCookieVisitor {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefCookieVisitor {
|
||||
|
@ -522,7 +538,8 @@ impl CefCookieVisitor {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_cookie_visitor_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
|
||||
|
@ -530,10 +547,10 @@ impl CefCookieVisitor {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -545,7 +562,8 @@ 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() {
|
||||
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 {
|
||||
|
@ -576,7 +594,8 @@ impl CefWrap<*mut cef_cookie_visitor_t> for Option<CefCookieVisitor> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_cookie_visitor_t) -> Option<CefCookieVisitor> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCookieVisitor::from_c_object_addref(c_object))
|
||||
|
@ -606,13 +625,13 @@ pub struct _cef_set_cookie_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_set_cookie_callback_t = _cef_set_cookie_callback_t;
|
||||
|
||||
|
@ -628,7 +647,8 @@ pub struct CefSetCookieCallback {
|
|||
impl Clone for CefSetCookieCallback {
|
||||
fn clone(&self) -> CefSetCookieCallback{
|
||||
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);
|
||||
}
|
||||
CefSetCookieCallback {
|
||||
|
@ -641,7 +661,8 @@ impl Clone for CefSetCookieCallback {
|
|||
impl Drop for CefSetCookieCallback {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -656,7 +677,8 @@ impl CefSetCookieCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_set_cookie_callback_t) -> CefSetCookieCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefSetCookieCallback {
|
||||
|
@ -670,7 +692,8 @@ impl CefSetCookieCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_set_cookie_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
|
||||
|
@ -678,10 +701,10 @@ impl CefSetCookieCallback {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -689,7 +712,8 @@ impl CefSetCookieCallback {
|
|||
// the cookie was set successfully.
|
||||
//
|
||||
pub fn on_complete(&self, success: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -717,7 +741,8 @@ impl CefWrap<*mut cef_set_cookie_callback_t> for Option<CefSetCookieCallback> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_set_cookie_callback_t) -> Option<CefSetCookieCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefSetCookieCallback::from_c_object_addref(c_object))
|
||||
|
@ -748,13 +773,13 @@ pub struct _cef_delete_cookies_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_delete_cookies_callback_t = _cef_delete_cookies_callback_t;
|
||||
|
||||
|
@ -770,7 +795,8 @@ pub struct CefDeleteCookiesCallback {
|
|||
impl Clone for CefDeleteCookiesCallback {
|
||||
fn clone(&self) -> CefDeleteCookiesCallback{
|
||||
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);
|
||||
}
|
||||
CefDeleteCookiesCallback {
|
||||
|
@ -783,7 +809,8 @@ impl Clone for CefDeleteCookiesCallback {
|
|||
impl Drop for CefDeleteCookiesCallback {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -798,7 +825,8 @@ impl CefDeleteCookiesCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_delete_cookies_callback_t) -> CefDeleteCookiesCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDeleteCookiesCallback {
|
||||
|
@ -812,7 +840,8 @@ impl CefDeleteCookiesCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_delete_cookies_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
|
||||
|
@ -820,10 +849,10 @@ impl CefDeleteCookiesCallback {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -831,7 +860,8 @@ 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() {
|
||||
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 {
|
||||
|
@ -859,7 +889,8 @@ impl CefWrap<*mut cef_delete_cookies_callback_t> for Option<CefDeleteCookiesCall
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_delete_cookies_callback_t) -> Option<CefDeleteCookiesCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDeleteCookiesCallback::from_c_object_addref(c_object))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue