Auto merge of #15089 - Manishearth:less-vec, r=SimonSapin

Reduce allocator churn when parsing property declaration blocks

fixes #15060

cc @emilio

r? @SimonSapin

<!-- 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/15089)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-18 17:41:05 -08:00 committed by GitHub
commit 5e888b5504
6 changed files with 81 additions and 49 deletions

View file

@ -725,8 +725,6 @@ pub extern "C" fn Servo_ParseProperty(property: *const nsACString, value: *const
_ => return RawServoDeclarationBlockStrong::null(),
}
let results = results.into_iter().map(|r| (r, Importance::Normal)).collect();
Arc::new(RwLock::new(PropertyDeclarationBlock {
declarations: results,
important_count: 0,
@ -864,7 +862,7 @@ fn set_property(declarations: RawServoDeclarationBlockBorrowed, property_id: Pro
let mut declarations = RwLock::<PropertyDeclarationBlock>::as_arc(&declarations).write();
let importance = if is_important { Importance::Important } else { Importance::Normal };
for decl in decls.into_iter() {
declarations.set_parsed_declaration(decl, importance);
declarations.set_parsed_declaration(decl.0, importance);
}
true
} else {