OLD | NEW |
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 76 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
77 """ | 77 """ |
78 | 78 |
79 from collections import defaultdict | 79 from collections import defaultdict |
80 import optparse | 80 import optparse |
81 import os | 81 import os |
82 import posixpath | 82 import posixpath |
83 import sys | 83 import sys |
84 | 84 |
85 from utilities import get_file_contents, write_pickle_file, get_interface_extend
ed_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_na
me_from_idl, get_implemented_interfaces_from_idl, get_parent_interface, get_put_
forward_interfaces_from_idl | 85 from utilities import get_file_contents, write_pickle_file, get_interface_extend
ed_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_na
me_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_inte
rfaces_from_idl |
86 | 86 |
87 module_path = os.path.dirname(__file__) | 87 module_path = os.path.dirname(__file__) |
88 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) | 88 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) |
89 | 89 |
90 INHERITED_EXTENDED_ATTRIBUTES = set([ | 90 INHERITED_EXTENDED_ATTRIBUTES = set([ |
91 'ActiveDOMObject', | 91 'ActiveDOMObject', |
92 'DependentLifetime', | 92 'DependentLifetime', |
93 'GarbageCollected', | 93 'GarbageCollected', |
94 'WillBeGarbageCollected', | 94 'WillBeGarbageCollected', |
95 ]) | 95 ]) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 # Handle partial interfaces | 167 # Handle partial interfaces |
168 partial_interface_name = get_partial_interface_name_from_idl(idl_file_conten
ts) | 168 partial_interface_name = get_partial_interface_name_from_idl(idl_file_conten
ts) |
169 if partial_interface_name: | 169 if partial_interface_name: |
170 add_paths_to_partials_dict(partial_interface_name, full_path, this_inclu
de_path) | 170 add_paths_to_partials_dict(partial_interface_name, full_path, this_inclu
de_path) |
171 return | 171 return |
172 | 172 |
173 # If not a partial interface, the basename is the interface name | 173 # If not a partial interface, the basename is the interface name |
174 interface_name, _ = os.path.splitext(os.path.basename(idl_filename)) | 174 interface_name, _ = os.path.splitext(os.path.basename(idl_filename)) |
175 | 175 |
| 176 left_interfaces, right_interfaces = get_implements_from_idl(idl_file_content
s, interface_name) |
| 177 |
176 interfaces_info[interface_name] = { | 178 interfaces_info[interface_name] = { |
177 'full_path': full_path, | 179 'full_path': full_path, |
178 'implemented_as': implemented_as, | 180 'implemented_as': implemented_as, |
179 'implements_interfaces': get_implemented_interfaces_from_idl(idl_file_co
ntents, interface_name), | 181 'implements_interfaces': right_interfaces, |
180 'include_path': this_include_path, | 182 'include_path': this_include_path, |
181 # FIXME: temporary private field, while removing old treatement of | 183 # FIXME: temporary private field, while removing old treatement of |
182 # 'implements': http://crbug.com/360435 | 184 # 'implements': http://crbug.com/360435 |
183 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface'
in extended_attributes, | 185 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface'
in extended_attributes, |
184 'is_callback_interface': is_callback_interface_from_idl(idl_file_content
s), | 186 'is_callback_interface': is_callback_interface_from_idl(idl_file_content
s), |
185 # Interfaces that are referenced (used as types) and that we introspect | 187 # Interfaces that are referenced (used as types) and that we introspect |
186 # during code generation (beyond interface-level data ([ImplementedAs], | 188 # during code generation (beyond interface-level data ([ImplementedAs], |
187 # is_callback_interface, ancestors, and inherited extended attributes): | 189 # is_callback_interface, ancestors, and inherited extended attributes): |
188 # deep dependencies. | 190 # deep dependencies. |
189 # These cause rebuilds of referrers, due to the dependency, so these | 191 # These cause rebuilds of referrers, due to the dependency, so these |
190 # should be minimized; currently only targets of [PutForwards]. | 192 # should be minimized; currently only targets of [PutForwards]. |
191 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co
ntents), | 193 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co
ntents), |
192 } | 194 } |
193 | 195 |
| 196 for left_interface_name in left_interfaces: |
| 197 interface_info = interfaces_info[left_interface_name] |
| 198 interface_info['implements_interfaces'].append(interface_name) |
| 199 |
194 # Record inheritance information | 200 # Record inheritance information |
195 inherited_extended_attributes_by_interface[interface_name] = dict( | 201 inherited_extended_attributes_by_interface[interface_name] = dict( |
196 (key, value) | 202 (key, value) |
197 for key, value in extended_attributes.iteritems() | 203 for key, value in extended_attributes.iteritems() |
198 if key in INHERITED_EXTENDED_ATTRIBUTES) | 204 if key in INHERITED_EXTENDED_ATTRIBUTES) |
199 parent = get_parent_interface(idl_file_contents) | 205 parent = get_parent_interface(idl_file_contents) |
200 if parent: | 206 if parent: |
201 parent_interfaces[interface_name] = parent | 207 parent_interfaces[interface_name] = parent |
202 | 208 |
203 | 209 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 idl_files.extend(args) | 303 idl_files.extend(args) |
298 | 304 |
299 compute_interfaces_info(idl_files) | 305 compute_interfaces_info(idl_files) |
300 write_pickle_file(options.interfaces_info_file, | 306 write_pickle_file(options.interfaces_info_file, |
301 interfaces_info, | 307 interfaces_info, |
302 options.write_file_only_if_changed) | 308 options.write_file_only_if_changed) |
303 | 309 |
304 | 310 |
305 if __name__ == '__main__': | 311 if __name__ == '__main__': |
306 sys.exit(main()) | 312 sys.exit(main()) |
OLD | NEW |