Remove mozjs dep from malloc_size_of.

This commit is contained in:
Josh Matthews 2019-03-27 14:18:18 -04:00
parent 0a5aab6cc2
commit 57d2b5a92d
21 changed files with 30 additions and 16 deletions

1
Cargo.lock generated
View file

@ -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)",

View file

@ -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 }

View file

@ -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(

View file

@ -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.

View file

@ -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>]>,
),
}

View file

@ -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,

View file

@ -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),
}

View file

@ -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>>,

View file

@ -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>>>>,
}

View file

@ -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>>,
}

View file

@ -25,6 +25,7 @@ pub struct ImageData {
reflector_: Reflector,
width: u32,
height: u32,
#[ignore_malloc_size_of = "mozjs"]
data: Heap<*mut JSObject>,
}

View file

@ -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>>,

View file

@ -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,

View file

@ -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>,
}

View file

@ -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>,

View file

@ -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>,
}

View file

@ -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>,
}

View file

@ -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>,

View file

@ -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>,
}

View file

@ -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>,
}

View file

@ -22,6 +22,7 @@ use webvr_traits::WebVRFrameData;
#[dom_struct]
pub struct XRViewerPose {
pose: XRPose,
#[ignore_malloc_size_of = "mozjs"]
views: Heap<JSVal>,
}