aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/build_gecko.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2019-03-26 13:26:33 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2019-03-27 14:29:26 +0100
commitecda72a5fd2ca41b1150efc2d80d89eb20f0d388 (patch)
tree6dab9b74159467c8cbe645d16ed97f016c962de1 /components/style/build_gecko.rs
parent02bc29a11b06de7e6de290d5c2f31fda69c8e9b4 (diff)
downloadservo-ecda72a5fd2ca41b1150efc2d80d89eb20f0d388.tar.gz
servo-ecda72a5fd2ca41b1150efc2d80d89eb20f0d388.zip
style: Cleanup refcounted types.
And make the handling of ComputedStyle more similar to these. Differential Revision: https://phabricator.services.mozilla.com/D24703
Diffstat (limited to 'components/style/build_gecko.rs')
-rw-r--r--components/style/build_gecko.rs48
1 files changed, 1 insertions, 47 deletions
diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs
index 6b536c4122b..ba53068be82 100644
--- a/components/style/build_gecko.rs
+++ b/components/style/build_gecko.rs
@@ -220,44 +220,6 @@ mod bindings {
.expect("Unable to write output");
}
- fn get_types(filename: &str, macro_pat: &str) -> Vec<(String, String)> {
- // Read the file
- let path = DISTDIR_PATH.join("include/mozilla/").join(filename);
- let mut list_file = File::open(path).expect(&format!("Unable to open {}", filename));
- let mut content = String::new();
- list_file
- .read_to_string(&mut content)
- .expect(&format!("Failed to read {}", filename));
- // Remove comments
- let block_comment_re = Regex::new(r#"(?s)/\*.*?\*/"#).unwrap();
- let line_comment_re = Regex::new(r#"//.*"#).unwrap();
- let content = block_comment_re.replace_all(&content, "");
- let content = line_comment_re.replace_all(&content, "");
- // Extract the list
- let re_string = format!(r#"^({})\(.+,\s*(\w+)\)$"#, macro_pat);
- let re = Regex::new(&re_string).unwrap();
- content
- .lines()
- .map(|line| line.trim())
- .filter(|line| !line.is_empty())
- .map(|line| {
- let captures = re
- .captures(&line)
- .expect(&format!("Unrecognized line in {}: '{}'", filename, line));
- let macro_name = captures.get(1).unwrap().as_str().to_string();
- let type_name = captures.get(2).unwrap().as_str().to_string();
- (macro_name, type_name)
- })
- .collect()
- }
-
- fn get_arc_types() -> Vec<String> {
- get_types("ServoArcTypeList.h", "SERVO_ARC_TYPE")
- .into_iter()
- .map(|(_, type_name)| type_name)
- .collect()
- }
-
struct BuilderWithConfig<'a> {
builder: Builder,
config: &'a Table,
@@ -434,18 +396,10 @@ mod bindings {
.with_codegen_config(CodegenConfig::FUNCTIONS);
let config = CONFIG["bindings"].as_table().unwrap();
let mut fixups = vec![];
- let mut builder = BuilderWithConfig::new(builder, config)
+ let builder = BuilderWithConfig::new(builder, config)
.handle_common(&mut fixups)
.handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
.get_builder();
- for ty in get_arc_types().iter() {
- builder = builder
- .blacklist_type(format!("{}Strong", ty))
- .raw_line(format!(
- "pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;",
- ty
- ));
- }
write_binding_file(builder, BINDINGS_FILE, &fixups);
}