зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1792920, part 1 - Remove the unused return values for various Rust AddRef and Release methods. r=necko-reviewers,platform-i18n-reviewers,gregtatum,valentin
Rust's definition of nsrefcnt is incorrect, so I'm eliminating uses of it where possible. Nobody actually uses these return values, so remove them. Differential Revision: https://phabricator.services.mozilla.com/D159320
This commit is contained in:
Родитель
1550a1050e
Коммит
566e2d6cec
|
@ -21,7 +21,7 @@ use std::{borrow::Cow, cell::RefCell};
|
|||
use thin_vec::ThinVec;
|
||||
use unic_langid::LanguageIdentifier;
|
||||
use xpcom::{
|
||||
interfaces::{nsIRunnablePriority, nsrefcnt},
|
||||
interfaces::{nsIRunnablePriority},
|
||||
RefCounted, RefPtr, Refcnt,
|
||||
};
|
||||
|
||||
|
@ -458,17 +458,16 @@ pub extern "C" fn localization_new_with_locales(
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn localization_addref(loc: &LocalizationRc) -> nsrefcnt {
|
||||
loc.refcnt.inc()
|
||||
pub unsafe extern "C" fn localization_addref(loc: &LocalizationRc) {
|
||||
loc.refcnt.inc();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn localization_release(loc: *const LocalizationRc) -> nsrefcnt {
|
||||
pub unsafe extern "C" fn localization_release(loc: *const LocalizationRc) {
|
||||
let rc = (*loc).refcnt.dec();
|
||||
if rc == 0 {
|
||||
std::mem::drop(Box::from_raw(loc as *const _ as *mut LocalizationRc));
|
||||
}
|
||||
rc
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
|
@ -213,8 +213,8 @@ class MozURL final {
|
|||
Mutator Mutate() { return Mutator(this); }
|
||||
|
||||
// AddRef and Release are non-virtual on this type, and always call into rust.
|
||||
nsrefcnt AddRef() { return mozurl_addref(this); }
|
||||
nsrefcnt Release() { return mozurl_release(this); }
|
||||
void AddRef() { mozurl_addref(this); }
|
||||
void Release() { mozurl_release(this); }
|
||||
|
||||
private:
|
||||
// Make it a compile time error for C++ code to ever create, destruct, or copy
|
||||
|
|
|
@ -14,7 +14,7 @@ extern crate nserror;
|
|||
use nserror::*;
|
||||
|
||||
extern crate xpcom;
|
||||
use xpcom::interfaces::{mozIThirdPartyUtil, nsrefcnt};
|
||||
use xpcom::interfaces::{mozIThirdPartyUtil};
|
||||
use xpcom::{AtomicRefcnt, RefCounted, RefPtr};
|
||||
|
||||
extern crate uuid;
|
||||
|
@ -120,17 +120,16 @@ impl ops::DerefMut for MozURL {
|
|||
|
||||
// Memory Management for MozURL
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn mozurl_addref(url: &MozURL) -> nsrefcnt {
|
||||
url.refcnt.inc()
|
||||
pub unsafe extern "C" fn mozurl_addref(url: &MozURL) {
|
||||
url.refcnt.inc();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn mozurl_release(url: &MozURL) -> nsrefcnt {
|
||||
pub unsafe extern "C" fn mozurl_release(url: &MozURL) {
|
||||
let rc = url.refcnt.dec();
|
||||
if rc == 0 {
|
||||
mem::drop(Box::from_raw(url as *const MozURL as *mut MozURL));
|
||||
}
|
||||
rc
|
||||
}
|
||||
|
||||
// xpcom::RefPtr support
|
||||
|
|
|
@ -100,8 +100,8 @@ class NeqoHttp3Conn final {
|
|||
|
||||
bool IsZeroRtt() { return neqo_http3conn_is_zero_rtt(this); }
|
||||
|
||||
nsrefcnt AddRef() { return neqo_http3conn_addref(this); }
|
||||
nsrefcnt Release() { return neqo_http3conn_release(this); }
|
||||
void AddRef() { neqo_http3conn_addref(this); }
|
||||
void Release() { neqo_http3conn_release(this); }
|
||||
|
||||
void GetStats(Http3Stats* aStats) {
|
||||
return neqo_http3conn_get_stats(this, aStats);
|
||||
|
|
|
@ -34,7 +34,7 @@ use std::time::Instant;
|
|||
use thin_vec::ThinVec;
|
||||
#[cfg(windows)]
|
||||
use winapi::shared::ws2def::{AF_INET, AF_INET6};
|
||||
use xpcom::{interfaces::nsrefcnt, AtomicRefcnt, RefCounted, RefPtr};
|
||||
use xpcom::{AtomicRefcnt, RefCounted, RefPtr};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct NeqoHttp3Conn {
|
||||
|
@ -195,17 +195,16 @@ impl NeqoHttp3Conn {
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn neqo_http3conn_addref(conn: &NeqoHttp3Conn) -> nsrefcnt {
|
||||
conn.refcnt.inc()
|
||||
pub unsafe extern "C" fn neqo_http3conn_addref(conn: &NeqoHttp3Conn) {
|
||||
conn.refcnt.inc();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn neqo_http3conn_release(conn: &NeqoHttp3Conn) -> nsrefcnt {
|
||||
pub unsafe extern "C" fn neqo_http3conn_release(conn: &NeqoHttp3Conn) {
|
||||
let rc = conn.refcnt.dec();
|
||||
if rc == 0 {
|
||||
std::mem::drop(Box::from_raw(conn as *const _ as *mut NeqoHttp3Conn));
|
||||
}
|
||||
rc
|
||||
}
|
||||
|
||||
// xpcom::RefPtr support
|
||||
|
|
Загрузка…
Ссылка в новой задаче