diff options
author | Cameron McCormack <cam@mcc.id.au> | 2019-03-30 00:16:15 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-04-12 12:19:48 +0200 |
commit | 8c007ad9990ec70a6f86bed85ef8592f9f726a0b (patch) | |
tree | e6ca85ee43cd84d673adb1935401f127e0665557 /components/style/gecko_string_cache/mod.rs | |
parent | 48718b876c8e5ec888eef16edabba216c6b4e66b (diff) | |
download | servo-8c007ad9990ec70a6f86bed85ef8592f9f726a0b.tar.gz servo-8c007ad9990ec70a6f86bed85ef8592f9f726a0b.zip |
style: Add ToShmem impl for Atom.
Differential Revision: https://phabricator.services.mozilla.com/D17192
Diffstat (limited to 'components/style/gecko_string_cache/mod.rs')
-rw-r--r-- | components/style/gecko_string_cache/mod.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/components/style/gecko_string_cache/mod.rs b/components/style/gecko_string_cache/mod.rs index 9c33f25d9b8..f4c875cb7ad 100644 --- a/components/style/gecko_string_cache/mod.rs +++ b/components/style/gecko_string_cache/mod.rs @@ -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] |