diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2018-01-16 13:29:12 -0800 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2018-01-22 13:59:45 -0800 |
commit | f5dd50dcfd05d74f407735ee4170e3ca2f233243 (patch) | |
tree | ffb991278ecabad3000cec6ec9afb94c0ae7367a | |
parent | 65f549094f4664c5fb1cd8a17dd2cab0ebcf1806 (diff) | |
download | servo-f5dd50dcfd05d74f407735ee4170e3ca2f233243.tar.gz servo-f5dd50dcfd05d74f407735ee4170e3ca2f233243.zip |
Avoid some unnecessary intermediate utf8 strings in glue.rs.
MozReview-Commit-ID: 79qv87uPzjR
-rw-r--r-- | ports/geckolib/glue.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index f155903ac5e..06c76f3e7f0 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -705,14 +705,11 @@ pub extern "C" fn Servo_AnimationValue_Serialize(value: RawServoAnimationValueBo buffer: *mut nsAString) { let uncomputed_value = AnimationValue::as_arc(&value).uncompute(); - let mut string = String::new(); + let buffer = unsafe { buffer.as_mut().unwrap() }; let rv = PropertyDeclarationBlock::with_one(uncomputed_value, Importance::Normal) - .single_value_to_css(&get_property_id_from_nscsspropertyid!(property, ()), &mut string, + .single_value_to_css(&get_property_id_from_nscsspropertyid!(property, ()), buffer, None, None /* No extra custom properties */); debug_assert!(rv.is_ok()); - - let buffer = unsafe { buffer.as_mut().unwrap() }; - buffer.assign_utf8(&string); } #[no_mangle] @@ -2677,16 +2674,11 @@ pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue( let guard = global_style_data.shared_lock.read(); let decls = Locked::<PropertyDeclarationBlock>::as_arc(&declarations).read_with(&guard); - let mut string = String::new(); - let custom_properties = Locked::<PropertyDeclarationBlock>::arc_from_borrowed(&custom_properties); let custom_properties = custom_properties.map(|block| block.read_with(&guard)); - let rv = decls.single_value_to_css( - &property_id, &mut string, computed_values, custom_properties); - debug_assert!(rv.is_ok()); - let buffer = unsafe { buffer.as_mut().unwrap() }; - buffer.assign_utf8(&string); + let rv = decls.single_value_to_css(&property_id, buffer, computed_values, custom_properties); + debug_assert!(rv.is_ok()); } #[no_mangle] |