aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko_string_cache
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2020-11-22 01:02:22 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2021-02-26 16:44:05 +0100
commit9f40b9ba38a531088c2117b955f40af6ea0d09c8 (patch)
treee221662df58ec16b2c2027d71fd5df015fe3f526 /components/style/gecko_string_cache
parent4ea378a6ae232af09135b2037c527466ef5454de (diff)
downloadservo-9f40b9ba38a531088c2117b955f40af6ea0d09c8.tar.gz
servo-9f40b9ba38a531088c2117b955f40af6ea0d09c8.zip
style: Avoid some allocations in selector serialization.
The allocations in display_to_css_identifier show up in the profiles of bug 1675628. Differential Revision: https://phabricator.services.mozilla.com/D97856
Diffstat (limited to 'components/style/gecko_string_cache')
-rw-r--r--components/style/gecko_string_cache/mod.rs6
-rw-r--r--components/style/gecko_string_cache/namespace.rs11
2 files changed, 1 insertions, 16 deletions
diff --git a/components/style/gecko_string_cache/mod.rs b/components/style/gecko_string_cache/mod.rs
index e9208a5e32e..a6cf017877d 100644
--- a/components/style/gecko_string_cache/mod.rs
+++ b/components/style/gecko_string_cache/mod.rs
@@ -42,12 +42,6 @@ pub mod namespace;
pub use self::namespace::{Namespace, WeakNamespace};
-macro_rules! local_name {
- ($s:tt) => {
- atom!($s)
- };
-}
-
/// A handle to a Gecko atom. This is a type that can represent either:
///
/// * A strong reference to a dynamic atom (an `nsAtom` pointer), in which case
diff --git a/components/style/gecko_string_cache/namespace.rs b/components/style/gecko_string_cache/namespace.rs
index 72de229f1d7..1acf04c93ff 100644
--- a/components/style/gecko_string_cache/namespace.rs
+++ b/components/style/gecko_string_cache/namespace.rs
@@ -47,18 +47,9 @@ impl PrecomputedHash for Namespace {
}
/// A Gecko WeakNamespace is a wrapped WeakAtom.
-#[derive(Hash)]
+#[derive(Hash, Deref)]
pub struct WeakNamespace(WeakAtom);
-impl Deref for WeakNamespace {
- type Target = WeakAtom;
-
- #[inline]
- fn deref(&self) -> &WeakAtom {
- &self.0
- }
-}
-
impl Deref for Namespace {
type Target = WeakNamespace;