aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/gecko_string_cache/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/style/gecko_string_cache/mod.rs b/components/style/gecko_string_cache/mod.rs
index 1c44df4eb17..587c2329d96 100644
--- a/components/style/gecko_string_cache/mod.rs
+++ b/components/style/gecko_string_cache/mod.rs
@@ -198,6 +198,16 @@ impl Atom {
"Called from_static for a non-static atom!");
atom
}
+
+ /// Creates an atom from a dynamic atom pointer that has already had AddRef
+ /// called on it.
+ #[inline]
+ pub unsafe fn from_addrefed(ptr: *mut nsIAtom) -> Self {
+ debug_assert!(!ptr.is_null());
+ unsafe {
+ Atom(WeakAtom::new(ptr))
+ }
+ }
}
impl Hash for Atom {