mirror of
https://github.com/servo/servo.git
synced 2025-08-29 17:18:23 +01:00
Auto merge of #17707 - emilio:invalidation-less-memory, r=heycam
stylo: Waste less memory in invalidation stuff and style rules. This should help a lot with https://bugzilla.mozilla.org/show_bug.cgi?id=1380488. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17707) <!-- Reviewable:end -->
This commit is contained in:
commit
9515abbca3
10 changed files with 71 additions and 140 deletions
|
@ -2,8 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use style::invalidation::element::invalidation_map::Dependency;
|
||||
use style::properties;
|
||||
|
||||
size_of_test!(test_size_of_dependency, Dependency, 16);
|
||||
|
||||
size_of_test!(test_size_of_property_declaration, properties::PropertyDeclaration, 32);
|
||||
|
||||
// This is huge, but we allocate it on the stack and then never move it,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
use cssparser::SourceLocation;
|
||||
use euclid::TypedSize2D;
|
||||
use html5ever::LocalName;
|
||||
use selectors::parser::{AncestorHashes, Selector};
|
||||
use selectors::parser::LocalName as LocalNameSelector;
|
||||
use selectors::parser::Selector;
|
||||
use servo_atoms::Atom;
|
||||
use style::context::QuirksMode;
|
||||
use style::media_queries::{Device, MediaType};
|
||||
|
@ -45,7 +45,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
|
|||
let guard = shared_lock.read();
|
||||
let rule = locked.read_with(&guard);
|
||||
rule.selectors.0.iter().map(|s| {
|
||||
Rule::new(s.selector.clone(), s.hashes.clone(), locked.clone(), i as u32)
|
||||
Rule::new(s.clone(), AncestorHashes::new(s), locked.clone(), i as u32)
|
||||
}).collect()
|
||||
}).collect(), shared_lock)
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ fn parse_selectors(selectors: &[&str]) -> Vec<Selector<SelectorImpl>> {
|
|||
.map(|x| SelectorParser::parse_author_origin_no_namespace(x).unwrap().0
|
||||
.into_iter()
|
||||
.nth(0)
|
||||
.unwrap().selector)
|
||||
.unwrap())
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue