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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 code changes (for inherited extended attributes). | 79 code changes (for inherited extended attributes). |
80 | 80 |
81 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 81 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
82 """ | 82 """ |
83 | 83 |
84 from collections import defaultdict | 84 from collections import defaultdict |
85 import cPickle as pickle | 85 import cPickle as pickle |
86 import optparse | 86 import optparse |
87 import sys | 87 import sys |
88 | 88 |
89 from utilities import idl_filename_to_component, read_pickle_files, write_pickle _file | 89 from utilities import idl_filename_to_component, read_pickle_files, write_pickle _file, merge_dict_recursively |
90 | 90 |
91 INHERITED_EXTENDED_ATTRIBUTES = set([ | 91 INHERITED_EXTENDED_ATTRIBUTES = set([ |
92 'ActiveDOMObject', | 92 'ActiveDOMObject', |
93 'DependentLifetime', | 93 'DependentLifetime', |
94 'DoNotExposeJSAccessors', | 94 'DoNotExposeJSAccessors', |
95 'ExposeJSAccessors', | 95 'ExposeJSAccessors', |
96 'GarbageCollected', | 96 'GarbageCollected', |
97 'WillBeGarbageCollected', | 97 'WillBeGarbageCollected', |
98 ]) | 98 ]) |
99 | 99 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 interfaces_info['garbage_collected_interfaces'] = garbage_collected_interfac es | 200 interfaces_info['garbage_collected_interfaces'] = garbage_collected_interfac es |
201 interfaces_info['will_be_garbage_collected_interfaces'] = will_be_garbage_co llected_interfaces | 201 interfaces_info['will_be_garbage_collected_interfaces'] = will_be_garbage_co llected_interfaces |
202 interfaces_info['component_dirs'] = component_dirs | 202 interfaces_info['component_dirs'] = component_dirs |
203 | 203 |
204 | 204 |
205 def compute_interfaces_info_overall(info_individuals): | 205 def compute_interfaces_info_overall(info_individuals): |
206 """Compute information about IDL files. | 206 """Compute information about IDL files. |
207 | 207 |
208 Information is stored in global interfaces_info. | 208 Information is stored in global interfaces_info. |
209 """ | 209 """ |
210 is_first_info = True | |
210 for info in info_individuals: | 211 for info in info_individuals: |
211 # No overlap between interface names, so ok to use dict.update | 212 if is_first_info: |
bashi
2015/07/28 00:38:47
Could you explain what you want to do by this chan
Yuki
2015/07/29 08:16:24
It turned out that it's totally unnecessary. Remo
| |
212 interfaces_info.update(info['interfaces_info']) | 213 is_first_info = False |
214 interfaces_info.update(info['interfaces_info']) | |
215 else: | |
216 merge_dict_recursively(interfaces_info, info['interfaces_info']) | |
213 # Interfaces in one component may have partial interfaces in | 217 # Interfaces in one component may have partial interfaces in |
214 # another component. This is ok (not a layering violation), since | 218 # another component. This is ok (not a layering violation), since |
215 # partial interfaces are used to *extend* interfaces. | 219 # partial interfaces are used to *extend* interfaces. |
216 # We thus need to update or append if already present | 220 # We thus need to update or append if already present |
217 dict_of_dicts_of_lists_update_or_append( | 221 dict_of_dicts_of_lists_update_or_append( |
218 partial_interface_files, info['partial_interface_files']) | 222 partial_interface_files, info['partial_interface_files']) |
219 | 223 |
220 # Record inheritance information individually | 224 # Record inheritance information individually |
221 for interface_name, interface_info in interfaces_info.iteritems(): | 225 for interface_name, interface_info in interfaces_info.iteritems(): |
222 extended_attributes = interface_info['extended_attributes'] | 226 extended_attributes = interface_info['extended_attributes'] |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 dependencies_other_component_full_paths, | 312 dependencies_other_component_full_paths, |
309 'dependencies_other_component_include_paths': | 313 'dependencies_other_component_include_paths': |
310 dependencies_other_component_include_paths, | 314 dependencies_other_component_include_paths, |
311 }) | 315 }) |
312 | 316 |
313 # Clean up temporary private information | 317 # Clean up temporary private information |
314 for interface_info in interfaces_info.itervalues(): | 318 for interface_info in interfaces_info.itervalues(): |
315 del interface_info['extended_attributes'] | 319 del interface_info['extended_attributes'] |
316 del interface_info['has_union_types'] | 320 del interface_info['has_union_types'] |
317 del interface_info['is_legacy_treat_as_partial_interface'] | 321 del interface_info['is_legacy_treat_as_partial_interface'] |
318 del interface_info['parent'] | |
319 | 322 |
320 # Compute global_type_info to interfaces_info so that idl_compiler does | 323 # Compute global_type_info to interfaces_info so that idl_compiler does |
321 # not need to always calculate the info in __init__. | 324 # not need to always calculate the info in __init__. |
322 compute_global_type_info() | 325 compute_global_type_info() |
323 | 326 |
324 | 327 |
325 ################################################################################ | 328 ################################################################################ |
326 | 329 |
327 def main(): | 330 def main(): |
328 options, args = parse_options() | 331 options, args = parse_options() |
329 # args = Input1, Input2, ..., Output | 332 # args = Input1, Input2, ..., Output |
330 interfaces_info_filename = args.pop() | 333 interfaces_info_filename = args.pop() |
331 info_individuals = read_pickle_files(args) | 334 info_individuals = read_pickle_files(args) |
332 | 335 |
333 compute_interfaces_info_overall(info_individuals) | 336 compute_interfaces_info_overall(info_individuals) |
334 write_pickle_file(interfaces_info_filename, | 337 write_pickle_file(interfaces_info_filename, |
335 interfaces_info, | 338 interfaces_info, |
336 options.write_file_only_if_changed) | 339 options.write_file_only_if_changed) |
337 | 340 |
338 | 341 |
339 if __name__ == '__main__': | 342 if __name__ == '__main__': |
340 sys.exit(main()) | 343 sys.exit(main()) |
OLD | NEW |