OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (C) 2013 Google Inc. All rights reserved. | 3 # Copyright (C) 2013 Google Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 interfaces.add(interface_name) | 252 interfaces.add(interface_name) |
253 # Non-partial interfaces default to having bindings generated | 253 # Non-partial interfaces default to having bindings generated |
254 dependencies[full_path] = [] | 254 dependencies[full_path] = [] |
255 extended_attributes = get_interface_extended_attributes_from_idl(idl_fil
e_contents) | 255 extended_attributes = get_interface_extended_attributes_from_idl(idl_fil
e_contents) |
256 | 256 |
257 # Parse 'identifier-A implements identifier-B;' statements | 257 # Parse 'identifier-A implements identifier-B;' statements |
258 implemented_interfaces = get_implemented_interfaces_from_idl(idl_file_co
ntents, interface_name) | 258 implemented_interfaces = get_implemented_interfaces_from_idl(idl_file_co
ntents, interface_name) |
259 implements_interfaces[interface_name] = implemented_interfaces | 259 implements_interfaces[interface_name] = implemented_interfaces |
260 implemented_somewhere |= set(implemented_interfaces) | 260 implemented_somewhere |= set(implemented_interfaces) |
261 | 261 |
262 # Record global constructors | 262 if idl_file_name.find('testing') == -1: |
263 if not is_callback_interface_from_idl(idl_file_contents) and 'NoInterfac
eObject' not in extended_attributes: | 263 # Record global constructors |
264 global_contexts = extended_attributes.get('GlobalContext', 'Window')
.split('&') | 264 if not is_callback_interface_from_idl(idl_file_contents) and 'NoInte
rfaceObject' not in extended_attributes: |
265 new_constructor_list = generate_constructor_attribute_list(interface
_name, extended_attributes) | 265 global_contexts = extended_attributes.get('GlobalContext', 'Wind
ow').split('&') |
266 for global_object in global_contexts: | 266 new_constructor_list = generate_constructor_attribute_list(inter
face_name, extended_attributes) |
267 global_constructors[global_object].extend(new_constructor_list) | 267 for global_object in global_contexts: |
| 268 global_constructors[global_object].extend(new_constructor_li
st) |
268 | 269 |
269 # Record parents and extended attributes for generating event names | 270 # Record parents and extended attributes for generating event names |
270 if interface_name == 'Event': | 271 if interface_name == 'Event': |
271 interface_extended_attribute[interface_name] = extended_attributes | 272 interface_extended_attribute[interface_name] = extended_attribut
es |
272 parent = get_parent_interface(idl_file_contents) | 273 parent = get_parent_interface(idl_file_contents) |
273 if parent: | 274 if parent: |
274 parent_interface[interface_name] = parent | 275 parent_interface[interface_name] = parent |
275 interface_extended_attribute[interface_name] = extended_attributes | 276 interface_extended_attribute[interface_name] = extended_attribut
es |
276 | 277 |
277 # Add constructors on global objects to partial interfaces | 278 # Add constructors on global objects to partial interfaces |
278 for global_object, filename in global_constructors_filenames.iteritems(): | 279 for global_object, filename in global_constructors_filenames.iteritems(): |
279 if global_object in interfaces: | 280 if global_object in interfaces: |
280 partial_interface_files[global_object].append(filename) | 281 partial_interface_files[global_object].append(filename) |
281 | 282 |
282 # Interfaces that are implemented by another interface do not have | 283 # Interfaces that are implemented by another interface do not have |
283 # their own bindings generated, as this would be redundant with the | 284 # their own bindings generated, as this would be redundant with the |
284 # actual implementation. | 285 # actual implementation. |
285 for implemented_interface in implemented_somewhere: | 286 for implemented_interface in implemented_somewhere: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 353 |
353 write_dependency_file(options.interface_dependencies_file, dependencies, onl
y_if_changed) | 354 write_dependency_file(options.interface_dependencies_file, dependencies, onl
y_if_changed) |
354 for interface_name, filename in global_constructors_filenames.iteritems(): | 355 for interface_name, filename in global_constructors_filenames.iteritems(): |
355 if interface_name in interfaces: | 356 if interface_name in interfaces: |
356 generate_global_constructors_partial_interface(interface_name, filen
ame, global_constructors[interface_name], only_if_changed) | 357 generate_global_constructors_partial_interface(interface_name, filen
ame, global_constructors[interface_name], only_if_changed) |
357 generate_event_names_file(options.event_names_file, event_names, only_if_cha
nged) | 358 generate_event_names_file(options.event_names_file, event_names, only_if_cha
nged) |
358 | 359 |
359 | 360 |
360 if __name__ == '__main__': | 361 if __name__ == '__main__': |
361 main() | 362 main() |
OLD | NEW |