| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if interface_name not in self.interfaces_info: | 99 if interface_name not in self.interfaces_info: |
| 100 # No dependencies, nothing to do | 100 # No dependencies, nothing to do |
| 101 return | 101 return |
| 102 | 102 |
| 103 interface_info = self.interfaces_info[interface_name] | 103 interface_info = self.interfaces_info[interface_name] |
| 104 if 'inherited_extended_attributes' in interface_info: | 104 if 'inherited_extended_attributes' in interface_info: |
| 105 target_interface.extended_attributes.update( | 105 target_interface.extended_attributes.update( |
| 106 interface_info['inherited_extended_attributes']) | 106 interface_info['inherited_extended_attributes']) |
| 107 | 107 |
| 108 merge_interface_dependencies(target_interface, | 108 merge_interface_dependencies(target_interface, |
| 109 definitions, |
| 109 interface_info['dependencies_full_paths'], | 110 interface_info['dependencies_full_paths'], |
| 110 self.reader) | 111 self.reader) |
| 111 | 112 |
| 112 for referenced_interface_name in interface_info['referenced_interfaces']
: | 113 for referenced_interface_name in interface_info['referenced_interfaces']
: |
| 113 referenced_definitions = self.reader.read_idl_definitions( | 114 referenced_definitions = self.reader.read_idl_definitions( |
| 114 self.interfaces_info[referenced_interface_name]['full_path']) | 115 self.interfaces_info[referenced_interface_name]['full_path']) |
| 115 definitions.interfaces.update(referenced_definitions.interfaces) | 116 definitions.interfaces.update(referenced_definitions.interfaces) |
| 116 | 117 |
| 117 | 118 |
| 118 def merge_interface_dependencies(target_interface, dependency_idl_filenames, rea
der): | 119 def merge_interface_dependencies(target_interface, definitions, dependency_idl_f
ilenames, reader): |
| 119 """Merge dependencies ('partial interface' and 'implements') in dependency_i
dl_filenames into target_interface. | 120 """Merge dependencies ('partial interface' and 'implements') in dependency_i
dl_filenames into target_interface and definitions. |
| 120 | 121 |
| 121 No return: modifies target_interface in place. | 122 No return: modifies target_interface and definitions in place. |
| 122 """ | 123 """ |
| 123 # Sort so order consistent, so can compare output from run to run. | 124 # Sort so order consistent, so can compare output from run to run. |
| 124 for dependency_idl_filename in sorted(dependency_idl_filenames): | 125 for dependency_idl_filename in sorted(dependency_idl_filenames): |
| 125 dependency_interface_basename, _ = os.path.splitext(os.path.basename(dep
endency_idl_filename)) | 126 dependency_interface_basename, _ = os.path.splitext(os.path.basename(dep
endency_idl_filename)) |
| 126 definitions = reader.read_idl_file(dependency_idl_filename) | 127 dependency_definitions = reader.read_idl_file(dependency_idl_filename) |
| 127 | 128 |
| 128 for dependency_interface in definitions.interfaces.itervalues(): | 129 definitions.merge(dependency_definitions) |
| 130 |
| 131 for dependency_interface in dependency_definitions.interfaces.itervalues
(): |
| 129 # Dependency files contain either partial interfaces for | 132 # Dependency files contain either partial interfaces for |
| 130 # the (single) target interface, in which case the interface names | 133 # the (single) target interface, in which case the interface names |
| 131 # must agree, or interfaces that are implemented by the target | 134 # must agree, or interfaces that are implemented by the target |
| 132 # interface, in which case the interface names differ. | 135 # interface, in which case the interface names differ. |
| 133 if (dependency_interface.is_partial and | 136 if (dependency_interface.is_partial and |
| 134 dependency_interface.name != target_interface.name): | 137 dependency_interface.name != target_interface.name): |
| 135 raise InvalidPartialInterfaceError('%s is not a partial interfac
e of %s. There maybe a bug in the the dependency generator (compute_dependencies
.py).' % (dependency_idl_filename, target_interface.name)) | 138 raise InvalidPartialInterfaceError('%s is not a partial interfac
e of %s. There maybe a bug in the the dependency generator (compute_dependencies
.py).' % (dependency_idl_filename, target_interface.name)) |
| 136 merge_dependency_interface(target_interface, dependency_interface, d
ependency_interface_basename) | 139 merge_dependency_interface(target_interface, dependency_interface, d
ependency_interface_basename) |
| 137 | 140 |
| 138 | 141 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 169 'ImplementedAs', dependency_interface_basename)) | 172 'ImplementedAs', dependency_interface_basename)) |
| 170 | 173 |
| 171 def merge_lists(source_list, target_list): | 174 def merge_lists(source_list, target_list): |
| 172 for member in source_list: | 175 for member in source_list: |
| 173 member.extended_attributes.update(merged_extended_attributes) | 176 member.extended_attributes.update(merged_extended_attributes) |
| 174 target_list.extend(source_list) | 177 target_list.extend(source_list) |
| 175 | 178 |
| 176 merge_lists(dependency_interface.attributes, target_interface.attributes) | 179 merge_lists(dependency_interface.attributes, target_interface.attributes) |
| 177 merge_lists(dependency_interface.constants, target_interface.constants) | 180 merge_lists(dependency_interface.constants, target_interface.constants) |
| 178 merge_lists(dependency_interface.operations, target_interface.operations) | 181 merge_lists(dependency_interface.operations, target_interface.operations) |
| OLD | NEW |