mirror of
https://github.com/servo/servo.git
synced 2025-07-26 08:40:24 +01:00
style: Disable NSCAP_FEATURE_USE_BASE
This is a relatively small code size regression (130k on windows and macOS, 180k on Linux), for a few high confidence improvements in speedometer 3. See link in the bug. If this sticks, we can actually clean up a bunch of code, and eventually unify RefPtr and nsCOMPtr. But I want this to be on the tree for a while before doing more aggressive refactorings / actually removing the code. Differential Revision: https://phabricator.services.mozilla.com/D178267
This commit is contained in:
parent
7a2b444a60
commit
b92440ef7c
4 changed files with 7 additions and 21 deletions
|
@ -74,7 +74,7 @@ impl fmt::Debug for Device {
|
||||||
let mut doc_uri = nsCString::new();
|
let mut doc_uri = nsCString::new();
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_nsIURI_Debug(
|
bindings::Gecko_nsIURI_Debug(
|
||||||
(*self.document()).mDocumentURI.raw::<structs::nsIURI>(),
|
(*self.document()).mDocumentURI.raw(),
|
||||||
&mut doc_uri,
|
&mut doc_uri,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
@ -413,7 +413,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.0
|
self.0
|
||||||
.mFirstChild
|
.mFirstChild
|
||||||
.raw::<nsIContent>()
|
.raw()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(GeckoNode::from_content)
|
.map(GeckoNode::from_content)
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
fn prev_sibling(&self) -> Option<Self> {
|
fn prev_sibling(&self) -> Option<Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let prev_or_last = GeckoNode::from_content(self.0.mPreviousOrLastSibling.as_ref()?);
|
let prev_or_last = GeckoNode::from_content(self.0.mPreviousOrLastSibling.as_ref()?);
|
||||||
if prev_or_last.0.mNextSibling.raw::<nsIContent>().is_null() {
|
if prev_or_last.0.mNextSibling.raw().is_null() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Some(prev_or_last)
|
Some(prev_or_last)
|
||||||
|
@ -440,7 +440,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.0
|
self.0
|
||||||
.mNextSibling
|
.mNextSibling
|
||||||
.raw::<nsIContent>()
|
.raw()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(GeckoNode::from_content)
|
.map(GeckoNode::from_content)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,20 +6,10 @@
|
||||||
|
|
||||||
use crate::gecko_bindings::structs::nsCOMPtr;
|
use crate::gecko_bindings::structs::nsCOMPtr;
|
||||||
|
|
||||||
#[cfg(feature = "gecko_debug")]
|
|
||||||
impl<T> nsCOMPtr<T> {
|
impl<T> nsCOMPtr<T> {
|
||||||
/// Get this pointer as a raw pointer.
|
/// Get this pointer as a raw pointer.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn raw<U>(&self) -> *mut T {
|
pub fn raw(&self) -> *mut T {
|
||||||
self.mRawPtr
|
self.mRawPtr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "gecko_debug"))]
|
|
||||||
impl nsCOMPtr {
|
|
||||||
/// Get this pointer as a raw pointer.
|
|
||||||
#[inline]
|
|
||||||
pub fn raw<T>(&self) -> *mut T {
|
|
||||||
self._base.mRawPtr as *mut _
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -225,15 +225,11 @@ impl fmt::Debug for UrlExtraData {
|
||||||
.field("chrome_rules_enabled", &self.chrome_rules_enabled())
|
.field("chrome_rules_enabled", &self.chrome_rules_enabled())
|
||||||
.field(
|
.field(
|
||||||
"base",
|
"base",
|
||||||
&DebugURI(self.as_ref().mBaseURI.raw::<structs::nsIURI>()),
|
&DebugURI(self.as_ref().mBaseURI.raw()),
|
||||||
)
|
)
|
||||||
.field(
|
.field(
|
||||||
"referrer",
|
"referrer",
|
||||||
&DebugReferrerInfo(
|
&DebugReferrerInfo(self.as_ref().mReferrerInfo.raw()),
|
||||||
self.as_ref()
|
|
||||||
.mReferrerInfo
|
|
||||||
.raw::<structs::nsIReferrerInfo>(),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue