style: Make the counters non-atomic counters and merge afterwards.

This was consistently faster in the benchmark (even when counters were disabled,
which was slightly suspicious, but...).

Anyway, it's not really much code, most of it is FFI copy-pasta.

Differential Revision: https://phabricator.services.mozilla.com/D3874
This commit is contained in:
Emilio Cobos Álvarez 2018-08-21 12:31:11 +02:00
parent 4f04988c13
commit 86b4b70369
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 45 additions and 11 deletions

View file

@ -305,6 +305,15 @@ pub struct OwnedOrNull<GeckoType> {
}
impl<GeckoType> OwnedOrNull<GeckoType> {
/// Returns a null pointer.
#[inline]
pub fn null() -> Self {
Self {
ptr: ptr::null_mut(),
_marker: PhantomData,
}
}
/// Returns whether this pointer is null.
#[inline]
pub fn is_null(&self) -> bool {