mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -694,7 +694,7 @@ impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
|
||||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||||
|
|
||||||
let pdb = PropertyDeclarationBlock::with_one(
|
let pdb = PropertyDeclarationBlock::with_one(
|
||||||
PropertyDeclaration::XLang(SpecifiedLang(Atom::from(ptr))),
|
PropertyDeclaration::XLang(SpecifiedLang(unsafe { Atom::from_addrefed(ptr) })),
|
||||||
Importance::Normal
|
Importance::Normal
|
||||||
);
|
);
|
||||||
let arc = Arc::new(global_style_data.shared_lock.wrap(pdb));
|
let arc = Arc::new(global_style_data.shared_lock.wrap(pdb));
|
||||||
|
|
|
@ -197,6 +197,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