Bug 1474793 - Part 10.3: Add ToShmem impl for Atom. r=emilio

Depends on D17191

Differential Revision: https://phabricator.services.mozilla.com/D17192

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Cameron McCormack 2019-03-30 00:16:15 +00:00
parent d46b90bcd7
commit 25e28640fe

View File

@ -25,9 +25,11 @@ use std::char::{self, DecodeUtf16};
use std::fmt::{self, Write};
use std::hash::{Hash, Hasher};
use std::iter::Cloned;
use std::mem::{self, ManuallyDrop};
use std::ops::Deref;
use std::{mem, slice, str};
use std::{slice, str};
use style_traits::SpecifiedValueInfo;
use to_shmem::{SharedMemoryBuilder, ToShmem};
#[macro_use]
#[allow(improper_ctypes, non_camel_case_types, missing_docs)]
@ -122,6 +124,14 @@ impl Borrow<WeakAtom> for Atom {
}
}
impl ToShmem for Atom {
fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> ManuallyDrop<Self> {
assert!(self.is_static(), "ToShmem failed for Atom: must be a static atom: {}", self);
ManuallyDrop::new(Atom(self.0))
}
}
impl Eq for WeakAtom {}
impl PartialEq for WeakAtom {
#[inline]