Add some size tests for ElementData and what's inside.

MozReview-Commit-ID: Aj0rryEnJpl
This commit is contained in:
Bobby Holley 2017-06-06 14:04:32 -07:00
parent 817a2c6cca
commit c369d0708c

View file

@ -3,9 +3,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use selectors::gecko_like_types as dummies;
use servo_arc::Arc;
use std::mem::{size_of, align_of};
use style;
use style::data::{ComputedStyle, ElementData, ElementStyles};
use style::gecko::selector_parser as real;
use style::properties::ComputedValues;
use style::rule_tree::StrongRuleNode;
#[test]
fn size_of_selectors_dummy_types() {
@ -24,6 +28,12 @@ fn size_of_selectors_dummy_types() {
// selectors (with the inline hashes) with as few cache misses as possible.
size_of_test!(test_size_of_rule, style::stylist::Rule, 40);
size_of_test!(test_size_of_option_arc_cv, Option<Arc<ComputedValues>>, 16);
size_of_test!(test_size_of_option_rule_node, Option<StrongRuleNode>, 16);
size_of_test!(test_size_of_computed_style, ComputedStyle, 56);
size_of_test!(test_size_of_element_styles, ElementStyles, 72);
size_of_test!(test_size_of_element_data, ElementData, 88);
size_of_test!(test_size_of_property_declaration, style::properties::PropertyDeclaration, 32);
// This is huge, but we allocate it on the stack and then never move it,