From a892102d4648a3e43bd458c3e106f241444ffc1f Mon Sep 17 00:00:00 2001 From: Kunal Mohan Date: Tue, 10 Dec 2019 21:31:27 +0530 Subject: [PATCH] Make uuid optional and hide it behind servo feature in malloc_size_of --- components/malloc_size_of/Cargo.toml | 3 ++- components/malloc_size_of/lib.rs | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/malloc_size_of/Cargo.toml b/components/malloc_size_of/Cargo.toml index faf2f460893..d2068a30e9b 100644 --- a/components/malloc_size_of/Cargo.toml +++ b/components/malloc_size_of/Cargo.toml @@ -22,6 +22,7 @@ servo = [ "webrender_api", "xml5ever", "content-security-policy", + "uuid" ] [dependencies] @@ -47,4 +48,4 @@ url = { version = "2.0", optional = true } webrender_api = { git = "https://github.com/servo/webrender", optional = true } xml5ever = { version = "0.16", optional = true } void = "1.0.2" -uuid = {version = "0.8", features = ["v4", "serde"]} +uuid = {version = "0.8", features = ["v4"], optional = true} diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index 520c4da4a8b..8593ccc3622 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -75,6 +75,7 @@ extern crate thin_slice; extern crate time; #[cfg(feature = "url")] extern crate url; +#[cfg(feature = "servo")] extern crate uuid; extern crate void; #[cfg(feature = "webrender_api")] @@ -91,6 +92,7 @@ use std::mem::size_of; use std::ops::Range; use std::ops::{Deref, DerefMut}; use std::os::raw::c_void; +#[cfg(feature = "servo")] use uuid::Uuid; use void::Void; @@ -822,7 +824,7 @@ macro_rules! malloc_size_of_is_0( ); ); -malloc_size_of_is_0!(bool, char, str, Uuid); +malloc_size_of_is_0!(bool, char, str); malloc_size_of_is_0!(u8, u16, u32, u64, u128, usize); malloc_size_of_is_0!(i8, i16, i32, i64, i128, isize); malloc_size_of_is_0!(f32, f64); @@ -842,6 +844,9 @@ malloc_size_of_is_0!(cssparser::RGBA, cssparser::TokenSerializationType); #[cfg(feature = "servo")] malloc_size_of_is_0!(csp::Destination); +#[cfg(feature = "servo")] +malloc_size_of_is_0!(Uuid); + #[cfg(feature = "url")] impl MallocSizeOf for url::Host { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {