Skip to content

Commit

Permalink
style: Add an Atom::from_addrefed function.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam committed Apr 5, 2017
1 parent 1071c33 commit f3dcef8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/style/gecko_string_cache/mod.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit f3dcef8

Please sign in to comment.