зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #16269 - Add an Atom::from_addrefed function (from heycam:atom-already-addrefed); r=upsuper
Source-Repo: https://github.com/servo/servo Source-Revision: a55cb8425dc41fc6909047841c985a4ede3fa8f9 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 3c10fda187ecc29117d9f10c6d1469a4ceca3522
This commit is contained in:
Родитель
87c97997a4
Коммит
389420752d
|
@ -694,7 +694,7 @@ impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
|
|||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
|
||||
let pdb = PropertyDeclarationBlock::with_one(
|
||||
PropertyDeclaration::XLang(SpecifiedLang(Atom::from(ptr))),
|
||||
PropertyDeclaration::XLang(SpecifiedLang(unsafe { Atom::from_addrefed(ptr) })),
|
||||
Importance::Normal
|
||||
);
|
||||
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!");
|
||||
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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче