120 exclude_suppressed=[]):
121 """Filters a database to remove interfaces and members that are missing
122 annotations.
123
124 The FremontCut IDLs use annotations to specify implementation
125 status in various platforms. For example, if a member is annotated
126 with @WebKit, this means that the member is supported by WebKit.
127
128 Args:
129 database -- the database to filter
130 all_annotations -- a list of annotation names a member has to
131 have or it will be filtered.
132 or_annotations -- if a member has one of these annotations, it
133 won't be filtered even if it is missing some of the
134 all_annotations.
135 exclude_displaced -- if a member has this annotation and it
136 is marked as displaced it will always be filtered.
137 exclude_suppressed -- if a member has this annotation and it
138 is marked as suppressed it will always be filtered.
139 """
140
141
142 for interface in database.GetInterfaces():
143
144 def HasAnnotations(idl_node):
145 """Utility for determining if an IDLNode has all
146 the required annotations"""
147 for a in exclude_displaced:
148 if (a in idl_node.annotations and
149 'via' in idl_node.annotations[a]):
150 return False
151 for a in exclude_suppressed:
152 if (a in idl_node.annotations and
153 'suppressed' in idl_node.annotations[a]):
154 return False
155 for a in or_annotations:
156 if a in idl_node.annotations:
157 return True
158 if and_annotations == []:
159 return False
160 for a in and_annotations:
161 if a not in idl_node.annotations:
162 return False
163 return True
164
165 if HasAnnotations(interface):
166 interface.constants = filter(HasAnnotations,
167 interface.constants)
168 interface.attributes = filter(HasAnnotations,
169 interface.attributes)
170 interface.operations = filter(HasAnnotations,
171 interface.operations)
172 interface.parents = filter(HasAnnotations, interface.parents)
173 else:
174 database.DeleteInterface(interface.id)
175
176 self.FilterMembersWithUnidentifiedTypes(database)
177