/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::os::raw::c_void; use malloc_size_of::MallocSizeOfOps; use crate::codegen::Globals::Globals; use crate::codegen::InheritTypes::TopTypeId; use crate::codegen::PrototypeList::{self, MAX_PROTO_CHAIN_LENGTH}; /// The struct that holds inheritance information for DOM object reflectors. #[derive(Clone, Copy)] pub struct DOMClass { /// A list of interfaces that this object implements, in order of decreasing /// derivedness. pub interface_chain: [PrototypeList::ID; MAX_PROTO_CHAIN_LENGTH], /// The last valid index of `interface_chain`. pub depth: u8, /// The type ID of that interface. pub type_id: TopTypeId, /// The MallocSizeOf function wrapper for that interface. pub malloc_size_of: unsafe fn(ops: &mut MallocSizeOfOps, *const c_void) -> usize, /// The `Globals` flag for this global interface, if any. pub global: Globals, } unsafe impl Sync for DOMClass {} /// The JSClass used for DOM object reflectors. #[derive(Copy)] #[repr(C)] pub struct DOMJSClass { /// The actual JSClass. pub base: js::jsapi::JSClass, /// Associated data for DOM object reflectors. pub dom_class: DOMClass, } impl Clone for DOMJSClass { fn clone(&self) -> DOMJSClass { *self } } unsafe impl Sync for DOMJSClass {}