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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_overall.py

Issue 1961883002: Generate separate files for union type containers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 else: 280 else:
281 dependencies_other_component_full_paths.append(full_path) 281 dependencies_other_component_full_paths.append(full_path)
282 282
283 for include_path in partial_interfaces_include_paths: 283 for include_path in partial_interfaces_include_paths:
284 partial_interface_component = idl_filename_to_component(include_path ) 284 partial_interface_component = idl_filename_to_component(include_path )
285 if component == partial_interface_component: 285 if component == partial_interface_component:
286 dependencies_include_paths.append(include_path) 286 dependencies_include_paths.append(include_path)
287 else: 287 else:
288 dependencies_other_component_include_paths.append(include_path) 288 dependencies_other_component_include_paths.append(include_path)
289 289
290 if interface_info['has_union_types']: 290 for union_type in interface_info.get('union_types', []):
291 if union_type.is_nullable:
292 union_type = union_type.inner_type
291 dependencies_include_paths.append( 293 dependencies_include_paths.append(
292 'bindings/%s/v8/UnionTypes%s.h' % (component, component.capitali ze())) 294 'bindings/%s/v8/%s.h' % (component, union_type.name))
293 295
294 interface_info.update({ 296 interface_info.update({
295 'dependencies_full_paths': dependencies_full_paths, 297 'dependencies_full_paths': dependencies_full_paths,
296 'dependencies_include_paths': dependencies_include_paths, 298 'dependencies_include_paths': dependencies_include_paths,
297 'dependencies_other_component_full_paths': 299 'dependencies_other_component_full_paths':
298 dependencies_other_component_full_paths, 300 dependencies_other_component_full_paths,
299 'dependencies_other_component_include_paths': 301 'dependencies_other_component_include_paths':
300 dependencies_other_component_include_paths, 302 dependencies_other_component_include_paths,
301 }) 303 })
302 304
303 # Clean up temporary private information 305 # Clean up temporary private information
304 for interface_info in interfaces_info.itervalues(): 306 for interface_info in interfaces_info.itervalues():
305 del interface_info['extended_attributes'] 307 del interface_info['extended_attributes']
306 del interface_info['has_union_types'] 308 del interface_info['union_types']
307 del interface_info['is_legacy_treat_as_partial_interface'] 309 del interface_info['is_legacy_treat_as_partial_interface']
308 310
309 # Compute global_type_info to interfaces_info so that idl_compiler does 311 # Compute global_type_info to interfaces_info so that idl_compiler does
310 # not need to always calculate the info in __init__. 312 # not need to always calculate the info in __init__.
311 compute_global_type_info() 313 compute_global_type_info()
312 314
313 315
314 ################################################################################ 316 ################################################################################
315 317
316 def main(): 318 def main():
317 options, args = parse_options() 319 options, args = parse_options()
318 # args = Input1, Input2, ..., Output 320 # args = Input1, Input2, ..., Output
319 interfaces_info_filename = args.pop() 321 interfaces_info_filename = args.pop()
320 info_individuals = read_pickle_files(args) 322 info_individuals = read_pickle_files(args)
321 323
322 compute_interfaces_info_overall(info_individuals) 324 compute_interfaces_info_overall(info_individuals)
323 write_pickle_file(interfaces_info_filename, 325 write_pickle_file(interfaces_info_filename,
324 interfaces_info, 326 interfaces_info,
325 options.write_file_only_if_changed) 327 options.write_file_only_if_changed)
326 328
327 329
328 if __name__ == '__main__': 330 if __name__ == '__main__':
329 sys.exit(main()) 331 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698