mirror of
https://github.com/servo/servo.git
synced 2025-06-17 21:04:28 +00:00
* script: Move DOMClass to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move DOMJSClass and get_dom_class to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move Castable/DerivedFrom/IDLInterface to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
48 lines
1.5 KiB
Rust
48 lines
1.5 KiB
Rust
/* 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 {}
|