Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1667)

Side by Side Diff: bindings/scripts/compute_interfaces_info_overall.py

Issue 2786203002: Roll 50: Copied IDLs, PYTHON scripts from WebKit removed deleted files in WebCore (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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',
93 'DependentLifetime', 92 'DependentLifetime',
94 'DoNotExposeJSAccessors',
95 'ExposeJSAccessors',
96 'GarbageCollected', 93 'GarbageCollected',
97 'WillBeGarbageCollected', 94 'WillBeGarbageCollected',
98 ]) 95 ])
99 96
100 # Main variable (filled in and exported) 97 # Main variable (filled in and exported)
101 interfaces_info = {} 98 interfaces_info = {}
102 99
103 # Auxiliary variables (not visible to future build steps) 100 # Auxiliary variables (not visible to future build steps)
104 partial_interface_files = defaultdict(lambda: { 101 partial_interface_files = defaultdict(lambda: {
105 'full_paths': [], 102 'full_paths': [],
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 interfaces_info['will_be_garbage_collected_interfaces'] = will_be_garbage_co llected_interfaces 198 interfaces_info['will_be_garbage_collected_interfaces'] = will_be_garbage_co llected_interfaces
202 interfaces_info['component_dirs'] = component_dirs 199 interfaces_info['component_dirs'] = component_dirs
203 200
204 201
205 def compute_interfaces_info_overall(info_individuals): 202 def compute_interfaces_info_overall(info_individuals):
206 """Compute information about IDL files. 203 """Compute information about IDL files.
207 204
208 Information is stored in global interfaces_info. 205 Information is stored in global interfaces_info.
209 """ 206 """
210 for info in info_individuals: 207 for info in info_individuals:
211 # No overlap between interface names, so ok to use dict.update 208 merge_dict_recursively(interfaces_info, info['interfaces_info'])
212 interfaces_info.update(info['interfaces_info'])
213 # Interfaces in one component may have partial interfaces in 209 # Interfaces in one component may have partial interfaces in
214 # another component. This is ok (not a layering violation), since 210 # another component. This is ok (not a layering violation), since
215 # partial interfaces are used to *extend* interfaces. 211 # partial interfaces are used to *extend* interfaces.
216 # We thus need to update or append if already present 212 # We thus need to update or append if already present
217 dict_of_dicts_of_lists_update_or_append( 213 dict_of_dicts_of_lists_update_or_append(
218 partial_interface_files, info['partial_interface_files']) 214 partial_interface_files, info['partial_interface_files'])
219 215
220 # Record inheritance information individually 216 # Record inheritance information individually
221 for interface_name, interface_info in interfaces_info.iteritems(): 217 for interface_name, interface_info in interfaces_info.iteritems():
222 extended_attributes = interface_info['extended_attributes'] 218 extended_attributes = interface_info['extended_attributes']
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 dependencies_other_component_full_paths, 304 dependencies_other_component_full_paths,
309 'dependencies_other_component_include_paths': 305 'dependencies_other_component_include_paths':
310 dependencies_other_component_include_paths, 306 dependencies_other_component_include_paths,
311 }) 307 })
312 308
313 # Clean up temporary private information 309 # Clean up temporary private information
314 for interface_info in interfaces_info.itervalues(): 310 for interface_info in interfaces_info.itervalues():
315 del interface_info['extended_attributes'] 311 del interface_info['extended_attributes']
316 del interface_info['has_union_types'] 312 del interface_info['has_union_types']
317 del interface_info['is_legacy_treat_as_partial_interface'] 313 del interface_info['is_legacy_treat_as_partial_interface']
318 del interface_info['parent']
319 314
320 # Compute global_type_info to interfaces_info so that idl_compiler does 315 # Compute global_type_info to interfaces_info so that idl_compiler does
321 # not need to always calculate the info in __init__. 316 # not need to always calculate the info in __init__.
322 compute_global_type_info() 317 compute_global_type_info()
323 318
324 319
325 ################################################################################ 320 ################################################################################
326 321
327 def main(): 322 def main():
328 options, args = parse_options() 323 options, args = parse_options()
329 # args = Input1, Input2, ..., Output 324 # args = Input1, Input2, ..., Output
330 interfaces_info_filename = args.pop() 325 interfaces_info_filename = args.pop()
331 info_individuals = read_pickle_files(args) 326 info_individuals = read_pickle_files(args)
332 327
333 compute_interfaces_info_overall(info_individuals) 328 compute_interfaces_info_overall(info_individuals)
334 write_pickle_file(interfaces_info_filename, 329 write_pickle_file(interfaces_info_filename,
335 interfaces_info, 330 interfaces_info,
336 options.write_file_only_if_changed) 331 options.write_file_only_if_changed)
337 332
338 333
339 if __name__ == '__main__': 334 if __name__ == '__main__':
340 sys.exit(main()) 335 sys.exit(main())
OLDNEW
« no previous file with comments | « bindings/scripts/compute_interfaces_info_individual.py ('k') | bindings/scripts/generate_event_interfaces.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698