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

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

Issue 1974143002: Revert of 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 extended_attributes = definition.extended_attributes 259 extended_attributes = definition.extended_attributes
260 implemented_as = extended_attributes.get('ImplementedAs') 260 implemented_as = extended_attributes.get('ImplementedAs')
261 full_path = os.path.realpath(idl_filename) 261 full_path = os.path.realpath(idl_filename)
262 this_include_path = None if 'NoImplHeader' in extended_attributes else i nclude_path(idl_filename, implemented_as) 262 this_include_path = None if 'NoImplHeader' in extended_attributes else i nclude_path(idl_filename, implemented_as)
263 if definition.is_partial: 263 if definition.is_partial:
264 # We don't create interface_info for partial interfaces, but 264 # We don't create interface_info for partial interfaces, but
265 # adds paths to another dict. 265 # adds paths to another dict.
266 partial_include_paths = [] 266 partial_include_paths = []
267 if this_include_path: 267 if this_include_path:
268 partial_include_paths.append(this_include_path) 268 partial_include_paths.append(this_include_path)
269 for union_type in this_union_types: 269 if this_union_types:
270 if union_type.is_nullable:
271 union_type = union_type.inner_type
272 partial_include_paths.append( 270 partial_include_paths.append(
273 'bindings/%s/v8/%s.h' % (component, union_type.name)) 271 'bindings/%s/v8/UnionTypes%s.h' % (component, component.capi talize()))
274 self.add_paths_to_partials_dict(definition.name, full_path, partial_ include_paths) 272 self.add_paths_to_partials_dict(definition.name, full_path, partial_ include_paths)
275 # Collects C++ header paths which should be included from generated 273 # Collects C++ header paths which should be included from generated
276 # .cpp files. The resulting structure is as follows. 274 # .cpp files. The resulting structure is as follows.
277 # interfaces_info[interface_name] = { 275 # interfaces_info[interface_name] = {
278 # 'cpp_includes': { 276 # 'cpp_includes': {
279 # 'core': set(['core/foo/Foo.h', ...]), 277 # 'core': set(['core/foo/Foo.h', ...]),
280 # 'modules': set(['modules/bar/Bar.h', ...]), 278 # 'modules': set(['modules/bar/Bar.h', ...]),
281 # }, 279 # },
282 # ... 280 # ...
283 # } 281 # }
284 if this_include_path: 282 if this_include_path:
285 merge_dict_recursively( 283 merge_dict_recursively(
286 self.interfaces_info[definition.name], 284 self.interfaces_info[definition.name],
287 {'cpp_includes': {component: set([this_include_path])}}) 285 {'cpp_includes': {component: set([this_include_path])}})
288 return 286 return
289 287
290 # 'implements' statements can be included in either the file for the 288 # 'implements' statements can be included in either the file for the
291 # implement*ing* interface (lhs of 'implements') or implement*ed* interf ace 289 # implement*ing* interface (lhs of 'implements') or implement*ed* interf ace
292 # (rhs of 'implements'). Store both for now, then merge to implement*ing * 290 # (rhs of 'implements'). Store both for now, then merge to implement*ing *
293 # interface later. 291 # interface later.
294 left_interfaces, right_interfaces = get_implements_from_definitions( 292 left_interfaces, right_interfaces = get_implements_from_definitions(
295 definitions, definition.name) 293 definitions, definition.name)
296 294
297 interface_info.update({ 295 interface_info.update({
298 'extended_attributes': extended_attributes, 296 'extended_attributes': extended_attributes,
299 'full_path': full_path, 297 'full_path': full_path,
300 'union_types': this_union_types, 298 'has_union_types': bool(this_union_types),
301 'implemented_as': implemented_as, 299 'implemented_as': implemented_as,
302 'implemented_by_interfaces': left_interfaces, 300 'implemented_by_interfaces': left_interfaces,
303 'implements_interfaces': right_interfaces, 301 'implements_interfaces': right_interfaces,
304 'include_path': this_include_path, 302 'include_path': this_include_path,
305 # FIXME: temporary private field, while removing old treatement of 303 # FIXME: temporary private field, while removing old treatement of
306 # 'implements': http://crbug.com/360435 304 # 'implements': http://crbug.com/360435
307 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterfa ce' in extended_attributes, 305 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterfa ce' in extended_attributes,
308 'parent': definition.parent, 306 'parent': definition.parent,
309 'relative_dir': relative_dir_posix(idl_filename, source_path), 307 'relative_dir': relative_dir_posix(idl_filename, source_path),
310 }) 308 })
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 349
352 write_pickle_file(options.interfaces_info_file, 350 write_pickle_file(options.interfaces_info_file,
353 info_collector.get_info_as_dict(), 351 info_collector.get_info_as_dict(),
354 options.write_file_only_if_changed) 352 options.write_file_only_if_changed)
355 write_pickle_file(options.component_info_file, 353 write_pickle_file(options.component_info_file,
356 info_collector.get_component_info_as_dict(), 354 info_collector.get_component_info_as_dict(),
357 options.write_file_only_if_changed) 355 options.write_file_only_if_changed)
358 356
359 if __name__ == '__main__': 357 if __name__ == '__main__':
360 sys.exit(main()) 358 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698