servo: Merge #20504 - Hide non-Servo heap measurement (from jdm:unbreak); r=bustage
authorJosh Matthews <josh@joshmatthews.net>
Mon, 02 Apr 2018 10:40:02 -0400
changeset 411360 7be2bc137fce5ac01455cf9f4016a6839d7c6a06
parent 411359 24f434072ecd13a2c11742245d019aa242ce1345
child 411361 2cd639e2998fbd04fb2a1a5a3022cf98b87b6f0d
push id101635
push userdluca@mozilla.com
push dateMon, 02 Apr 2018 22:16:27 +0000
treeherdermozilla-inbound@2a199de2ee43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #20504 - Hide non-Servo heap measurement (from jdm:unbreak); r=bustage This hides the changes in #20391 from Gecko builds that use the malloc_size_of crate. Source-Repo: https://github.com/servo/servo Source-Revision: c0bf170a11f61e721ee88d661fa0d97a464fbb69
servo/components/malloc_size_of/Cargo.toml
servo/components/malloc_size_of/lib.rs
--- a/servo/components/malloc_size_of/Cargo.toml
+++ b/servo/components/malloc_size_of/Cargo.toml
@@ -5,36 +5,40 @@ authors = ["The Servo Project Developers
 license = "MIT/Apache-2.0"
 publish = false
 
 [lib]
 path = "lib.rs"
 
 [features]
 servo = [
+    "hyper",
+    "hyper_serde",
     "mozjs",
+    "serde",
     "serde_bytes",
     "string_cache",
+    "time",
     "url",
     "webrender_api",
     "xml5ever",
 ]
 
 [dependencies]
 app_units = "0.6"
 cssparser = "0.23.0"
 euclid = "0.17"
 hashglobe = { path = "../hashglobe" }
-hyper = "0.10"
-hyper_serde = "0.8"
+hyper = { version = "0.10", optional = true }
+hyper_serde = { version = "0.8", optional = true }
 mozjs = { version = "0.6", features = ["promises"], optional = true }
 selectors = { path = "../selectors" }
-serde = "1.0.27"
+serde = { version = "1.0.27", optional = true }
 serde_bytes = { version = "0.10", optional = true }
 servo_arc = { path = "../servo_arc" }
 smallbitvec = "1.0.3"
 smallvec = "0.6"
 string_cache = { version = "0.7", optional = true }
-time = "0.1.17"
+time = { version = "0.1.17", optional = true }
 url = { version = "1.2", optional = true }
 webrender_api = { git = "https://github.com/servo/webrender", features = ["ipc"], optional = true }
 xml5ever = { version = "0.12", optional = true }
 void = "1.0.2"
--- a/servo/components/malloc_size_of/lib.rs
+++ b/servo/components/malloc_size_of/lib.rs
@@ -42,29 +42,33 @@
 //!   fields in structs, because it makes it clear that the Box is being
 //!   measured as well as the thing it points to. E.g.
 //!   `<Box<_> as MallocSizeOf>::size_of(field, ops)`.
 
 extern crate app_units;
 extern crate cssparser;
 extern crate euclid;
 extern crate hashglobe;
+#[cfg(feature = "servo")]
 extern crate hyper;
+#[cfg(feature = "servo")]
 extern crate hyper_serde;
 #[cfg(feature = "servo")]
 extern crate mozjs as js;
 extern crate selectors;
+#[cfg(feature = "servo")]
 extern crate serde;
 #[cfg(feature = "servo")]
 extern crate serde_bytes;
 extern crate servo_arc;
 extern crate smallbitvec;
 extern crate smallvec;
 #[cfg(feature = "servo")]
 extern crate string_cache;
+#[cfg(feature = "servo")]
 extern crate time;
 #[cfg(feature = "url")]
 extern crate url;
 extern crate void;
 #[cfg(feature = "webrender_api")]
 extern crate webrender_api;
 #[cfg(feature = "servo")]
 extern crate xml5ever;
@@ -815,58 +819,66 @@ malloc_size_of_is_0!(webrender_api::Tran
 impl MallocSizeOf for xml5ever::QualName {
     fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
         self.prefix.size_of(ops) +
         self.ns.size_of(ops) +
         self.local.size_of(ops)
     }
 }
 
+#[cfg(feature = "servo")]
 impl MallocSizeOf for hyper::header::Headers {
     fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
         self.iter().fold(0, |acc, x| {
             let name = x.name();
             let raw = self.get_raw(name);
             acc + raw.size_of(ops)
         })
     }
 }
 
+#[cfg(feature = "servo")]
 impl MallocSizeOf for hyper::header::ContentType {
     fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
         self.0.size_of(ops)
     }
 }
 
+#[cfg(feature = "servo")]
 impl MallocSizeOf for hyper::mime::Mime {
     fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
         self.0.size_of(ops) +
         self.1.size_of(ops) +
         self.2.size_of(ops)
     }
 }
 
+#[cfg(feature = "servo")]
 impl MallocSizeOf for hyper::mime::Attr {
     fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
         match *self {
             hyper::mime::Attr::Ext(ref s) => s.size_of(ops),
             _ => 0,
         }
     }
 }
 
+#[cfg(feature = "servo")]
 impl MallocSizeOf for hyper::mime::Value {
     fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
         self.len() // Length of string value in bytes (not the char length of a string)!
     }
 }
 
+#[cfg(feature = "servo")]
 malloc_size_of_is_0!(time::Duration);
+#[cfg(feature = "servo")]
 malloc_size_of_is_0!(time::Tm);
 
+#[cfg(feature = "servo")]
 impl<T> MallocSizeOf for hyper_serde::Serde<T> where
     for <'de> hyper_serde::De<T>: serde::Deserialize<'de>,
     for <'a> hyper_serde::Ser<'a, T>: serde::Serialize,
     T: MallocSizeOf {
     fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
         self.0.size_of(ops)
     }
 }
@@ -874,16 +886,17 @@ impl<T> MallocSizeOf for hyper_serde::Se
 // Placeholder for unique case where internals of Sender cannot be measured.
 // malloc size of is 0 macro complains about type supplied!
 impl<T> MallocSizeOf for std::sync::mpsc::Sender<T> {
     fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
         0
     }
 }
 
+#[cfg(feature = "servo")]
 impl MallocSizeOf for hyper::status::StatusCode {
     fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
         match *self {
             hyper::status::StatusCode::Unregistered(u) => u.size_of(ops),
             _ => 0,
         }
     }
 }