mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Add safer bindings for refcounted types across ffi
This commit is contained in:
parent
8fd74e026c
commit
0d4d1b539e
10 changed files with 248 additions and 180 deletions
|
@ -116,6 +116,9 @@ COMPILATION_TARGETS = {
|
|||
"raw_lines": [
|
||||
"use heapsize::HeapSizeOf;",
|
||||
],
|
||||
"flags": [
|
||||
"-ignore-methods",
|
||||
],
|
||||
"match_headers": [
|
||||
"ServoBindings.h",
|
||||
"nsStyleStructList.h",
|
||||
|
@ -145,6 +148,7 @@ COMPILATION_TARGETS = {
|
|||
"void_types": [
|
||||
"nsINode", "nsIDocument", "nsIPrincipal", "nsIURI",
|
||||
],
|
||||
"servo_arc_types": ["ServoComputedValues", "RawServoStyleSheet"]
|
||||
},
|
||||
|
||||
"atoms": {
|
||||
|
@ -300,7 +304,16 @@ def build(objdir, target_name, kind_name=None,
|
|||
for ty in current_target["void_types"]:
|
||||
flags.append("-raw-line")
|
||||
flags.append("pub enum {} {{}}".format(ty))
|
||||
|
||||
if "servo_arc_types" in current_target:
|
||||
for ty in current_target["servo_arc_types"]:
|
||||
flags.append("-blacklist-type")
|
||||
flags.append("{}Strong".format(ty))
|
||||
flags.append("-raw-line")
|
||||
flags.append("pub type {0}Strong = ::sugar::refptr::Strong<{0}>;".format(ty))
|
||||
flags.append("-blacklist-type")
|
||||
flags.append("{}Borrowed".format(ty))
|
||||
flags.append("-raw-line")
|
||||
flags.append("pub type {0}Borrowed<'a> = ::sugar::refptr::Borrowed<'a, {0}>;".format(ty))
|
||||
if "structs_types" in current_target:
|
||||
for ty in current_target["structs_types"]:
|
||||
ty_fragments = ty.split("::")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue