mirror of
https://github.com/servo/servo.git
synced 2025-08-16 02:45:36 +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;
|
||||
|
||||
//
|
||||
|
@ -200,13 +201,13 @@ pub struct _cef_command_line_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_command_line_t = _cef_command_line_t;
|
||||
|
||||
|
@ -228,7 +229,8 @@ pub struct CefCommandLine {
|
|||
impl Clone for CefCommandLine {
|
||||
fn clone(&self) -> CefCommandLine{
|
||||
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);
|
||||
}
|
||||
CefCommandLine {
|
||||
|
@ -241,7 +243,8 @@ impl Clone for CefCommandLine {
|
|||
impl Drop for CefCommandLine {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +259,8 @@ impl CefCommandLine {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_command_line_t) -> CefCommandLine {
|
||||
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);
|
||||
}
|
||||
CefCommandLine {
|
||||
|
@ -270,7 +274,8 @@ impl CefCommandLine {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_command_line_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
|
||||
|
@ -278,10 +283,10 @@ impl CefCommandLine {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -289,7 +294,8 @@ impl CefCommandLine {
|
|||
// if this function returns false (0).
|
||||
//
|
||||
pub fn is_valid(&self) -> 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 {
|
||||
|
@ -304,7 +310,8 @@ impl CefCommandLine {
|
|||
// expose read-only objects.
|
||||
//
|
||||
pub fn is_read_only(&self) -> 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 {
|
||||
|
@ -318,7 +325,8 @@ impl CefCommandLine {
|
|||
// Returns a writable copy of this object.
|
||||
//
|
||||
pub fn copy(&self) -> interfaces::CefCommandLine {
|
||||
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 {
|
||||
|
@ -334,7 +342,8 @@ impl CefCommandLine {
|
|||
// supported on non-Windows platforms.
|
||||
//
|
||||
pub fn init_from_argv(&self, argc: libc::c_int, argv: &&str) -> () {
|
||||
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 {
|
||||
|
@ -351,7 +360,8 @@ impl CefCommandLine {
|
|||
// GetCommandLineW(). This function is only supported on Windows.
|
||||
//
|
||||
pub fn init_from_string(&self, command_line: &[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 {
|
||||
|
@ -367,7 +377,8 @@ impl CefCommandLine {
|
|||
// component unchanged.
|
||||
//
|
||||
pub fn reset(&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 {
|
||||
|
@ -382,7 +393,8 @@ impl CefCommandLine {
|
|||
// array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
|
||||
//
|
||||
pub fn get_argv(&self, argv: Vec<String>) -> () {
|
||||
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 +411,8 @@ impl CefCommandLine {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_command_line_string(&self) -> String {
|
||||
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 {
|
||||
|
@ -414,7 +427,8 @@ impl CefCommandLine {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_program(&self) -> String {
|
||||
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 {
|
||||
|
@ -428,7 +442,8 @@ impl CefCommandLine {
|
|||
// Set the program part of the command line string (the first item).
|
||||
//
|
||||
pub fn set_program(&self, program: &[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 {
|
||||
|
@ -443,7 +458,8 @@ impl CefCommandLine {
|
|||
// Returns true (1) if the command line has switches.
|
||||
//
|
||||
pub fn has_switches(&self) -> 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 {
|
||||
|
@ -457,7 +473,8 @@ impl CefCommandLine {
|
|||
// Returns true (1) if the command line contains the given switch.
|
||||
//
|
||||
pub fn has_switch(&self, name: &[u16]) -> 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 {
|
||||
|
@ -474,7 +491,8 @@ impl CefCommandLine {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_switch_value(&self, name: &[u16]) -> String {
|
||||
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 {
|
||||
|
@ -490,7 +508,8 @@ impl CefCommandLine {
|
|||
// NULL string is returned.
|
||||
//
|
||||
pub fn get_switches(&self, switches: HashMap<String,String>) -> () {
|
||||
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 {
|
||||
|
@ -506,7 +525,8 @@ impl CefCommandLine {
|
|||
// pass an NULL value string.
|
||||
//
|
||||
pub fn append_switch(&self, name: &[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 {
|
||||
|
@ -521,7 +541,8 @@ impl CefCommandLine {
|
|||
// Add a switch with the specified value to the end of the command line.
|
||||
//
|
||||
pub fn append_switch_with_value(&self, name: &[u16], value: &[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 {
|
||||
|
@ -537,7 +558,8 @@ impl CefCommandLine {
|
|||
// True if there are remaining command line arguments.
|
||||
//
|
||||
pub fn has_arguments(&self) -> 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 {
|
||||
|
@ -551,7 +573,8 @@ impl CefCommandLine {
|
|||
// Get the remaining command line arguments.
|
||||
//
|
||||
pub fn get_arguments(&self, arguments: Vec<String>) -> () {
|
||||
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 {
|
||||
|
@ -566,7 +589,8 @@ impl CefCommandLine {
|
|||
// Add an argument to the end of the command line.
|
||||
//
|
||||
pub fn append_argument(&self, argument: &[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 {
|
||||
|
@ -582,7 +606,8 @@ impl CefCommandLine {
|
|||
// "valgrind" or "gdb --args".
|
||||
//
|
||||
pub fn prepend_wrapper(&self, wrapper: &[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 {
|
||||
|
@ -633,7 +658,8 @@ impl CefWrap<*mut cef_command_line_t> for Option<CefCommandLine> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_command_line_t) -> Option<CefCommandLine> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCommandLine::from_c_object_addref(c_object))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue