mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #16269 - heycam:atom-already-addrefed, r=upsuper
Add an Atom::from_addrefed function. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16269) <!-- Reviewable:end -->
This commit is contained in:
commit
a55cb8425d
2 changed files with 11 additions and 1 deletions
|
@ -197,6 +197,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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue