mirror of
https://github.com/servo/servo.git
synced 2025-07-30 02:30:21 +01:00
style: Add an Atom::from_addrefed function.
This commit is contained in:
parent
1071c3339f
commit
f3dcef8c81
1 changed files with 10 additions and 0 deletions
|
@ -198,6 +198,16 @@ impl Atom {
|
||||||
"Called from_static for a non-static atom!");
|
"Called from_static for a non-static atom!");
|
||||||
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 {
|
impl Hash for Atom {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue