mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Replace all uses of the heapsize
crate with malloc_size_of
.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.
This commit is contained in:
parent
421baa854e
commit
4506f0d30c
269 changed files with 1418 additions and 1521 deletions
|
@ -11,7 +11,7 @@ use style::thread_state;
|
|||
///
|
||||
/// This extends the API of `std::cell::RefCell` to allow unsafe access in
|
||||
/// certain situations, with dynamic checking in debug builds.
|
||||
#[derive(Clone, Debug, Default, HeapSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq)]
|
||||
pub struct DomRefCell<T> {
|
||||
value: RefCell<T>,
|
||||
}
|
||||
|
|
|
@ -2029,7 +2029,7 @@ def DOMClass(descriptor):
|
|||
# padding.
|
||||
protoList.extend(['PrototypeList::ID::Last'] * (descriptor.config.maxProtoChainLength - len(protoList)))
|
||||
prototypeChainString = ', '.join(protoList)
|
||||
heapSizeOf = 'heap_size_of_raw_self_and_children::<%s>' % descriptor.concreteType
|
||||
mallocSizeOf = 'malloc_size_of_including_raw_self::<%s>' % descriptor.concreteType
|
||||
if descriptor.isGlobal():
|
||||
globals_ = camel_to_upper_snake(descriptor.name)
|
||||
else:
|
||||
|
@ -2038,9 +2038,9 @@ def DOMClass(descriptor):
|
|||
DOMClass {
|
||||
interface_chain: [ %s ],
|
||||
type_id: %s,
|
||||
heap_size_of: %s as unsafe fn(_) -> _,
|
||||
malloc_size_of: %s as unsafe fn(&mut _, _) -> _,
|
||||
global: InterfaceObjectMap::%s,
|
||||
}""" % (prototypeChainString, DOMClassTypeId(descriptor), heapSizeOf, globals_)
|
||||
}""" % (prototypeChainString, DOMClassTypeId(descriptor), mallocSizeOf, globals_)
|
||||
|
||||
|
||||
class CGDOMJSClass(CGThing):
|
||||
|
@ -4005,7 +4005,7 @@ class CGEnum(CGThing):
|
|||
ident = enum.identifier.name
|
||||
decl = """\
|
||||
#[repr(usize)]
|
||||
#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf, Debug)]
|
||||
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum %s {
|
||||
%s
|
||||
}
|
||||
|
@ -5794,7 +5794,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
|||
'dom::bindings::weakref::WeakReferenceable',
|
||||
'dom::windowproxy::WindowProxy',
|
||||
'dom::globalscope::GlobalScope',
|
||||
'mem::heap_size_of_raw_self_and_children',
|
||||
'mem::malloc_size_of_including_raw_self',
|
||||
'libc',
|
||||
'servo_config::prefs::PREFS',
|
||||
'std::borrow::ToOwned',
|
||||
|
|
|
@ -25,7 +25,7 @@ use libc::c_uint;
|
|||
use std::slice::from_raw_parts;
|
||||
|
||||
/// DOM exceptions that can be thrown by a native DOM method.
|
||||
#[derive(Clone, Debug, HeapSizeOf)]
|
||||
#[derive(Clone, Debug, MallocSizeOf)]
|
||||
pub enum Error {
|
||||
/// IndexSizeError DOMException
|
||||
IndexSize,
|
||||
|
|
|
@ -22,7 +22,7 @@ use std::cell::Cell;
|
|||
use std::ptr;
|
||||
|
||||
/// The values that an iterator will iterate over.
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub enum IteratorType {
|
||||
/// The keys of the iterable object.
|
||||
Keys,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! The `Finite<T>` struct.
|
||||
|
||||
use heapsize::HeapSizeOf;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use num_traits::Float;
|
||||
use std::default::Default;
|
||||
use std::ops::Deref;
|
||||
|
@ -41,9 +41,9 @@ impl<T: Float> Deref for Finite<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Float + HeapSizeOf> HeapSizeOf for Finite<T> {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
(**self).heap_size_of_children()
|
||||
impl<T: Float + MallocSizeOf> MallocSizeOf for Finite<T> {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
(**self).size_of(ops)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ pub fn reflect_dom_object<T, U>(
|
|||
|
||||
/// A struct to store a reference to the reflector of a DOM object.
|
||||
#[allow(unrooted_must_root)]
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
#[must_root]
|
||||
// If you're renaming or moving this field, update the path in plugins::reflector as well
|
||||
pub struct Reflector {
|
||||
#[ignore_heap_size_of = "defined and measured in rust-mozjs"]
|
||||
#[ignore_malloc_size_of = "defined and measured in rust-mozjs"]
|
||||
object: Heap<*mut JSObject>,
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ use dom::bindings::reflector::{DomObject, Reflector};
|
|||
use dom::bindings::trace::JSTraceable;
|
||||
use dom::bindings::trace::trace_reflector;
|
||||
use dom::node::Node;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::{JSObject, JSTracer, Heap};
|
||||
use js::rust::GCMethods;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use mitochondria::OnceCell;
|
||||
use nonzero::NonZero;
|
||||
use script_layout_interface::TrustedNodeAddress;
|
||||
|
@ -157,12 +157,12 @@ impl<T: DomObject> DomRoot<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> HeapSizeOf for DomRoot<T>
|
||||
impl<T> MallocSizeOf for DomRoot<T>
|
||||
where
|
||||
T: DomObject + HeapSizeOf,
|
||||
T: DomObject + MallocSizeOf,
|
||||
{
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
(**self).heap_size_of_children()
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
(**self).size_of(ops)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,8 +317,8 @@ pub struct Dom<T> {
|
|||
|
||||
// Dom<T> is similar to Rc<T>, in that it's not always clear how to avoid double-counting.
|
||||
// For now, we choose not to follow any such pointers.
|
||||
impl<T> HeapSizeOf for Dom<T> {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
impl<T> MallocSizeOf for Dom<T> {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
@ -516,9 +516,9 @@ impl<T: DomObject> MutDom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: DomObject> HeapSizeOf for MutDom<T> {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
// See comment on HeapSizeOf for Dom<T>.
|
||||
impl<T: DomObject> MallocSizeOf for MutDom<T> {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
// See comment on MallocSizeOf for Dom<T>.
|
||||
0
|
||||
}
|
||||
}
|
||||
|
@ -635,9 +635,9 @@ impl<T: DomObject> Default for MutNullableDom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: DomObject> HeapSizeOf for MutNullableDom<T> {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
// See comment on HeapSizeOf for Dom<T>.
|
||||
impl<T: DomObject> MallocSizeOf for MutNullableDom<T> {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
// See comment on MallocSizeOf for Dom<T>.
|
||||
0
|
||||
}
|
||||
}
|
||||
|
@ -678,9 +678,9 @@ impl<T: DomObject> Default for DomOnceCell<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: DomObject> HeapSizeOf for DomOnceCell<T> {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
// See comment on HeapSizeOf for Dom<T>.
|
||||
impl<T: DomObject> MallocSizeOf for DomOnceCell<T> {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
// See comment on MallocSizeOf for Dom<T>.
|
||||
0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::str;
|
|||
use std::str::{Bytes, FromStr};
|
||||
|
||||
/// Encapsulates the IDL `ByteString` type.
|
||||
#[derive(Clone, Debug, Default, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, Eq, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub struct ByteString(Vec<u8>);
|
||||
|
||||
impl ByteString {
|
||||
|
@ -78,7 +78,7 @@ impl ops::Deref for ByteString {
|
|||
|
||||
/// A string that is constructed from a UCS-2 buffer by replacing invalid code
|
||||
/// points with the replacement character.
|
||||
#[derive(Clone, Default, HeapSizeOf)]
|
||||
#[derive(Clone, Default, MallocSizeOf)]
|
||||
pub struct USVString(pub String);
|
||||
|
||||
|
||||
|
@ -153,7 +153,7 @@ pub fn is_token(s: &[u8]) -> bool {
|
|||
///
|
||||
/// This type is currently `!Send`, in order to help with an independent
|
||||
/// experiment to store `JSString`s rather than Rust `String`s.
|
||||
#[derive(Clone, Debug, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd)]
|
||||
pub struct DOMString(String, PhantomData<*const ()>);
|
||||
|
||||
impl DOMString {
|
||||
|
|
|
@ -13,7 +13,6 @@ use dom::bindings::inheritance::TopTypeId;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::bindings::trace::trace_object;
|
||||
use dom::windowproxy;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js;
|
||||
use js::JS_CALLEE;
|
||||
use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
|
||||
|
@ -32,6 +31,7 @@ use js::jsapi::{JS_StringHasLatin1Chars, MutableHandleValue, ObjectOpResult};
|
|||
use js::jsval::{JSVal, UndefinedValue};
|
||||
use js::rust::{GCMethods, ToString, get_object_class, is_dom_class};
|
||||
use libc;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use std::ptr;
|
||||
|
@ -40,14 +40,14 @@ use std::slice;
|
|||
/// Proxy handler for a WindowProxy.
|
||||
pub struct WindowProxyHandler(pub *const libc::c_void);
|
||||
|
||||
impl HeapSizeOf for WindowProxyHandler {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
impl MallocSizeOf for WindowProxyHandler {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
// FIXME(#6907) this is a pointer to memory allocated by `new` in NewProxyHandler in rust-mozjs.
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
/// Static data associated with a global object.
|
||||
pub struct GlobalStaticData {
|
||||
/// The WindowProxy proxy handler for this global.
|
||||
|
@ -88,8 +88,8 @@ pub struct DOMClass {
|
|||
/// The type ID of that interface.
|
||||
pub type_id: TopTypeId,
|
||||
|
||||
/// The HeapSizeOf function wrapper for that interface.
|
||||
pub heap_size_of: unsafe fn(*const c_void) -> usize,
|
||||
/// 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: InterfaceObjectMap::Globals,
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
use dom::bindings::reflector::DomObject;
|
||||
use dom::bindings::root::DomRoot;
|
||||
use dom::bindings::trace::JSTraceable;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
|
||||
use js::jsval::PrivateValue;
|
||||
use libc::c_void;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use nonzero::NonZero;
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
use std::mem;
|
||||
|
@ -110,8 +110,8 @@ impl<T: WeakReferenceable> Clone for WeakRef<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: WeakReferenceable> HeapSizeOf for WeakRef<T> {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
impl<T: WeakReferenceable> MallocSizeOf for WeakRef<T> {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ impl<T: WeakReferenceable> MutableWeakRef<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: WeakReferenceable> HeapSizeOf for MutableWeakRef<T> {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
impl<T: WeakReferenceable> MallocSizeOf for MutableWeakRef<T> {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
|
|||
/// A vector of weak references. On tracing, the vector retains
|
||||
/// only references which still point to live objects.
|
||||
#[allow_unrooted_interior]
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct WeakRefVec<T: WeakReferenceable> {
|
||||
vec: Vec<WeakRef<T>>,
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ impl BlobImpl {
|
|||
#[dom_struct]
|
||||
pub struct Blob {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "No clear owner"]
|
||||
#[ignore_malloc_size_of = "No clear owner"]
|
||||
blob_impl: DomRefCell<BlobImpl>,
|
||||
/// content-type string
|
||||
type_string: String,
|
||||
|
|
|
@ -56,13 +56,13 @@ const OPTIONS_ERROR: &'static str = "Fields of 'options' conflict with each othe
|
|||
Either 'acceptAllDevices' member must be true, or 'filters' member must be set to a value.";
|
||||
const BT_DESC_CONVERSION_ERROR: &'static str = "Can't convert to an IDL value of type BluetoothPermissionDescriptor";
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct AllowedBluetoothDevice {
|
||||
pub deviceId: DOMString,
|
||||
pub mayUseGATT: bool,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct BluetoothExtraPermissionData {
|
||||
allowed_devices: DomRefCell<Vec<AllowedBluetoothDevice>>,
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ pub struct CanvasGradient {
|
|||
stops: DomRefCell<Vec<CanvasGradientStop>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub enum CanvasGradientStyle {
|
||||
Linear(LinearGradientStyle),
|
||||
Radial(RadialGradientStyle),
|
||||
|
|
|
@ -51,7 +51,7 @@ use std::sync::Arc;
|
|||
use unpremultiplytable::UNPREMULTIPLY_TABLE;
|
||||
|
||||
#[must_root]
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
#[allow(dead_code)]
|
||||
enum CanvasFillOrStrokeStyle {
|
||||
Color(RGBA),
|
||||
|
@ -63,12 +63,12 @@ enum CanvasFillOrStrokeStyle {
|
|||
#[dom_struct]
|
||||
pub struct CanvasRenderingContext2D {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
#[ignore_malloc_size_of = "Defined in ipc-channel"]
|
||||
ipc_renderer: IpcSender<CanvasMsg>,
|
||||
/// For rendering contexts created by an HTML canvas element, this is Some,
|
||||
/// for ones created by a paint worklet, this is None.
|
||||
canvas: Option<Dom<HTMLCanvasElement>>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
image_cache: Arc<ImageCache>,
|
||||
/// Any missing image URLs.
|
||||
missing_image_urls: DomRefCell<Vec<ServoUrl>>,
|
||||
|
@ -81,7 +81,7 @@ pub struct CanvasRenderingContext2D {
|
|||
}
|
||||
|
||||
#[must_root]
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
struct CanvasContextState {
|
||||
global_alpha: f64,
|
||||
global_composition: CompositionOrBlending,
|
||||
|
|
|
@ -20,7 +20,7 @@ pub struct Client {
|
|||
active_worker: MutNullableDom<ServiceWorker>,
|
||||
url: ServoUrl,
|
||||
frame_type: FrameType,
|
||||
#[ignore_heap_size_of = "Defined in uuid"]
|
||||
#[ignore_malloc_size_of = "Defined in uuid"]
|
||||
id: Uuid
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ unsafe_no_jsmanaged_fields!(ServoRng);
|
|||
#[dom_struct]
|
||||
pub struct Crypto {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in rand"]
|
||||
#[ignore_malloc_size_of = "Defined in rand"]
|
||||
rng: DomRefCell<ServoRng>,
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ use style::stylesheets::FontFaceRule;
|
|||
#[dom_struct]
|
||||
pub struct CSSFontFaceRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
fontfacerule: Arc<Locked<FontFaceRule>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use style::stylesheets::CssRules as StyleCssRules;
|
|||
#[dom_struct]
|
||||
pub struct CSSGroupingRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
rules: Arc<Locked<StyleCssRules>>,
|
||||
rulelist: MutNullableDom<CSSRuleList>,
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ use style::stylesheets::ImportRule;
|
|||
#[dom_struct]
|
||||
pub struct CSSImportRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
import_rule: Arc<Locked<ImportRule>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use style::stylesheets::keyframes_rule::Keyframe;
|
|||
#[dom_struct]
|
||||
pub struct CSSKeyframeRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
keyframerule: Arc<Locked<Keyframe>>,
|
||||
style_decl: MutNullableDom<CSSStyleDeclaration>,
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ use style::values::KeyframesName;
|
|||
#[dom_struct]
|
||||
pub struct CSSKeyframesRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
keyframesrule: Arc<Locked<KeyframesRule>>,
|
||||
rulelist: MutNullableDom<CSSRuleList>,
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
|||
#[dom_struct]
|
||||
pub struct CSSMediaRule {
|
||||
cssconditionrule: CSSConditionRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
mediarule: Arc<Locked<MediaRule>>,
|
||||
medialist: MutNullableDom<MediaList>,
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use style::stylesheets::NamespaceRule;
|
|||
#[dom_struct]
|
||||
pub struct CSSNamespaceRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
namespacerule: Arc<Locked<NamespaceRule>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ impl From<RulesMutateError> for Error {
|
|||
pub struct CSSRuleList {
|
||||
reflector_: Reflector,
|
||||
parent_stylesheet: Dom<CSSStyleSheet>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
rules: RulesSource,
|
||||
dom_rules: DomRefCell<Vec<MutNullableDom<CSSRule>>>
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ pub struct CSSStyleDeclaration {
|
|||
pseudo: Option<PseudoElement>,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub enum CSSStyleOwner {
|
||||
Element(Dom<Element>),
|
||||
CSSRule(Dom<CSSRule>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
Arc<Locked<PropertyDeclarationBlock>>),
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ impl CSSStyleOwner {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, PartialEq)]
|
||||
#[derive(MallocSizeOf, PartialEq)]
|
||||
pub enum CSSModificationAccess {
|
||||
ReadWrite,
|
||||
Readonly,
|
||||
|
|
|
@ -25,7 +25,7 @@ use style::stylesheets::{StyleRule, Origin};
|
|||
#[dom_struct]
|
||||
pub struct CSSStyleRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
stylerule: Arc<Locked<StyleRule>>,
|
||||
style_decl: MutNullableDom<CSSStyleDeclaration>,
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ pub struct CSSStyleSheet {
|
|||
stylesheet: StyleSheet,
|
||||
owner: Dom<Element>,
|
||||
rulelist: MutNullableDom<CSSRuleList>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
style_stylesheet: Arc<StyleStyleSheet>,
|
||||
origin_clean: Cell<bool>,
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
|||
#[dom_struct]
|
||||
pub struct CSSSupportsRule {
|
||||
cssconditionrule: CSSConditionRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
supportsrule: Arc<Locked<SupportsRule>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ use style::stylesheets::ViewportRule;
|
|||
#[dom_struct]
|
||||
pub struct CSSViewportRule {
|
||||
cssrule: CSSRule,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
viewportrule: Arc<Locked<ViewportRule>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -47,12 +47,12 @@ pub struct CustomElementRegistry {
|
|||
|
||||
window: Dom<Window>,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
when_defined: DomRefCell<HashMap<LocalName, Rc<Promise>>>,
|
||||
|
||||
element_definition_is_running: Cell<bool>,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
definitions: DomRefCell<HashMap<LocalName, Rc<CustomElementDefinition>>>,
|
||||
}
|
||||
|
||||
|
@ -369,35 +369,35 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub struct LifecycleCallbacks {
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
connected_callback: Option<Rc<Function>>,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
disconnected_callback: Option<Rc<Function>>,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
adopted_callback: Option<Rc<Function>>,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
attribute_changed_callback: Option<Rc<Function>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub enum ConstructionStackEntry {
|
||||
Element(DomRoot<Element>),
|
||||
AlreadyConstructedMarker,
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-definition>
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub struct CustomElementDefinition {
|
||||
pub name: LocalName,
|
||||
|
||||
pub local_name: LocalName,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
pub constructor: Rc<Function>,
|
||||
|
||||
pub observed_attributes: Vec<DOMString>,
|
||||
|
@ -580,15 +580,15 @@ pub fn try_upgrade_element(element: &Element) {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub enum CustomElementReaction {
|
||||
Upgrade(
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
Rc<CustomElementDefinition>
|
||||
),
|
||||
Callback(
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
Rc<Function>,
|
||||
Box<[Heap<JSVal>]>
|
||||
),
|
||||
|
@ -617,14 +617,14 @@ pub enum CallbackReaction {
|
|||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue>
|
||||
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
enum BackupElementQueueFlag {
|
||||
Processing,
|
||||
NotProcessing,
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub struct CustomElementReactionStack {
|
||||
stack: DomRefCell<Vec<ElementQueue>>,
|
||||
|
@ -773,7 +773,7 @@ impl CustomElementReactionStack {
|
|||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#element-queue>
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
struct ElementQueue {
|
||||
queue: DomRefCell<VecDeque<Dom<Element>>>,
|
||||
|
|
|
@ -22,7 +22,7 @@ use servo_atoms::Atom;
|
|||
#[dom_struct]
|
||||
pub struct CustomEvent {
|
||||
event: Event,
|
||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
|
||||
detail: Heap<JSVal>,
|
||||
}
|
||||
|
||||
|
|
|
@ -80,15 +80,15 @@ enum MixedMessage {
|
|||
#[dom_struct]
|
||||
pub struct DedicatedWorkerGlobalScope {
|
||||
workerglobalscope: WorkerGlobalScope,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>,
|
||||
#[ignore_heap_size_of = "Trusted<T> has unclear ownership like Dom<T>"]
|
||||
#[ignore_malloc_size_of = "Trusted<T> has unclear ownership like Dom<T>"]
|
||||
worker: DomRefCell<Option<TrustedWorkerAddress>>,
|
||||
#[ignore_heap_size_of = "Can't measure trait objects"]
|
||||
#[ignore_malloc_size_of = "Can't measure trait objects"]
|
||||
/// Sender to the parent thread.
|
||||
parent_sender: Box<ScriptChan + Send>,
|
||||
}
|
||||
|
|
|
@ -158,13 +158,13 @@ pub enum TouchEventResult {
|
|||
Forwarded,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum IsHTMLDocument {
|
||||
HTMLDocument,
|
||||
NonHTMLDocument,
|
||||
}
|
||||
|
||||
#[derive(Debug, HeapSizeOf)]
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
pub struct PendingRestyle {
|
||||
/// If this element had a state or attribute change since the last restyle, track
|
||||
/// the original condition of the element.
|
||||
|
@ -187,10 +187,10 @@ impl PendingRestyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
struct StyleSheetInDocument {
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
sheet: Arc<Stylesheet>,
|
||||
owner: Dom<Element>,
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ pub struct Document {
|
|||
is_html_document: bool,
|
||||
activity: Cell<DocumentActivity>,
|
||||
url: DomRefCell<ServoUrl>,
|
||||
#[ignore_heap_size_of = "defined in selectors"]
|
||||
#[ignore_malloc_size_of = "defined in selectors"]
|
||||
quirks_mode: Cell<QuirksMode>,
|
||||
/// Caches for the getElement methods
|
||||
id_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>,
|
||||
|
@ -321,7 +321,7 @@ pub struct Document {
|
|||
/// <https://html.spec.whatwg.org/multipage/#target-element>
|
||||
target_element: MutNullableDom<Element>,
|
||||
/// <https://w3c.github.io/uievents/#event-type-dblclick>
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
|
||||
/// <https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter>
|
||||
ignore_destructive_writes_counter: Cell<u32>,
|
||||
|
@ -346,7 +346,7 @@ pub struct Document {
|
|||
form_id_listener_map: DomRefCell<HashMap<Atom, HashSet<Dom<Element>>>>,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct ImagesFilter;
|
||||
impl CollectionFilter for ImagesFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -354,7 +354,7 @@ impl CollectionFilter for ImagesFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct EmbedsFilter;
|
||||
impl CollectionFilter for EmbedsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -362,7 +362,7 @@ impl CollectionFilter for EmbedsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct LinksFilter;
|
||||
impl CollectionFilter for LinksFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -371,7 +371,7 @@ impl CollectionFilter for LinksFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct FormsFilter;
|
||||
impl CollectionFilter for FormsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -379,7 +379,7 @@ impl CollectionFilter for FormsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct ScriptsFilter;
|
||||
impl CollectionFilter for ScriptsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -387,7 +387,7 @@ impl CollectionFilter for ScriptsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct AnchorsFilter;
|
||||
impl CollectionFilter for AnchorsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -395,7 +395,7 @@ impl CollectionFilter for AnchorsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct AppletsFilter;
|
||||
impl CollectionFilter for AppletsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -1978,7 +1978,7 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, PartialEq)]
|
||||
#[derive(MallocSizeOf, PartialEq)]
|
||||
pub enum DocumentSource {
|
||||
FromParser,
|
||||
NotFromParser,
|
||||
|
@ -2092,7 +2092,7 @@ fn url_has_network_scheme(url: &ServoUrl) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum HasBrowsingContext {
|
||||
No,
|
||||
Yes,
|
||||
|
@ -3470,7 +3470,7 @@ impl DocumentMethods for Document {
|
|||
#[allow(unsafe_code)]
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
||||
unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct NamedElementFilter {
|
||||
name: Atom,
|
||||
}
|
||||
|
@ -3945,10 +3945,10 @@ pub enum FocusEventType {
|
|||
/// If the page is observed to be using `requestAnimationFrame()` for non-animation purposes (i.e.
|
||||
/// without mutating the DOM), then we fall back to simple timeouts to save energy over video
|
||||
/// refresh.
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct FakeRequestAnimationFrameCallback {
|
||||
/// The document.
|
||||
#[ignore_heap_size_of = "non-owning"]
|
||||
#[ignore_malloc_size_of = "non-owning"]
|
||||
document: Trusted<Document>,
|
||||
}
|
||||
|
||||
|
@ -3959,11 +3959,11 @@ impl FakeRequestAnimationFrameCallback {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub enum AnimationFrameCallback {
|
||||
DevtoolsFramerateTick { actor_name: String },
|
||||
FrameRequestCallback {
|
||||
#[ignore_heap_size_of = "Rc is hard"]
|
||||
#[ignore_malloc_size_of = "Rc is hard"]
|
||||
callback: Rc<FrameRequestCallback>
|
||||
},
|
||||
}
|
||||
|
@ -3985,7 +3985,7 @@ impl AnimationFrameCallback {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Default, JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
struct PendingInOrderScriptVec {
|
||||
scripts: DomRefCell<VecDeque<PendingScript>>,
|
||||
|
@ -4021,7 +4021,7 @@ impl PendingInOrderScriptVec {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
struct PendingScript {
|
||||
element: Dom<HTMLScriptElement>,
|
||||
|
|
|
@ -12,7 +12,7 @@ use dom::globalscope::GlobalScope;
|
|||
use dom_struct::dom_struct;
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf)]
|
||||
pub enum DOMErrorName {
|
||||
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
|
||||
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,
|
||||
|
|
|
@ -140,7 +140,7 @@ pub struct Element {
|
|||
attrs: DomRefCell<Vec<Dom<Attr>>>,
|
||||
id_attribute: DomRefCell<Option<Atom>>,
|
||||
is: DomRefCell<Option<LocalName>>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
style_attribute: DomRefCell<Option<Arc<Locked<PropertyDeclarationBlock>>>>,
|
||||
attr_list: MutNullableDom<NamedNodeMap>,
|
||||
class_list: MutNullableDom<DOMTokenList>,
|
||||
|
@ -149,12 +149,12 @@ pub struct Element {
|
|||
/// operations may require restyling this element or its descendants. The
|
||||
/// flags are not atomic, so the style system takes care of only set them
|
||||
/// when it has exclusive access to the element.
|
||||
#[ignore_heap_size_of = "bitflags defined in rust-selectors"]
|
||||
#[ignore_malloc_size_of = "bitflags defined in rust-selectors"]
|
||||
selector_flags: Cell<ElementSelectorFlags>,
|
||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
|
||||
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-definition>
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||
custom_element_state: Cell<CustomElementState>,
|
||||
|
@ -176,7 +176,7 @@ impl fmt::Debug for DomRoot<Element> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, PartialEq)]
|
||||
#[derive(MallocSizeOf, PartialEq)]
|
||||
pub enum ElementCreator {
|
||||
ParserCreated(u64),
|
||||
ScriptCreated,
|
||||
|
@ -188,7 +188,7 @@ pub enum CustomElementCreationMode {
|
|||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum CustomElementState {
|
||||
Undefined,
|
||||
Failed,
|
||||
|
@ -3025,7 +3025,7 @@ impl<'a> AttributeMutation<'a> {
|
|||
/// A holder for an element's "tag name", which will be lazily
|
||||
/// resolved and cached. Should be reset when the document
|
||||
/// owner changes.
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct TagName {
|
||||
ptr: DomRefCell<Option<LocalName>>,
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ pub struct ErrorEvent {
|
|||
filename: DomRefCell<DOMString>,
|
||||
lineno: Cell<u32>,
|
||||
colno: Cell<u32>,
|
||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
|
||||
error: Heap<JSVal>,
|
||||
}
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ impl EventMethods for Event {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||
pub enum EventBubbles {
|
||||
Bubbles,
|
||||
DoesNotBubble
|
||||
|
@ -318,7 +318,7 @@ impl From<EventBubbles> for bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||
pub enum EventCancelable {
|
||||
Cancelable,
|
||||
NotCancelable
|
||||
|
@ -344,7 +344,7 @@ impl From<EventCancelable> for bool {
|
|||
|
||||
#[derive(Clone, Copy, Debug, Eq, JSTraceable, PartialEq)]
|
||||
#[repr(u16)]
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub enum EventPhase {
|
||||
None = EventConstants::NONE,
|
||||
Capturing = EventConstants::CAPTURING_PHASE,
|
||||
|
@ -363,7 +363,7 @@ pub enum EventPhase {
|
|||
///
|
||||
/// [msg]: https://doc.servo.org/script_traits/enum.ConstellationMsg.html#variant.KeyEvent
|
||||
///
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum EventDefault {
|
||||
/// The default action of the event is allowed (constructor's default)
|
||||
Allowed,
|
||||
|
|
|
@ -41,10 +41,10 @@ header! { (LastEventId, "Last-Event-ID") => [String] }
|
|||
|
||||
const DEFAULT_RECONNECTION_TIME: u64 = 5000;
|
||||
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
struct GenerationId(u32);
|
||||
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate>
|
||||
enum ReadyState {
|
||||
Connecting = 0,
|
||||
|
@ -528,11 +528,11 @@ impl EventSourceMethods for EventSource {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct EventSourceTimeoutCallback {
|
||||
#[ignore_heap_size_of = "Because it is non-owning"]
|
||||
#[ignore_malloc_size_of = "Because it is non-owning"]
|
||||
event_source: Trusted<EventSource>,
|
||||
#[ignore_heap_size_of = "Because it is non-owning"]
|
||||
#[ignore_malloc_size_of = "Because it is non-owning"]
|
||||
action_sender: ipc::IpcSender<FetchResponseMsg>,
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use fnv::FnvHasher;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
|
||||
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
|
||||
use libc::{c_char, size_t};
|
||||
|
@ -48,11 +47,19 @@ use std::ops::{Deref, DerefMut};
|
|||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Clone, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum CommonEventHandler {
|
||||
EventHandler(Rc<EventHandlerNonNull>),
|
||||
ErrorEventHandler(Rc<OnErrorEventHandlerNonNull>),
|
||||
BeforeUnloadEventHandler(Rc<OnBeforeUnloadEventHandlerNonNull>),
|
||||
EventHandler(
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
Rc<EventHandlerNonNull>),
|
||||
|
||||
ErrorEventHandler(
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
Rc<OnErrorEventHandlerNonNull>),
|
||||
|
||||
BeforeUnloadEventHandler(
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
Rc<OnBeforeUnloadEventHandlerNonNull>),
|
||||
}
|
||||
|
||||
impl CommonEventHandler {
|
||||
|
@ -65,14 +72,14 @@ impl CommonEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum ListenerPhase {
|
||||
Capturing,
|
||||
Bubbling,
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler>
|
||||
#[derive(Clone, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
struct InternalRawUncompiledHandler {
|
||||
source: DOMString,
|
||||
url: ServoUrl,
|
||||
|
@ -80,7 +87,7 @@ struct InternalRawUncompiledHandler {
|
|||
}
|
||||
|
||||
/// A representation of an event handler, either compiled or uncompiled raw source, or null.
|
||||
#[derive(Clone, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
enum InlineEventListener {
|
||||
Uncompiled(InternalRawUncompiledHandler),
|
||||
Compiled(CommonEventHandler),
|
||||
|
@ -110,19 +117,12 @@ impl InlineEventListener {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
enum EventListenerType {
|
||||
Additive(Rc<EventListener>),
|
||||
Additive(#[ignore_malloc_size_of = "Rc"] Rc<EventListener>),
|
||||
Inline(InlineEventListener),
|
||||
}
|
||||
|
||||
impl HeapSizeOf for EventListenerType {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
// FIXME: Rc<T> isn't HeapSizeOf and we can't ignore it due to #6870 and #6871
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
impl EventListenerType {
|
||||
fn get_compiled_listener(&mut self, owner: &EventTarget, ty: &Atom)
|
||||
-> Option<CompiledEventListener> {
|
||||
|
@ -225,14 +225,14 @@ impl CompiledEventListener {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, DenyPublicFields, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, DenyPublicFields, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
/// A listener in a collection of event listeners.
|
||||
struct EventListenerEntry {
|
||||
phase: ListenerPhase,
|
||||
listener: EventListenerType
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
/// A mix of potentially uncompiled and compiled event listeners of the same type.
|
||||
struct EventListeners(Vec<EventListenerEntry>);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ use task::TaskCanceller;
|
|||
use task_source::TaskSource;
|
||||
use task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum FileReaderFunction {
|
||||
ReadAsText,
|
||||
ReadAsDataUrl,
|
||||
|
@ -48,7 +48,7 @@ pub enum FileReaderFunction {
|
|||
|
||||
pub type TrustedFileReader = Trusted<FileReader>;
|
||||
|
||||
#[derive(Clone, HeapSizeOf)]
|
||||
#[derive(Clone, MallocSizeOf)]
|
||||
pub struct ReadMetaData {
|
||||
pub blobtype: String,
|
||||
pub label: Option<String>,
|
||||
|
@ -66,18 +66,18 @@ impl ReadMetaData {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub struct GenerationId(u32);
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum FileReaderReadyState {
|
||||
Empty = FileReaderConstants::EMPTY,
|
||||
Loading = FileReaderConstants::LOADING,
|
||||
Done = FileReaderConstants::DONE,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub enum FileReaderResult {
|
||||
ArrayBuffer(Heap<JSVal>),
|
||||
String(DOMString),
|
||||
|
|
|
@ -35,7 +35,7 @@ pub struct Gamepad {
|
|||
axes: Heap<*mut JSObject>,
|
||||
buttons: Dom<GamepadButtonList>,
|
||||
pose: Option<Dom<VRPose>>,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
hand: WebVRGamepadHand,
|
||||
display_id: u32
|
||||
}
|
||||
|
|
|
@ -72,22 +72,22 @@ pub struct GlobalScope {
|
|||
console_timers: DomRefCell<HashMap<DOMString, u64>>,
|
||||
|
||||
/// For providing instructions to an optional devtools server.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
|
||||
/// For sending messages to the memory profiler.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
mem_profiler_chan: mem::ProfilerChan,
|
||||
|
||||
/// For sending messages to the time profiler.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
|
||||
/// A handle for communicating messages to the constellation thread.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
script_to_constellation_chan: ScriptToConstellationChan,
|
||||
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#in-error-reporting-mode>
|
||||
|
@ -108,7 +108,7 @@ pub struct GlobalScope {
|
|||
/// same microtask queue.
|
||||
///
|
||||
/// <https://html.spec.whatwg.org/multipage/#microtask-queue>
|
||||
#[ignore_heap_size_of = "Rc<T> is hard"]
|
||||
#[ignore_malloc_size_of = "Rc<T> is hard"]
|
||||
microtask_queue: Rc<MicrotaskQueue>,
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ use std::str;
|
|||
pub struct Headers {
|
||||
reflector_: Reflector,
|
||||
guard: Cell<Guard>,
|
||||
#[ignore_heap_size_of = "Defined in hyper"]
|
||||
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||
header_list: DomRefCell<HyperHeaders>
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-headers-guard
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub enum Guard {
|
||||
Immutable,
|
||||
Request,
|
||||
|
|
|
@ -30,7 +30,7 @@ use std::default::Default;
|
|||
use style::element_state::*;
|
||||
|
||||
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
enum ButtonType {
|
||||
Submit,
|
||||
Reset,
|
||||
|
|
|
@ -42,7 +42,7 @@ const DEFAULT_WIDTH: u32 = 300;
|
|||
const DEFAULT_HEIGHT: u32 = 150;
|
||||
|
||||
#[must_root]
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub enum CanvasContext {
|
||||
Context2d(Dom<CanvasRenderingContext2D>),
|
||||
WebGL(Dom<WebGLRenderingContext>),
|
||||
|
|
|
@ -26,7 +26,7 @@ pub trait CollectionFilter : JSTraceable {
|
|||
// An optional u32, using maxint to represent None.
|
||||
// It would be nicer just to use Option<u32> for this, but that would produce word
|
||||
// alignment issues since Option<u32> uses 33 bits.
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||
struct OptionU32 {
|
||||
bits: u32,
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ impl OptionU32 {
|
|||
pub struct HTMLCollection {
|
||||
reflector_: Reflector,
|
||||
root: Dom<Node>,
|
||||
#[ignore_heap_size_of = "Contains a trait object; can't measure due to #6870"]
|
||||
#[ignore_malloc_size_of = "Contains a trait object; can't measure due to #6870"]
|
||||
filter: Box<CollectionFilter + 'static>,
|
||||
// We cache the version of the root node and all its decendents,
|
||||
// the length of the collection, and a cursor into the collection.
|
||||
|
@ -119,7 +119,7 @@ impl HTMLCollection {
|
|||
-> DomRoot<HTMLCollection> {
|
||||
// case 1
|
||||
if qualified_name == local_name!("*") {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct AllFilter;
|
||||
impl CollectionFilter for AllFilter {
|
||||
fn filter(&self, _elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -129,7 +129,7 @@ impl HTMLCollection {
|
|||
return HTMLCollection::create(window, root, Box::new(AllFilter));
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct HtmlDocumentFilter {
|
||||
qualified_name: LocalName,
|
||||
ascii_lower_qualified_name: LocalName,
|
||||
|
@ -169,7 +169,7 @@ impl HTMLCollection {
|
|||
}
|
||||
|
||||
pub fn by_qual_tag_name(window: &Window, root: &Node, qname: QualName) -> DomRoot<HTMLCollection> {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct TagNameNSFilter {
|
||||
qname: QualName
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ impl HTMLCollection {
|
|||
|
||||
pub fn by_atomic_class_name(window: &Window, root: &Node, classes: Vec<Atom>)
|
||||
-> DomRoot<HTMLCollection> {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct ClassNameFilter {
|
||||
classes: Vec<Atom>
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ impl HTMLCollection {
|
|||
}
|
||||
|
||||
pub fn children(window: &Window, root: &Node) -> DomRoot<HTMLCollection> {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct ElementChildFilter;
|
||||
impl CollectionFilter for ElementChildFilter {
|
||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||
|
|
|
@ -43,7 +43,7 @@ impl HTMLDataListElement {
|
|||
impl HTMLDataListElementMethods for HTMLDataListElement {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-datalist-options
|
||||
fn Options(&self) -> DomRoot<HTMLCollection> {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct HTMLDataListOptionsFilter;
|
||||
impl CollectionFilter for HTMLDataListOptionsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
|
|
@ -52,7 +52,7 @@ impl HTMLFieldSetElement {
|
|||
impl HTMLFieldSetElementMethods for HTMLFieldSetElement {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-fieldset-elements
|
||||
fn Elements(&self) -> DomRoot<HTMLCollection> {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct ElementsFilter;
|
||||
impl CollectionFilter for ElementsFilter {
|
||||
fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool {
|
||||
|
|
|
@ -57,7 +57,7 @@ use style::attr::AttrValue;
|
|||
use style::str::split_html_space_chars;
|
||||
use task_source::TaskSource;
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub struct GenerationId(u32);
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -166,7 +166,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-form-elements
|
||||
fn Elements(&self) -> DomRoot<HTMLFormControlsCollection> {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct ElementsFilter {
|
||||
form: DomRoot<HTMLFormElement>
|
||||
}
|
||||
|
@ -235,13 +235,13 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||
pub enum SubmittedFrom {
|
||||
FromForm,
|
||||
NotFromForm
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, MallocSizeOf)]
|
||||
pub enum ResetFrom {
|
||||
FromForm,
|
||||
NotFromForm
|
||||
|
@ -674,14 +674,14 @@ impl HTMLFormElement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub enum FormDatumValue {
|
||||
#[allow(dead_code)]
|
||||
File(DomRoot<File>),
|
||||
String(DOMString)
|
||||
}
|
||||
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub struct FormDatum {
|
||||
pub ty: DOMString,
|
||||
pub name: DOMString,
|
||||
|
@ -701,21 +701,21 @@ impl FormDatum {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, MallocSizeOf)]
|
||||
pub enum FormEncType {
|
||||
TextPlainEncoded,
|
||||
UrlEncoded,
|
||||
FormDataEncoded
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, MallocSizeOf)]
|
||||
pub enum FormMethod {
|
||||
FormGet,
|
||||
FormPost,
|
||||
FormDialog
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
#[allow(dead_code)]
|
||||
pub enum FormSubmittableElement {
|
||||
ButtonElement(DomRoot<HTMLButtonElement>),
|
||||
|
@ -759,7 +759,7 @@ impl FormSubmittableElement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, MallocSizeOf)]
|
||||
pub enum FormSubmitter<'a> {
|
||||
FormElement(&'a HTMLFormElement),
|
||||
InputElement(&'a HTMLInputElement),
|
||||
|
|
|
@ -10,7 +10,7 @@ use dom::node::Node;
|
|||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub enum HeadingLevel {
|
||||
Heading1,
|
||||
Heading2,
|
||||
|
|
|
@ -56,7 +56,7 @@ use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
|||
use task_source::TaskSource;
|
||||
|
||||
bitflags! {
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
flags SandboxAllowance: u8 {
|
||||
const ALLOW_NOTHING = 0x00,
|
||||
const ALLOW_SAME_ORIGIN = 0x01,
|
||||
|
|
|
@ -85,7 +85,7 @@ pub struct Descriptor {
|
|||
pub den: Option<f64>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||
#[allow(dead_code)]
|
||||
enum State {
|
||||
Unavailable,
|
||||
|
@ -100,19 +100,19 @@ pub struct Size {
|
|||
pub length: Length,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||
enum ImageRequestPhase {
|
||||
Pending,
|
||||
Current
|
||||
}
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
struct ImageRequest {
|
||||
state: State,
|
||||
parsed_url: Option<ServoUrl>,
|
||||
source_url: Option<DOMString>,
|
||||
blocker: Option<LoadBlocker>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
image: Option<Arc<Image>>,
|
||||
metadata: Option<ImageMetadata>,
|
||||
final_url: Option<ServoUrl>,
|
||||
|
@ -695,7 +695,7 @@ impl HTMLImageElement {
|
|||
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub enum ImageElementMicrotask {
|
||||
StableStateUpdateImageDataTask {
|
||||
elem: DomRoot<HTMLImageElement>,
|
||||
|
|
|
@ -62,7 +62,7 @@ const PASSWORD_REPLACEMENT_CHAR: char = '●';
|
|||
|
||||
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
||||
#[allow(dead_code)]
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
enum InputType {
|
||||
InputSubmit,
|
||||
InputReset,
|
||||
|
@ -93,7 +93,7 @@ pub struct HTMLInputElement {
|
|||
size: Cell<u32>,
|
||||
maxlength: Cell<i32>,
|
||||
minlength: Cell<i32>,
|
||||
#[ignore_heap_size_of = "#7193"]
|
||||
#[ignore_malloc_size_of = "#7193"]
|
||||
textinput: DomRefCell<TextInput<ScriptToConstellationChan>>,
|
||||
activation_state: DomRefCell<InputActivationState>,
|
||||
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
|
||||
|
@ -105,7 +105,7 @@ pub struct HTMLInputElement {
|
|||
|
||||
#[derive(JSTraceable)]
|
||||
#[must_root]
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
struct InputActivationState {
|
||||
indeterminate: bool,
|
||||
checked: bool,
|
||||
|
|
|
@ -38,7 +38,7 @@ use style::stylesheets::{CssRuleType, Stylesheet};
|
|||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner};
|
||||
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
pub struct RequestGenerationId(u32);
|
||||
|
||||
impl RequestGenerationId {
|
||||
|
@ -51,7 +51,7 @@ impl RequestGenerationId {
|
|||
pub struct HTMLLinkElement {
|
||||
htmlelement: HTMLElement,
|
||||
rel_list: MutNullableDom<DOMTokenList>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
||||
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
||||
|
||||
|
|
|
@ -77,15 +77,15 @@ pub struct HTMLMediaElement {
|
|||
/// <https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag>
|
||||
delaying_the_load_event_flag: DomRefCell<Option<LoadBlocker>>,
|
||||
/// <https://html.spec.whatwg.org/multipage/#list-of-pending-play-promises>
|
||||
#[ignore_heap_size_of = "promises are hard"]
|
||||
#[ignore_malloc_size_of = "promises are hard"]
|
||||
pending_play_promises: DomRefCell<Vec<Rc<Promise>>>,
|
||||
/// Play promises which are soon to be fulfilled by a queued task.
|
||||
#[ignore_heap_size_of = "promises are hard"]
|
||||
#[ignore_malloc_size_of = "promises are hard"]
|
||||
in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate>
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
#[repr(u8)]
|
||||
pub enum NetworkState {
|
||||
Empty = HTMLMediaElementConstants::NETWORK_EMPTY as u8,
|
||||
|
@ -95,7 +95,7 @@ pub enum NetworkState {
|
|||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-readystate>
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq, PartialOrd)]
|
||||
#[repr(u8)]
|
||||
enum ReadyState {
|
||||
HaveNothing = HTMLMediaElementConstants::HAVE_NOTHING as u8,
|
||||
|
@ -940,7 +940,7 @@ impl VirtualMethods for HTMLMediaElement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub enum MediaElementMicrotask {
|
||||
ResourceSelectionTask {
|
||||
elem: DomRoot<HTMLMediaElement>,
|
||||
|
|
|
@ -32,7 +32,7 @@ use style::stylesheets::{Stylesheet, StylesheetContents, CssRule, CssRules, Orig
|
|||
#[dom_struct]
|
||||
pub struct HTMLMetaElement {
|
||||
htmlelement: HTMLElement,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
||||
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ use std::default::Default;
|
|||
#[dom_struct]
|
||||
pub struct HTMLObjectElement {
|
||||
htmlelement: HTMLElement,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
image: DomRefCell<Option<Arc<Image>>>,
|
||||
form_owner: MutNullableDom<HTMLFormElement>,
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ static SCRIPT_JS_MIMES: StaticStringVec = &[
|
|||
"text/x-javascript",
|
||||
];
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct ClassicScript {
|
||||
text: DOMString,
|
||||
url: ServoUrl,
|
||||
|
|
|
@ -37,7 +37,7 @@ use std::iter;
|
|||
use style::attr::AttrValue;
|
||||
use style::element_state::*;
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct OptionsFilter;
|
||||
impl CollectionFilter for OptionsFilter {
|
||||
fn filter<'a>(&self, elem: &'a Element, root: &'a Node) -> bool {
|
||||
|
|
|
@ -31,7 +31,7 @@ use stylesheet_loader::{StylesheetLoader, StylesheetOwner};
|
|||
#[dom_struct]
|
||||
pub struct HTMLStyleElement {
|
||||
htmlelement: HTMLElement,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
||||
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
||||
/// <https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts>
|
||||
|
|
|
@ -36,7 +36,7 @@ pub struct HTMLTableElement {
|
|||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct TableRowFilter {
|
||||
sections: Vec<Dom<Node>>,
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ use textinput::{KeyReaction, Lines, SelectionDirection, TextInput};
|
|||
#[dom_struct]
|
||||
pub struct HTMLTextAreaElement {
|
||||
htmlelement: HTMLElement,
|
||||
#[ignore_heap_size_of = "#7193"]
|
||||
#[ignore_malloc_size_of = "#7193"]
|
||||
textinput: DomRefCell<TextInput<ScriptToConstellationChan>>,
|
||||
placeholder: DomRefCell<DOMString>,
|
||||
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
|
||||
|
|
|
@ -742,7 +742,7 @@ fn key_keycode(key: Key) -> u32 {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct KeyEventProperties {
|
||||
pub key_string: Cow<'static, str>,
|
||||
pub code: &'static str,
|
||||
|
|
|
@ -24,7 +24,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
|||
pub struct MediaList {
|
||||
reflector_: Reflector,
|
||||
parent_stylesheet: Dom<CSSStyleSheet>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
media_queries: Arc<Locked<StyleMediaList>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ impl MediaQueryListMethods for MediaQueryList {
|
|||
event_handler!(change, GetOnchange, SetOnchange);
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct WeakMediaQueryListVec {
|
||||
cell: DomRefCell<WeakRefVec<MediaQueryList>>,
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ use std::rc::Rc;
|
|||
#[dom_struct]
|
||||
pub struct MutationObserver {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "can't measure Rc values"]
|
||||
#[ignore_malloc_size_of = "can't measure Rc values"]
|
||||
callback: Rc<MutationCallback>,
|
||||
record_queue: DomRefCell<Vec<DomRoot<MutationRecord>>>,
|
||||
}
|
||||
|
@ -35,13 +35,13 @@ pub enum Mutation<'a> {
|
|||
prev: Option<&'a Node>, next: Option<&'a Node> },
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct RegisteredObserver {
|
||||
observer: DomRoot<MutationObserver>,
|
||||
options: ObserverOptions,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct ObserverOptions {
|
||||
attribute_old_value: bool,
|
||||
attributes: bool,
|
||||
|
|
|
@ -56,10 +56,10 @@ use dom::virtualmethods::{VirtualMethods, vtable_for};
|
|||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::{Point2D, Vector2D, Rect, Size2D};
|
||||
use heapsize::{HeapSizeOf, heap_size_of};
|
||||
use html5ever::{Prefix, Namespace, QualName};
|
||||
use js::jsapi::{JSContext, JSObject, JSRuntime};
|
||||
use libc::{self, c_void, uintptr_t};
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
use ref_slice::ref_slice;
|
||||
use script_layout_interface::{HTMLCanvasData, OpaqueStyleAndLayoutData, SVGSVGData};
|
||||
|
@ -147,7 +147,7 @@ pub struct Node {
|
|||
|
||||
bitflags! {
|
||||
#[doc = "Flags for node items."]
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub flags NodeFlags: u16 {
|
||||
#[doc = "Specifies whether this node is in a document."]
|
||||
const IS_IN_DOC = 1 << 0,
|
||||
|
@ -200,7 +200,7 @@ impl Drop for Node {
|
|||
/// suppress observers flag
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-insert>
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-remove>
|
||||
#[derive(Clone, Copy, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, MallocSizeOf)]
|
||||
enum SuppressObserver {
|
||||
Suppressed,
|
||||
Unsuppressed
|
||||
|
@ -1368,7 +1368,7 @@ impl Iterator for TreeIterator {
|
|||
}
|
||||
|
||||
/// Specifies whether children must be recursively cloned or not.
|
||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||
pub enum CloneChildrenFlag {
|
||||
CloneChildren,
|
||||
DoNotCloneChildren
|
||||
|
@ -2531,7 +2531,7 @@ impl VirtualMethods for Node {
|
|||
}
|
||||
|
||||
/// A summary of the changes that happened to a node.
|
||||
#[derive(Clone, Copy, HeapSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||
pub enum NodeDamage {
|
||||
/// The node's `style` attribute changed.
|
||||
NodeStyleDamaged,
|
||||
|
@ -2704,11 +2704,11 @@ struct UniqueId {
|
|||
|
||||
unsafe_no_jsmanaged_fields!(UniqueId);
|
||||
|
||||
impl HeapSizeOf for UniqueId {
|
||||
impl MallocSizeOf for UniqueId {
|
||||
#[allow(unsafe_code)]
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
if let &Some(ref uuid) = unsafe { &*self.cell.get() } {
|
||||
unsafe { heap_size_of(&** uuid as *const Uuid as *const _) }
|
||||
unsafe { ops.malloc_size_of(&** uuid) }
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ use std::rc::Rc;
|
|||
pub struct NodeIterator {
|
||||
reflector_: Reflector,
|
||||
root_node: Dom<Node>,
|
||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
|
||||
reference_node: MutDom<Node>,
|
||||
pointer_before_reference_node: Cell<bool>,
|
||||
what_to_show: u32,
|
||||
#[ignore_heap_size_of = "Can't measure due to #6870"]
|
||||
#[ignore_malloc_size_of = "Can't measure due to #6870"]
|
||||
filter: Filter,
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use dom::window::Window;
|
|||
use dom_struct::dom_struct;
|
||||
use std::cell::Cell;
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub enum NodeListType {
|
||||
Simple(Vec<Dom<Node>>),
|
||||
|
@ -109,11 +109,11 @@ impl NodeList {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub struct ChildrenList {
|
||||
node: Dom<Node>,
|
||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
|
||||
last_visited: MutNullableDom<Node>,
|
||||
last_index: Cell<u32>,
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ pub struct PaintWorkletGlobalScope {
|
|||
/// The worklet global for this object
|
||||
worklet_global: WorkletGlobalScope,
|
||||
/// The image cache
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
image_cache: Arc<ImageCache>,
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definitions>
|
||||
paint_definitions: DomRefCell<HashMap<Atom, Box<PaintDefinition>>>,
|
||||
|
@ -464,7 +464,7 @@ pub enum PaintWorkletTask {
|
|||
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definition>
|
||||
/// This type is dangerous, because it contains uboxed `Heap<JSVal>` values,
|
||||
/// which can't be moved.
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
struct PaintDefinition {
|
||||
class_constructor: Heap<JSVal>,
|
||||
|
|
|
@ -50,7 +50,7 @@ const INVALID_ENTRY_NAMES: &'static [&'static str] = &[
|
|||
|
||||
/// Implementation of a list of PerformanceEntry items shared by the
|
||||
/// Performance and PerformanceObserverEntryList interfaces implementations.
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct PerformanceEntryList {
|
||||
entries: DOMPerformanceEntryList,
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ impl IntoIterator for PerformanceEntryList {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct PerformanceObserver {
|
||||
observer: DomRoot<DOMPerformanceObserver>,
|
||||
entry_types: Vec<DOMString>,
|
||||
|
|
|
@ -32,7 +32,7 @@ const VALID_ENTRY_TYPES: &'static [&'static str] = &[
|
|||
#[dom_struct]
|
||||
pub struct PerformanceObserver {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "can't measure Rc values"]
|
||||
#[ignore_malloc_size_of = "can't measure Rc values"]
|
||||
callback: Rc<PerformanceObserverCallback>,
|
||||
entries: DomRefCell<DOMPerformanceEntryList>,
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ use servo_atoms::Atom;
|
|||
#[dom_struct]
|
||||
pub struct PopStateEvent {
|
||||
event: Event,
|
||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-mozjs"]
|
||||
state: Heap<JSVal>,
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ pub struct Promise {
|
|||
/// the SpiderMonkey GC, an explicit root for the reflector is stored while any
|
||||
/// native instance exists. This ensures that the reflector will never be GCed
|
||||
/// while native code could still interact with its native representation.
|
||||
#[ignore_heap_size_of = "SM handles JS values"]
|
||||
#[ignore_malloc_size_of = "SM handles JS values"]
|
||||
permanent_js_root: Heap<JSVal>,
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ use dom::bindings::root::DomRoot;
|
|||
use dom::bindings::trace::JSTraceable;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::{JSContext, HandleValue};
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
|
||||
pub trait Callback: JSTraceable + HeapSizeOf {
|
||||
pub trait Callback: JSTraceable + MallocSizeOf {
|
||||
fn callback(&self, cx: *mut JSContext, v: HandleValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ use dom::node::{Node, UnbindContext};
|
|||
use dom::text::Text;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::JSTracer;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
|
||||
|
||||
|
@ -933,7 +933,7 @@ impl RangeMethods for Range {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(DenyPublicFields, HeapSizeOf, JSTraceable)]
|
||||
#[derive(DenyPublicFields, JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub struct BoundaryPoint {
|
||||
node: MutDom<Node>,
|
||||
|
@ -1251,9 +1251,9 @@ impl WeakRangeVec {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl HeapSizeOf for WeakRangeVec {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
unsafe { (*self.cell.get()).heap_size_of_children() }
|
||||
impl MallocSizeOf for WeakRangeVec {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
unsafe { (*self.cell.get()).size_of(ops) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ pub struct Request {
|
|||
body_used: Cell<bool>,
|
||||
headers: MutNullableDom<Headers>,
|
||||
mime_type: DomRefCell<Vec<u8>>,
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
body_promise: DomRefCell<Option<(Rc<Promise>, BodyType)>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ pub struct Response {
|
|||
mime_type: DomRefCell<Vec<u8>>,
|
||||
body_used: Cell<bool>,
|
||||
/// `None` can be considered a StatusCode of `0`.
|
||||
#[ignore_heap_size_of = "Defined in hyper"]
|
||||
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||
status: DomRefCell<Option<StatusCode>>,
|
||||
raw_status: DomRefCell<Option<(u16, Vec<u8>)>>,
|
||||
response_type: DomRefCell<DOMResponseType>,
|
||||
|
@ -44,7 +44,7 @@ pub struct Response {
|
|||
url_list: DomRefCell<Vec<ServoUrl>>,
|
||||
// For now use the existing NetTraitsResponseBody enum
|
||||
body: DomRefCell<NetTraitsResponseBody>,
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
body_promise: DomRefCell<Option<(Rc<Promise>, BodyType)>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@ impl ScriptChan for ServiceWorkerChan {
|
|||
#[dom_struct]
|
||||
pub struct ServiceWorkerGlobalScope {
|
||||
workerglobalscope: WorkerGlobalScope,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
receiver: Receiver<ServiceWorkerScriptMsg>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
own_sender: Sender<ServiceWorkerScriptMsg>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
timer_event_port: Receiver<()>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
swmanager_sender: IpcSender<ServiceWorkerMsg>,
|
||||
scope_url: ServoUrl,
|
||||
}
|
||||
|
|
|
@ -38,25 +38,25 @@ use style::context::QuirksMode as ServoQuirksMode;
|
|||
|
||||
type ParseNodeId = usize;
|
||||
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
pub struct ParseNode {
|
||||
id: ParseNodeId,
|
||||
qual_name: Option<QualName>,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
enum NodeOrText {
|
||||
Node(ParseNode),
|
||||
Text(String),
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct Attribute {
|
||||
name: QualName,
|
||||
value: String,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
enum ParseOperation {
|
||||
GetTemplateContents { target: ParseNodeId, contents: ParseNodeId },
|
||||
|
||||
|
@ -99,21 +99,21 @@ enum ParseOperation {
|
|||
Pop { node: ParseNodeId },
|
||||
|
||||
SetQuirksMode {
|
||||
#[ignore_heap_size_of = "Defined in style"]
|
||||
#[ignore_malloc_size_of = "Defined in style"]
|
||||
mode: ServoQuirksMode
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
enum ToTokenizerMsg {
|
||||
// From HtmlTokenizer
|
||||
TokenizerResultDone {
|
||||
#[ignore_heap_size_of = "Defined in html5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in html5ever"]
|
||||
updated_input: VecDeque<SendTendril<UTF8>>
|
||||
},
|
||||
TokenizerResultScript {
|
||||
script: ParseNode,
|
||||
#[ignore_heap_size_of = "Defined in html5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in html5ever"]
|
||||
updated_input: VecDeque<SendTendril<UTF8>>
|
||||
},
|
||||
End, // Sent to Tokenizer to signify HtmlTokenizer's end method has returned
|
||||
|
@ -122,10 +122,10 @@ enum ToTokenizerMsg {
|
|||
ProcessOperation(ParseOperation),
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
enum ToHtmlTokenizerMsg {
|
||||
Feed {
|
||||
#[ignore_heap_size_of = "Defined in html5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in html5ever"]
|
||||
input: VecDeque<SendTendril<UTF8>>
|
||||
},
|
||||
End,
|
||||
|
@ -165,15 +165,15 @@ fn create_buffer_queue(mut buffers: VecDeque<SendTendril<UTF8>>) -> BufferQueue
|
|||
// | | | |________| |
|
||||
// |_____________| |_______________|
|
||||
//
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub struct Tokenizer {
|
||||
document: Dom<Document>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
receiver: Receiver<ToTokenizerMsg>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
html_tokenizer_sender: Sender<ToHtmlTokenizerMsg>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
nodes: HashMap<ParseNodeId, Dom<Node>>,
|
||||
url: ServoUrl,
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ fn run(sink: Sink,
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Default, JSTraceable, MallocSizeOf)]
|
||||
struct ParseNodeData {
|
||||
contents: Option<ParseNode>,
|
||||
is_integration_point: bool,
|
||||
|
|
|
@ -28,10 +28,10 @@ use js::jsapi::JSTracer;
|
|||
use servo_url::ServoUrl;
|
||||
use std::io;
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub struct Tokenizer {
|
||||
#[ignore_heap_size_of = "Defined in html5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in html5ever"]
|
||||
inner: HtmlTokenizer<TreeBuilder<Dom<Node>, Sink>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -74,13 +74,13 @@ pub struct ServoParser {
|
|||
/// The document associated with this parser.
|
||||
document: Dom<Document>,
|
||||
/// Input received from network.
|
||||
#[ignore_heap_size_of = "Defined in html5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in html5ever"]
|
||||
network_input: DomRefCell<BufferQueue>,
|
||||
/// Part of an UTF-8 code point spanning input chunks
|
||||
#[ignore_heap_size_of = "Defined in html5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in html5ever"]
|
||||
incomplete_utf8: DomRefCell<Option<IncompleteUtf8>>,
|
||||
/// Input received from script. Used only to support document.write().
|
||||
#[ignore_heap_size_of = "Defined in html5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in html5ever"]
|
||||
script_input: DomRefCell<BufferQueue>,
|
||||
/// The tokenizer of this parser.
|
||||
tokenizer: DomRefCell<Tokenizer>,
|
||||
|
@ -493,13 +493,13 @@ impl<I> Iterator for FragmentParsingResult<I>
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(JSTraceable, MallocSizeOf, PartialEq)]
|
||||
enum ParserKind {
|
||||
Normal,
|
||||
ScriptCreated,
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
enum Tokenizer {
|
||||
Html(self::html::Tokenizer),
|
||||
|
@ -742,7 +742,7 @@ fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText<Dom<N
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub struct Sink {
|
||||
base_url: ServoUrl,
|
||||
|
|
|
@ -16,10 +16,10 @@ use xml5ever::buffer_queue::BufferQueue;
|
|||
use xml5ever::tokenizer::XmlTokenizer;
|
||||
use xml5ever::tree_builder::{Tracer as XmlTracer, XmlTreeBuilder};
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[must_root]
|
||||
pub struct Tokenizer {
|
||||
#[ignore_heap_size_of = "Defined in xml5ever"]
|
||||
#[ignore_malloc_size_of = "Defined in xml5ever"]
|
||||
inner: XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -723,9 +723,9 @@ impl TestBindingMethods for TestBinding {
|
|||
p.append_native_handler(&handler);
|
||||
return p;
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct SimpleHandler {
|
||||
#[ignore_heap_size_of = "Rc has unclear ownership semantics"]
|
||||
#[ignore_malloc_size_of = "Rc has unclear ownership semantics"]
|
||||
handler: Rc<SimpleCallback>,
|
||||
}
|
||||
impl SimpleHandler {
|
||||
|
@ -804,9 +804,9 @@ impl TestBinding {
|
|||
pub unsafe fn condition_unsatisfied(_: *mut JSContext, _: HandleObject) -> bool { false }
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct TestBindingCallback {
|
||||
#[ignore_heap_size_of = "unclear ownership semantics"]
|
||||
#[ignore_malloc_size_of = "unclear ownership semantics"]
|
||||
promise: TrustedPromise,
|
||||
value: DOMString,
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use std::borrow::ToOwned;
|
|||
#[dom_struct]
|
||||
pub struct TextDecoder {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in rust-encoding"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-encoding"]
|
||||
encoding: EncodingRef,
|
||||
fatal: bool,
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ pub struct TreeWalker {
|
|||
root_node: Dom<Node>,
|
||||
current_node: MutDom<Node>,
|
||||
what_to_show: u32,
|
||||
#[ignore_heap_size_of = "function pointers and Rc<T> are hard"]
|
||||
#[ignore_malloc_size_of = "function pointers and Rc<T> are hard"]
|
||||
filter: Filter
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use servo_url::ServoUrl;
|
|||
use std::borrow::ToOwned;
|
||||
use url::quirks;
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct UrlHelper;
|
||||
|
||||
impl UrlHelper {
|
||||
|
|
|
@ -11,7 +11,7 @@ use dom::window::Window;
|
|||
use dom_struct::dom_struct;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#validity-states
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ValidityStatus {
|
||||
ValueMissing,
|
||||
|
|
|
@ -46,7 +46,7 @@ use webvr_traits::{WebVRDisplayData, WebVRDisplayEvent, WebVRFrameData, WebVRLay
|
|||
#[dom_struct]
|
||||
pub struct VRDisplay {
|
||||
eventtarget: EventTarget,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
display: DomRefCell<WebVRDisplayData>,
|
||||
depth_near: Cell<f64>,
|
||||
depth_far: Cell<f64>,
|
||||
|
@ -55,19 +55,19 @@ pub struct VRDisplay {
|
|||
right_eye_params: MutDom<VREyeParameters>,
|
||||
capabilities: MutDom<VRDisplayCapabilities>,
|
||||
stage_params: MutNullableDom<VRStageParameters>,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
frame_data: DomRefCell<WebVRFrameData>,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
layer: DomRefCell<WebVRLayer>,
|
||||
layer_ctx: MutNullableDom<WebGLRenderingContext>,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
next_raf_id: Cell<u32>,
|
||||
/// List of request animation frame callbacks
|
||||
#[ignore_heap_size_of = "closures are hard"]
|
||||
#[ignore_malloc_size_of = "closures are hard"]
|
||||
raf_callback_list: DomRefCell<Vec<(u32, Option<Rc<FrameRequestCallback>>)>>,
|
||||
// Compositor VRFrameData synchonization
|
||||
frame_data_status: Cell<VRFrameDataStatus>,
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
#[ignore_malloc_size_of = "closures are hard"]
|
||||
frame_data_receiver: DomRefCell<Option<WebGLReceiver<Result<Vec<u8>, ()>>>>,
|
||||
running_display_raf: Cell<bool>,
|
||||
paused: Cell<bool>,
|
||||
|
@ -78,7 +78,7 @@ unsafe_no_jsmanaged_fields!(WebVRDisplayData);
|
|||
unsafe_no_jsmanaged_fields!(WebVRFrameData);
|
||||
unsafe_no_jsmanaged_fields!(WebVRLayer);
|
||||
|
||||
#[derive(Clone, Copy, Eq, HeapSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq)]
|
||||
enum VRFrameDataStatus {
|
||||
Waiting,
|
||||
Synced,
|
||||
|
|
|
@ -14,7 +14,7 @@ use webvr_traits::WebVRDisplayCapabilities;
|
|||
#[dom_struct]
|
||||
pub struct VRDisplayCapabilities {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
capabilities: DomRefCell<WebVRDisplayCapabilities>
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ use webvr_traits::WebVREyeParameters;
|
|||
#[dom_struct]
|
||||
pub struct VREyeParameters {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
parameters: DomRefCell<WebVREyeParameters>,
|
||||
offset: Heap<*mut JSObject>,
|
||||
fov: Dom<VRFieldOfView>,
|
||||
|
|
|
@ -15,7 +15,7 @@ use webvr_traits::WebVRFieldOfView;
|
|||
#[dom_struct]
|
||||
pub struct VRFieldOfView {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
fov: DomRefCell<WebVRFieldOfView>
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use webvr_traits::WebVRStageParameters;
|
|||
#[dom_struct]
|
||||
pub struct VRStageParameters {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in rust-webvr"]
|
||||
#[ignore_malloc_size_of = "Defined in rust-webvr"]
|
||||
parameters: DomRefCell<WebVRStageParameters>,
|
||||
transform: Heap<*mut JSObject>,
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ use dom::bindings::trace::JSTraceable;
|
|||
use dom::webglrenderingcontext::WebGLRenderingContext;
|
||||
use fnv::{FnvHashMap, FnvHashSet};
|
||||
use gleam::gl::GLenum;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsval::JSVal;
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
use ref_filter_map::ref_filter_map;
|
||||
use std::cell::Ref;
|
||||
use std::collections::HashMap;
|
||||
|
@ -45,7 +45,7 @@ const DEFAULT_DISABLED_GET_PARAMETER_NAMES: [GLenum; 1] = [
|
|||
];
|
||||
|
||||
/// WebGL features that are enabled/disabled by WebGL Extensions.
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct WebGLExtensionFeatures {
|
||||
gl_extensions: FnvHashSet<String>,
|
||||
disabled_tex_types: FnvHashSet<GLenum>,
|
||||
|
@ -74,7 +74,7 @@ impl Default for WebGLExtensionFeatures {
|
|||
|
||||
/// Handles the list of implemented, supported and enabled WebGL extensions.
|
||||
#[must_root]
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct WebGLExtensions {
|
||||
extensions: DomRefCell<HashMap<String, Box<WebGLExtensionWrapper>>>,
|
||||
features: DomRefCell<WebGLExtensionFeatures>,
|
||||
|
@ -97,7 +97,7 @@ impl WebGLExtensions {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn register<T:'static + WebGLExtension + JSTraceable + HeapSizeOf>(&self) {
|
||||
pub fn register<T:'static + WebGLExtension + JSTraceable + MallocSizeOf>(&self) {
|
||||
let name = T::name().to_uppercase();
|
||||
self.extensions.borrow_mut().insert(name, Box::new(TypedWebGLExtensionWrapper::<T>::new()));
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ impl WebGLExtensions {
|
|||
|
||||
pub fn is_enabled<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + WebGLExtension + JSTraceable + HeapSizeOf
|
||||
T: 'static + WebGLExtension + JSTraceable + MallocSizeOf
|
||||
{
|
||||
let name = T::name().to_uppercase();
|
||||
self.extensions.borrow().get(&name).map_or(false, |ext| { ext.is_enabled() })
|
||||
|
@ -130,7 +130,7 @@ impl WebGLExtensions {
|
|||
|
||||
pub fn get_dom_object<T>(&self) -> Option<DomRoot<T::Extension>>
|
||||
where
|
||||
T: 'static + WebGLExtension + JSTraceable + HeapSizeOf
|
||||
T: 'static + WebGLExtension + JSTraceable + MallocSizeOf
|
||||
{
|
||||
let name = T::name().to_uppercase();
|
||||
self.extensions.borrow().get(&name).and_then(|extension| {
|
||||
|
@ -224,15 +224,15 @@ impl WebGLExtensions {
|
|||
}
|
||||
|
||||
// Helper structs
|
||||
#[derive(Eq, Hash, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Eq, Hash, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
struct TexFormatType(u32, u32);
|
||||
|
||||
type WebGLQueryParameterFunc = Fn(*mut JSContext, &WebGLRenderingContext)
|
||||
-> Result<JSVal, WebGLError>;
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
#[derive(MallocSizeOf)]
|
||||
struct WebGLQueryParameterHandler {
|
||||
#[ignore_heap_size_of = "Closures are hard"]
|
||||
#[ignore_malloc_size_of = "Closures are hard"]
|
||||
func: Box<WebGLQueryParameterFunc>
|
||||
}
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ use dom::bindings::reflector::DomObject;
|
|||
use dom::bindings::root::{DomRoot, MutNullableDom};
|
||||
use dom::bindings::trace::JSTraceable;
|
||||
use dom::webglrenderingcontext::WebGLRenderingContext;
|
||||
use heapsize::HeapSizeOf;
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
use std::any::Any;
|
||||
use super::{WebGLExtension, WebGLExtensions};
|
||||
|
||||
/// Trait used internally by WebGLExtensions to store and
|
||||
/// handle the different WebGL extensions in a common list.
|
||||
pub trait WebGLExtensionWrapper: JSTraceable + HeapSizeOf {
|
||||
pub trait WebGLExtensionWrapper: JSTraceable + MallocSizeOf {
|
||||
fn instance_or_init(&self,
|
||||
ctx: &WebGLRenderingContext,
|
||||
ext: &WebGLExtensions)
|
||||
|
@ -26,7 +26,7 @@ pub trait WebGLExtensionWrapper: JSTraceable + HeapSizeOf {
|
|||
}
|
||||
|
||||
#[must_root]
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct TypedWebGLExtensionWrapper<T: WebGLExtension> {
|
||||
extension: MutNullableDom<T::Extension>
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ impl<T: WebGLExtension> TypedWebGLExtensionWrapper<T> {
|
|||
}
|
||||
|
||||
impl<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
|
||||
where T: WebGLExtension + JSTraceable + HeapSizeOf + 'static {
|
||||
where T: WebGLExtension + JSTraceable + MallocSizeOf + 'static {
|
||||
#[allow(unsafe_code)]
|
||||
fn instance_or_init(&self,
|
||||
ctx: &WebGLRenderingContext,
|
||||
|
@ -82,7 +82,9 @@ impl<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> TypedWebGLExtensionWrapper<T> where T: WebGLExtension + JSTraceable + HeapSizeOf + 'static {
|
||||
impl<T> TypedWebGLExtensionWrapper<T>
|
||||
where T: WebGLExtension + JSTraceable + MallocSizeOf + 'static
|
||||
{
|
||||
pub fn dom_object(&self) -> Option<DomRoot<T::Extension>> {
|
||||
self.extension.get()
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderi
|
|||
/// with gl constants.
|
||||
macro_rules! type_safe_wrapper {
|
||||
($name: ident, $($variant:ident => $mod:ident::$constant:ident, )+) => {
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
#[repr(u32)]
|
||||
pub enum $name {
|
||||
$(
|
||||
|
|
|
@ -27,7 +27,7 @@ pub struct WebGLBuffer {
|
|||
// The Vertex Array Objects that are referencing this buffer
|
||||
vao_references: DomRefCell<Option<HashSet<WebGLVertexArrayId>>>,
|
||||
pending_delete: Cell<bool>,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
#[ignore_malloc_size_of = "Defined in ipc-channel"]
|
||||
renderer: WebGLMsgSender,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use dom_struct::dom_struct;
|
|||
use std::cell::Cell;
|
||||
|
||||
#[must_root]
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
enum WebGLFramebufferAttachment {
|
||||
Renderbuffer(Dom<WebGLRenderbuffer>),
|
||||
Texture { texture: Dom<WebGLTexture>, level: i32 },
|
||||
|
@ -34,7 +34,7 @@ pub struct WebGLFramebuffer {
|
|||
is_deleted: Cell<bool>,
|
||||
size: Cell<Option<(i32, i32)>>,
|
||||
status: Cell<u32>,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
#[ignore_malloc_size_of = "Defined in ipc-channel"]
|
||||
renderer: WebGLMsgSender,
|
||||
|
||||
// The attachment points for textures and renderbuffers on this
|
||||
|
|
|
@ -27,7 +27,7 @@ pub struct WebGLProgram {
|
|||
linked: Cell<bool>,
|
||||
fragment_shader: MutNullableDom<WebGLShader>,
|
||||
vertex_shader: MutNullableDom<WebGLShader>,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
#[ignore_malloc_size_of = "Defined in ipc-channel"]
|
||||
renderer: WebGLMsgSender,
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ pub struct WebGLRenderbuffer {
|
|||
is_deleted: Cell<bool>,
|
||||
size: Cell<Option<(i32, i32)>>,
|
||||
internal_format: Cell<Option<u32>>,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
#[ignore_malloc_size_of = "Defined in ipc-channel"]
|
||||
renderer: WebGLMsgSender,
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue