From b92440ef7c38a453ef76dba53ecd9ef90c4676af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 17 May 2023 16:59:24 +0000 Subject: [PATCH] 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 --- components/style/gecko/media_queries.rs | 2 +- components/style/gecko/wrapper.rs | 6 +++--- components/style/gecko_bindings/sugar/ns_com_ptr.rs | 12 +----------- components/style/stylesheets/mod.rs | 8 ++------ 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index f666c930e6e..abd9f8af5e1 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -74,7 +74,7 @@ impl fmt::Debug for Device { let mut doc_uri = nsCString::new(); unsafe { bindings::Gecko_nsIURI_Debug( - (*self.document()).mDocumentURI.raw::(), + (*self.document()).mDocumentURI.raw(), &mut doc_uri, ) }; diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 3a1d61b019b..ac4f113c93e 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -413,7 +413,7 @@ impl<'ln> TNode for GeckoNode<'ln> { unsafe { self.0 .mFirstChild - .raw::() + .raw() .as_ref() .map(GeckoNode::from_content) } @@ -428,7 +428,7 @@ impl<'ln> TNode for GeckoNode<'ln> { fn prev_sibling(&self) -> Option { unsafe { let prev_or_last = GeckoNode::from_content(self.0.mPreviousOrLastSibling.as_ref()?); - if prev_or_last.0.mNextSibling.raw::().is_null() { + if prev_or_last.0.mNextSibling.raw().is_null() { return None; } Some(prev_or_last) @@ -440,7 +440,7 @@ impl<'ln> TNode for GeckoNode<'ln> { unsafe { self.0 .mNextSibling - .raw::() + .raw() .as_ref() .map(GeckoNode::from_content) } diff --git a/components/style/gecko_bindings/sugar/ns_com_ptr.rs b/components/style/gecko_bindings/sugar/ns_com_ptr.rs index 10f76046476..1c54541bd80 100644 --- a/components/style/gecko_bindings/sugar/ns_com_ptr.rs +++ b/components/style/gecko_bindings/sugar/ns_com_ptr.rs @@ -6,20 +6,10 @@ use crate::gecko_bindings::structs::nsCOMPtr; -#[cfg(feature = "gecko_debug")] impl nsCOMPtr { /// Get this pointer as a raw pointer. #[inline] - pub fn raw(&self) -> *mut T { + pub fn raw(&self) -> *mut T { self.mRawPtr } } - -#[cfg(not(feature = "gecko_debug"))] -impl nsCOMPtr { - /// Get this pointer as a raw pointer. - #[inline] - pub fn raw(&self) -> *mut T { - self._base.mRawPtr as *mut _ - } -} diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index 34c8403fc7d..d2d6252ac91 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -225,15 +225,11 @@ impl fmt::Debug for UrlExtraData { .field("chrome_rules_enabled", &self.chrome_rules_enabled()) .field( "base", - &DebugURI(self.as_ref().mBaseURI.raw::()), + &DebugURI(self.as_ref().mBaseURI.raw()), ) .field( "referrer", - &DebugReferrerInfo( - self.as_ref() - .mReferrerInfo - .raw::(), - ), + &DebugReferrerInfo(self.as_ref().mReferrerInfo.raw()), ) .finish() }