Reverse the dependency between selectors and malloc_size_of

This commit is contained in:
Simon Sapin 2018-01-12 14:07:41 +01:00
parent 0929f72709
commit 5a82a1d455
6 changed files with 11 additions and 7 deletions

3
Cargo.lock generated
View file

@ -1693,6 +1693,7 @@ dependencies = [
"euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
"mozjs 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"servo_arc 0.0.1",
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2717,8 +2718,6 @@ dependencies = [
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -17,6 +17,7 @@ cssparser = "0.23.0"
euclid = "0.16"
hashglobe = { path = "../hashglobe" }
mozjs = { version = "0.1.8", features = ["promises"], optional = true }
selectors = { path = "../selectors" }
servo_arc = { path = "../servo_arc" }
smallbitvec = "1.0.3"
smallvec = "0.6"

View file

@ -49,6 +49,7 @@ extern crate euclid;
extern crate hashglobe;
#[cfg(feature = "servo")]
extern crate mozjs as js;
extern crate selectors;
extern crate servo_arc;
extern crate smallbitvec;
extern crate smallvec;
@ -640,6 +641,13 @@ impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedVector2D<T, U> {
}
}
impl MallocSizeOf for selectors::parser::AncestorHashes {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
let selectors::parser::AncestorHashes { ref packed_hashes } = *self;
packed_hashes.size_of(ops)
}
}
#[cfg(feature = "servo")]
impl<Static: string_cache::StaticAtomSet> MallocSizeOf for string_cache::Atom<Static> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {

View file

@ -26,8 +26,6 @@ matches = "0.1"
cssparser = "0.23.0"
log = "0.3"
fnv = "1.0"
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
phf = "0.7.18"
precomputed-hash = "0.1"
servo_arc = { path = "../servo_arc" }

View file

@ -10,8 +10,6 @@
#[macro_use] extern crate log;
#[macro_use] extern crate matches;
extern crate fnv;
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
extern crate phf;
extern crate precomputed_hash;
#[cfg(test)] #[macro_use] extern crate size_of_test;

View file

@ -266,7 +266,7 @@ where
/// off the upper bits) at the expense of making the fourth somewhat more
/// complicated to assemble, because we often bail out before checking all the
/// hashes.
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AncestorHashes {
pub packed_hashes: [u32; 3],
}