aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko_string_cache/mod.rs
diff options
context:
space:
mode:
authorCameron McCormack <cam@mcc.id.au>2017-04-05 16:54:51 +0800
committerCameron McCormack <cam@mcc.id.au>2017-04-05 17:39:26 +0800
commitf3dcef8c8176ba3d76f0816cbbcb43eb8a58fdd9 (patch)
treed0a53633d86a23441c865464380b696793b49af3 /components/style/gecko_string_cache/mod.rs
parent1071c3339fd858014382b4e9938584279555b5ec (diff)
downloadservo-f3dcef8c8176ba3d76f0816cbbcb43eb8a58fdd9.tar.gz
servo-f3dcef8c8176ba3d76f0816cbbcb43eb8a58fdd9.zip
style: Add an Atom::from_addrefed function.
Diffstat (limited to 'components/style/gecko_string_cache/mod.rs')
-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 {