in bindings/scripts/compute_interfaces_info_overall.py [0:0]
def compute_interfaces_info_overall(info_individuals):
"""Compute information about IDL files.
Information is stored in global interfaces_info.
"""
for info in info_individuals:
merge_dict_recursively(interfaces_info, info['interfaces_info'])
# Interfaces in one component may have partial interfaces in
# another component. This is ok (not a layering violation), since
# partial interfaces are used to *extend* interfaces.
# We thus need to update or append if already present
dict_of_dicts_of_lists_update_or_append(
partial_interface_files, info['partial_interface_files'])
# Record inheritance information individually
for interface_name, interface_info in interfaces_info.items():
extended_attributes = interface_info['extended_attributes']
inherited_extended_attributes_by_interface[interface_name] = dict(
(key, value)
for key, value in extended_attributes.items()
if key in INHERITED_EXTENDED_ATTRIBUTES)
parent = interface_info['parent']
if parent:
parent_interfaces[interface_name] = parent
# Once all individual files handled, can compute inheritance information
# and dependencies
# Compute inheritance info
for interface_name in interfaces_info:
compute_inheritance_info(interface_name)
# Compute dependencies
# Move implements info from implement*ed* interface (rhs of 'implements')
# to implement*ing* interface (lhs of 'implements').
# Note that moving an 'implements' statement between implementing and
# implemented files does not change the info (or hence cause a rebuild)!
for right_interface_name, interface_info in interfaces_info.items():
for left_interface_name in interface_info['implemented_by_interfaces']:
interfaces_info[left_interface_name]['implements_interfaces'].append(right_interface_name)
del interface_info['implemented_by_interfaces']
# An IDL file's dependencies are partial interface files that extend it,
# and files for other interfaces that this interfaces implements.
for interface_name, interface_info in interfaces_info.items():
partial_interface_paths = partial_interface_files[interface_name]
partial_interfaces_full_paths = partial_interface_paths['full_paths']
# Partial interface definitions each need an include, as they are
# implemented in separate classes from the main interface.
partial_interfaces_include_paths = partial_interface_paths['include_paths']
implemented_interfaces = interface_info['implements_interfaces']
try:
implemented_interfaces_info = [
interfaces_info[interface]
for interface in implemented_interfaces]
except KeyError as key_name:
raise IdlInterfaceFileNotFoundError('Could not find the IDL file where the following implemented interface is defined: %s' % key_name)
implemented_interfaces_full_paths = [
implemented_interface_info['full_path']
for implemented_interface_info in implemented_interfaces_info]
# Implemented interfaces don't need includes, as this is handled in
# the Blink implementation (they are implemented on |impl| itself,
# hence header is included in implementing class).
# However, they are needed for legacy implemented interfaces that
# are being treated as partial interfaces, until we remove these.
# http://crbug.com/360435
implemented_interfaces_include_paths = [
implemented_interface_info['include_path']
for implemented_interface_info in implemented_interfaces_info
if implemented_interface_info['is_legacy_treat_as_partial_interface']]
dependencies_full_paths = implemented_interfaces_full_paths
dependencies_include_paths = implemented_interfaces_include_paths
dependencies_other_component_full_paths = []
dependencies_other_component_include_paths = []
component = idl_filename_to_component(interface_info['full_path'])
for full_path in partial_interfaces_full_paths:
partial_interface_component = idl_filename_to_component(full_path)
if component == partial_interface_component:
dependencies_full_paths.append(full_path)
else:
dependencies_other_component_full_paths.append(full_path)
for include_path in partial_interfaces_include_paths:
partial_interface_component = idl_filename_to_component(include_path)
if component == partial_interface_component:
dependencies_include_paths.append(include_path)
else:
dependencies_other_component_include_paths.append(include_path)
interface_info.update({
'dependencies_full_paths': dependencies_full_paths,
'dependencies_include_paths': dependencies_include_paths,
'dependencies_other_component_full_paths':
dependencies_other_component_full_paths,
'dependencies_other_component_include_paths':
dependencies_other_component_include_paths,
})
# Clean up temporary private information
for interface_info in interfaces_info.values():
del interface_info['extended_attributes']
del interface_info['union_types']
del interface_info['is_legacy_treat_as_partial_interface']
# Compute global_type_info to interfaces_info so that idl_compiler does
# not need to always calculate the info in __init__.
compute_global_type_info()