mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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;
|
||||
|
||||
//
|
||||
|
@ -101,13 +102,13 @@ pub struct _cef_urlrequest_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_urlrequest_t = _cef_urlrequest_t;
|
||||
|
||||
|
@ -126,7 +127,8 @@ pub struct CefURLRequest {
|
|||
impl Clone for CefURLRequest {
|
||||
fn clone(&self) -> CefURLRequest{
|
||||
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);
|
||||
}
|
||||
CefURLRequest {
|
||||
|
@ -139,7 +141,8 @@ impl Clone for CefURLRequest {
|
|||
impl Drop for CefURLRequest {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +157,8 @@ impl CefURLRequest {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_t) -> CefURLRequest {
|
||||
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);
|
||||
}
|
||||
CefURLRequest {
|
||||
|
@ -168,7 +172,8 @@ impl CefURLRequest {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_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
|
||||
|
@ -176,10 +181,10 @@ impl CefURLRequest {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -187,7 +192,8 @@ impl CefURLRequest {
|
|||
// object is read-only and should not be modified.
|
||||
//
|
||||
pub fn get_request(&self) -> interfaces::CefRequest {
|
||||
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 {
|
||||
|
@ -201,7 +207,8 @@ impl CefURLRequest {
|
|||
// Returns the client.
|
||||
//
|
||||
pub fn get_client(&self) -> interfaces::CefURLRequestClient {
|
||||
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 {
|
||||
|
@ -215,7 +222,8 @@ impl CefURLRequest {
|
|||
// Returns the request status.
|
||||
//
|
||||
pub fn get_request_status(&self) -> types::cef_urlrequest_status_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 {
|
||||
|
@ -230,7 +238,8 @@ impl CefURLRequest {
|
|||
// otherwise.
|
||||
//
|
||||
pub fn get_request_error(&self) -> types::cef_errorcode_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 {
|
||||
|
@ -246,7 +255,8 @@ 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() {
|
||||
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 {
|
||||
|
@ -260,7 +270,8 @@ impl CefURLRequest {
|
|||
// Cancel the 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 {
|
||||
|
@ -314,7 +325,8 @@ 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() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefURLRequest::from_c_object_addref(c_object))
|
||||
|
@ -392,13 +404,13 @@ pub struct _cef_urlrequest_client_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_urlrequest_client_t = _cef_urlrequest_client_t;
|
||||
|
||||
|
@ -415,7 +427,8 @@ pub struct CefURLRequestClient {
|
|||
impl Clone for CefURLRequestClient {
|
||||
fn clone(&self) -> CefURLRequestClient{
|
||||
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);
|
||||
}
|
||||
CefURLRequestClient {
|
||||
|
@ -428,7 +441,8 @@ impl Clone for CefURLRequestClient {
|
|||
impl Drop for CefURLRequestClient {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -443,7 +457,8 @@ impl CefURLRequestClient {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_client_t) -> CefURLRequestClient {
|
||||
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);
|
||||
}
|
||||
CefURLRequestClient {
|
||||
|
@ -457,7 +472,8 @@ impl CefURLRequestClient {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_client_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
|
||||
|
@ -465,10 +481,10 @@ impl CefURLRequestClient {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -477,7 +493,8 @@ impl CefURLRequestClient {
|
|||
// successful or not.
|
||||
//
|
||||
pub fn on_request_complete(&self, request: interfaces::CefURLRequest) -> () {
|
||||
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 {
|
||||
|
@ -496,7 +513,8 @@ impl CefURLRequestClient {
|
|||
//
|
||||
pub fn on_upload_progress(&self, request: interfaces::CefURLRequest,
|
||||
current: i64, total: i64) -> () {
|
||||
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 {
|
||||
|
@ -516,7 +534,8 @@ impl CefURLRequestClient {
|
|||
//
|
||||
pub fn on_download_progress(&self, request: interfaces::CefURLRequest,
|
||||
current: i64, total: i64) -> () {
|
||||
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 {
|
||||
|
@ -536,7 +555,8 @@ impl CefURLRequestClient {
|
|||
//
|
||||
pub fn on_download_data(&self, request: interfaces::CefURLRequest, data: &(),
|
||||
data_length: libc::size_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 {
|
||||
|
@ -561,7 +581,8 @@ 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() {
|
||||
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 {
|
||||
|
@ -594,7 +615,8 @@ 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() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefURLRequestClient::from_c_object_addref(c_object))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue