diff options
21 files changed, 30 insertions, 16 deletions
diff --git a/Cargo.lock b/Cargo.lock index 334d517ae5f..c0f4db1e2c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2579,7 +2579,6 @@ dependencies = [ "hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", "hyper_serde 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "mozjs 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.21.0", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/malloc_size_of/Cargo.toml b/components/malloc_size_of/Cargo.toml index e7acb0de25e..609a977b1dd 100644 --- a/components/malloc_size_of/Cargo.toml +++ b/components/malloc_size_of/Cargo.toml @@ -14,7 +14,6 @@ servo = [ "hyper", "hyper_serde", "keyboard-types", - "mozjs", "serde", "serde_bytes", "string_cache", @@ -33,7 +32,6 @@ hashglobe = { path = "../hashglobe" } hyper = { version = "0.12", optional = true } hyper_serde = { version = "0.9", optional = true } keyboard-types = {version = "0.4.3", optional = true} -mozjs = { version = "0.10.0", optional = true} selectors = { path = "../selectors" } serde = { version = "1.0.27", optional = true } serde_bytes = { version = "0.10", optional = true } diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index bb4fe1a6adc..b59e26391ef 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -58,8 +58,6 @@ extern crate hyper; extern crate hyper_serde; #[cfg(feature = "servo")] extern crate keyboard_types; -#[cfg(feature = "servo")] -extern crate mozjs as js; extern crate selectors; #[cfg(feature = "servo")] extern crate serde; @@ -798,15 +796,6 @@ impl<Static: string_cache::StaticAtomSet> MallocSizeOf for string_cache::Atom<St } } -// This is measured properly by the heap measurement implemented in -// SpiderMonkey. -#[cfg(feature = "servo")] -impl<T: Copy + js::rust::GCMethods> MallocSizeOf for js::jsapi::Heap<T> { - fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize { - 0 - } -} - /// For use on types where size_of() returns 0. #[macro_export] macro_rules! malloc_size_of_is_0( diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index a021b61ac8c..cabd281dc63 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -42,6 +42,7 @@ type JSAudioChannel = Heap<*mut JSObject>; pub struct AudioBuffer { reflector_: Reflector, /// Float32Arrays returned by calls to GetChannelData. + #[ignore_malloc_size_of = "mozjs"] js_channels: DomRefCell<Vec<JSAudioChannel>>, /// Aggregates the data from js_channels. /// This is Some<T> iff the buffers in js_channels are detached. diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 3d329119f4e..39824e334a2 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -719,7 +719,7 @@ pub enum CustomElementReaction { Upgrade(#[ignore_malloc_size_of = "Rc"] Rc<CustomElementDefinition>), Callback( #[ignore_malloc_size_of = "Rc"] Rc<Function>, - Box<[Heap<JSVal>]>, + #[ignore_malloc_size_of = "mozjs"] Box<[Heap<JSVal>]>, ), } diff --git a/components/script/dom/extendablemessageevent.rs b/components/script/dom/extendablemessageevent.rs index f9c2de13a4b..7fd16aafec4 100644 --- a/components/script/dom/extendablemessageevent.rs +++ b/components/script/dom/extendablemessageevent.rs @@ -24,6 +24,7 @@ use servo_atoms::Atom; #[dom_struct] pub struct ExtendableMessageEvent { event: ExtendableEvent, + #[ignore_malloc_size_of = "mozjs"] data: Heap<JSVal>, origin: DOMString, lastEventId: DOMString, diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 6092dcc9935..55989078d4f 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -83,7 +83,7 @@ pub enum FileReaderReadyState { #[derive(JSTraceable, MallocSizeOf)] pub enum FileReaderResult { - ArrayBuffer(Heap<JSVal>), + ArrayBuffer(#[ignore_malloc_size_of = "mozjs"] Heap<JSVal>), String(DOMString), } diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs index 3e65b0a11f5..fe86a3b2329 100644 --- a/components/script/dom/gamepad.rs +++ b/components/script/dom/gamepad.rs @@ -32,6 +32,7 @@ pub struct Gamepad { connected: Cell<bool>, timestamp: Cell<f64>, mapping_type: String, + #[ignore_malloc_size_of = "mozjs"] axes: Heap<*mut JSObject>, buttons: Dom<GamepadButtonList>, pose: Option<Dom<VRPose>>, diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 91112299034..33458bf2ece 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -145,6 +145,7 @@ pub struct GlobalScope { /// they're consumed before it'd be reported. /// /// <https://html.spec.whatwg.org/multipage/#about-to-be-notified-rejected-promises-list> + #[ignore_malloc_size_of = "mozjs"] uncaught_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>, /// Promises in this list have previously been reported as rejected @@ -152,6 +153,7 @@ pub struct GlobalScope { /// in the last turn of the event loop. /// /// <https://html.spec.whatwg.org/multipage/#outstanding-rejected-promises-weak-set> + #[ignore_malloc_size_of = "mozjs"] consumed_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>, } diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index e468b79440c..787591af8a3 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -40,6 +40,7 @@ enum PushOrReplace { pub struct History { reflector_: Reflector, window: Dom<Window>, + #[ignore_malloc_size_of = "mozjs"] state: Heap<JSVal>, state_id: Cell<Option<HistoryStateId>>, } diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 9566c7b0f39..29c15f665a4 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -25,6 +25,7 @@ pub struct ImageData { reflector_: Reflector, width: u32, height: u32, + #[ignore_malloc_size_of = "mozjs"] data: Heap<*mut JSObject>, } diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index edde48f95e6..c02df1e8e61 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -25,6 +25,7 @@ use std::ptr::NonNull; #[dom_struct] pub struct MessageEvent { event: Event, + #[ignore_malloc_size_of = "mozjs"] data: Heap<JSVal>, origin: DOMString, source: Option<Dom<WindowProxy>>, diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index fe119eefbf3..89b9907c95c 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -76,6 +76,7 @@ pub struct PaintWorkletGlobalScope { /// <https://drafts.css-houdini.org/css-paint-api/#paint-definitions> paint_definitions: DomRefCell<HashMap<Atom, Box<PaintDefinition>>>, /// <https://drafts.css-houdini.org/css-paint-api/#paint-class-instances> + #[ignore_malloc_size_of = "mozjs"] paint_class_instances: DomRefCell<HashMap<Atom, Box<Heap<JSVal>>>>, /// The most recent name the worklet was called with cached_name: DomRefCell<Atom>, @@ -473,7 +474,9 @@ pub enum PaintWorkletTask { #[derive(JSTraceable, MallocSizeOf)] #[must_root] struct PaintDefinition { + #[ignore_malloc_size_of = "mozjs"] class_constructor: Heap<JSVal>, + #[ignore_malloc_size_of = "mozjs"] paint_function: Heap<JSVal>, constructor_valid_flag: Cell<bool>, context_alpha_flag: bool, diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs index 2a212ab48bc..b7ea63bbd3e 100644 --- a/components/script/dom/vreyeparameters.rs +++ b/components/script/dom/vreyeparameters.rs @@ -22,6 +22,7 @@ pub struct VREyeParameters { reflector_: Reflector, #[ignore_malloc_size_of = "Defined in rust-webvr"] parameters: DomRefCell<WebVREyeParameters>, + #[ignore_malloc_size_of = "mozjs"] offset: Heap<*mut JSObject>, fov: Dom<VRFieldOfView>, } diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs index 08acd74bb42..25f6af821a7 100644 --- a/components/script/dom/vrframedata.rs +++ b/components/script/dom/vrframedata.rs @@ -22,9 +22,13 @@ use webvr_traits::WebVRFrameData; #[dom_struct] pub struct VRFrameData { reflector_: Reflector, + #[ignore_malloc_size_of = "mozjs"] left_proj: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] left_view: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] right_proj: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] right_view: Heap<*mut JSObject>, pose: Dom<VRPose>, timestamp: Cell<f64>, diff --git a/components/script/dom/vrpose.rs b/components/script/dom/vrpose.rs index c807ab72c91..90bca0956ee 100644 --- a/components/script/dom/vrpose.rs +++ b/components/script/dom/vrpose.rs @@ -17,11 +17,17 @@ use webvr_traits::webvr; #[dom_struct] pub struct VRPose { reflector_: Reflector, + #[ignore_malloc_size_of = "mozjs"] position: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] orientation: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] linear_vel: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] angular_vel: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] linear_acc: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] angular_acc: Heap<*mut JSObject>, } diff --git a/components/script/dom/vrstageparameters.rs b/components/script/dom/vrstageparameters.rs index ffbe6ce0f3f..41184091232 100644 --- a/components/script/dom/vrstageparameters.rs +++ b/components/script/dom/vrstageparameters.rs @@ -21,6 +21,7 @@ pub struct VRStageParameters { reflector_: Reflector, #[ignore_malloc_size_of = "Defined in rust-webvr"] parameters: DomRefCell<WebVRStageParameters>, + #[ignore_malloc_size_of = "mozjs"] transform: Heap<*mut JSObject>, } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 0b86f0eeb1c..3b9622b3cfb 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -137,6 +137,7 @@ pub struct XMLHttpRequest { response_type: Cell<XMLHttpRequestResponseType>, response_xml: MutNullableDom<Document>, response_blob: MutNullableDom<Blob>, + #[ignore_malloc_size_of = "mozjs"] response_arraybuffer: Heap<*mut JSObject>, #[ignore_malloc_size_of = "Defined in rust-mozjs"] response_json: Heap<JSVal>, diff --git a/components/script/dom/xrrigidtransform.rs b/components/script/dom/xrrigidtransform.rs index 969ec839292..1d8ae2d9996 100644 --- a/components/script/dom/xrrigidtransform.rs +++ b/components/script/dom/xrrigidtransform.rs @@ -27,6 +27,7 @@ pub struct XRRigidTransform { #[ignore_malloc_size_of = "defined in euclid"] transform: RigidTransform3D<f64>, inverse: MutNullableDom<XRRigidTransform>, + #[ignore_malloc_size_of = "defined in mozjs"] matrix: Heap<*mut JSObject>, } diff --git a/components/script/dom/xrview.rs b/components/script/dom/xrview.rs index a2eee03581d..c53eb8cb947 100644 --- a/components/script/dom/xrview.rs +++ b/components/script/dom/xrview.rs @@ -21,7 +21,9 @@ pub struct XRView { reflector_: Reflector, session: Dom<XRSession>, eye: XREye, + #[ignore_malloc_size_of = "mozjs"] proj: Heap<*mut JSObject>, + #[ignore_malloc_size_of = "mozjs"] view: Heap<*mut JSObject>, transform: Dom<XRRigidTransform>, } diff --git a/components/script/dom/xrviewerpose.rs b/components/script/dom/xrviewerpose.rs index 717fdcea16e..92caa7f037b 100644 --- a/components/script/dom/xrviewerpose.rs +++ b/components/script/dom/xrviewerpose.rs @@ -22,6 +22,7 @@ use webvr_traits::WebVRFrameData; #[dom_struct] pub struct XRViewerPose { pose: XRPose, + #[ignore_malloc_size_of = "mozjs"] views: Heap<JSVal>, } |