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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 * public: | 62 * public: |
63 'is_callback_interface': bool, callback interface or not | 63 'is_callback_interface': bool, callback interface or not |
64 'implemented_as': value of [ImplementedAs=...] on interface (C++ class name) | 64 'implemented_as': value of [ImplementedAs=...] on interface (C++ class name) |
65 | 65 |
66 * paths: | 66 * paths: |
67 'full_path': path to the IDL file, so can lookup an IDL by interface name | 67 'full_path': path to the IDL file, so can lookup an IDL by interface name |
68 'include_path': path for use in C++ #include directives | 68 'include_path': path for use in C++ #include directives |
69 'dependencies_full_paths': paths to dependencies (for merging into main) | 69 'dependencies_full_paths': paths to dependencies (for merging into main) |
70 'dependencies_include_paths': paths for use in C++ #include directives | 70 'dependencies_include_paths': paths for use in C++ #include directives |
| 71 'dependencies_other_component_full_paths': |
| 72 paths to dependencies (cannot merge because of other component) |
| 73 'dependencies_other_component_include_paths': |
| 74 paths for use in C++ #include directives because of dependencies in |
| 75 other component |
71 | 76 |
72 Note that all of these are stable information, unlikely to change without | 77 Note that all of these are stable information, unlikely to change without |
73 moving or deleting files (hence requiring a full rebuild anyway) or significant | 78 moving or deleting files (hence requiring a full rebuild anyway) or significant |
74 code changes (for inherited extended attributes). | 79 code changes (for inherited extended attributes). |
75 | 80 |
76 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 81 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
77 """ | 82 """ |
78 | 83 |
79 from collections import defaultdict | 84 from collections import defaultdict |
80 import cPickle as pickle | 85 import cPickle as pickle |
81 import optparse | 86 import optparse |
82 import sys | 87 import sys |
83 | 88 |
84 from utilities import idl_filename_to_component, read_pickle_files, write_pickle
_file | 89 from utilities import idl_filename_to_component, read_pickle_files, write_pickle
_file |
85 | 90 |
86 INHERITED_EXTENDED_ATTRIBUTES = set([ | 91 INHERITED_EXTENDED_ATTRIBUTES = set([ |
87 'ActiveDOMObject', | 92 'ActiveDOMObject', |
88 'DependentLifetime', | 93 'DependentLifetime', |
| 94 'DoNotExposeJSAccessors', |
| 95 'ExposeJSAccessors', |
89 'GarbageCollected', | 96 'GarbageCollected', |
90 'NotScriptWrappable', | |
91 'WillBeGarbageCollected', | 97 'WillBeGarbageCollected', |
92 ]) | 98 ]) |
93 | 99 |
94 # Main variable (filled in and exported) | 100 # Main variable (filled in and exported) |
95 interfaces_info = {} | 101 interfaces_info = {} |
96 | 102 |
97 # Auxiliary variables (not visible to future build steps) | 103 # Auxiliary variables (not visible to future build steps) |
98 partial_interface_files = defaultdict(lambda: { | 104 partial_interface_files = defaultdict(lambda: { |
99 'full_paths': [], | 105 'full_paths': [], |
100 'include_paths': [], | 106 'include_paths': [], |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 # Implemented interfaces don't need includes, as this is handled in | 267 # Implemented interfaces don't need includes, as this is handled in |
262 # the Blink implementation (they are implemented on |impl| itself, | 268 # the Blink implementation (they are implemented on |impl| itself, |
263 # hence header is included in implementing class). | 269 # hence header is included in implementing class). |
264 # However, they are needed for legacy implemented interfaces that | 270 # However, they are needed for legacy implemented interfaces that |
265 # are being treated as partial interfaces, until we remove these. | 271 # are being treated as partial interfaces, until we remove these. |
266 # http://crbug.com/360435 | 272 # http://crbug.com/360435 |
267 implemented_interfaces_include_paths = [] | 273 implemented_interfaces_include_paths = [] |
268 for implemented_interface_info in implemented_interfaces_info: | 274 for implemented_interface_info in implemented_interfaces_info: |
269 if (implemented_interface_info['is_legacy_treat_as_partial_interface
'] and | 275 if (implemented_interface_info['is_legacy_treat_as_partial_interface
'] and |
270 implemented_interface_info['include_path']): | 276 implemented_interface_info['include_path']): |
271 implemented_interfaces_include_paths.append(implemented_interfac
e_info['include_path']) | 277 implemented_interfaces_include_paths.append( |
| 278 implemented_interface_info['include_path']) |
| 279 |
| 280 dependencies_full_paths = implemented_interfaces_full_paths |
| 281 dependencies_include_paths = implemented_interfaces_include_paths |
| 282 dependencies_other_component_full_paths = [] |
| 283 dependencies_other_component_include_paths = [] |
| 284 |
| 285 component = idl_filename_to_component(interface_info['full_path']) |
| 286 for full_path in partial_interfaces_full_paths: |
| 287 partial_interface_component = idl_filename_to_component(full_path) |
| 288 if component == partial_interface_component: |
| 289 dependencies_full_paths.append(full_path) |
| 290 else: |
| 291 dependencies_other_component_full_paths.append(full_path) |
| 292 |
| 293 for include_path in partial_interfaces_include_paths: |
| 294 partial_interface_component = idl_filename_to_component(include_path
) |
| 295 if component == partial_interface_component: |
| 296 dependencies_include_paths.append(include_path) |
| 297 else: |
| 298 dependencies_other_component_include_paths.append(include_path) |
| 299 |
| 300 if interface_info['has_union_types']: |
| 301 dependencies_include_paths.append( |
| 302 'bindings/%s/v8/UnionTypes%s.h' % (component, component.capitali
ze())) |
272 | 303 |
273 interface_info.update({ | 304 interface_info.update({ |
274 'dependencies_full_paths': (partial_interfaces_full_paths + | 305 'dependencies_full_paths': dependencies_full_paths, |
275 implemented_interfaces_full_paths), | 306 'dependencies_include_paths': dependencies_include_paths, |
276 'dependencies_include_paths': (partial_interfaces_include_paths + | 307 'dependencies_other_component_full_paths': |
277 implemented_interfaces_include_paths)
, | 308 dependencies_other_component_full_paths, |
| 309 'dependencies_other_component_include_paths': |
| 310 dependencies_other_component_include_paths, |
278 }) | 311 }) |
279 | 312 |
280 # Clean up temporary private information | 313 # Clean up temporary private information |
281 for interface_info in interfaces_info.itervalues(): | 314 for interface_info in interfaces_info.itervalues(): |
282 del interface_info['extended_attributes'] | 315 del interface_info['extended_attributes'] |
| 316 del interface_info['has_union_types'] |
283 del interface_info['is_legacy_treat_as_partial_interface'] | 317 del interface_info['is_legacy_treat_as_partial_interface'] |
284 del interface_info['parent'] | 318 del interface_info['parent'] |
285 | 319 |
286 # Compute global_type_info to interfaces_info so that idl_compiler does | 320 # Compute global_type_info to interfaces_info so that idl_compiler does |
287 # not need to always calculate the info in __init__. | 321 # not need to always calculate the info in __init__. |
288 compute_global_type_info() | 322 compute_global_type_info() |
289 | 323 |
290 | 324 |
291 ################################################################################ | 325 ################################################################################ |
292 | 326 |
293 def main(): | 327 def main(): |
294 options, args = parse_options() | 328 options, args = parse_options() |
295 # args = Input1, Input2, ..., Output | 329 # args = Input1, Input2, ..., Output |
296 interfaces_info_filename = args.pop() | 330 interfaces_info_filename = args.pop() |
297 info_individuals = read_pickle_files(args) | 331 info_individuals = read_pickle_files(args) |
298 | 332 |
299 compute_interfaces_info_overall(info_individuals) | 333 compute_interfaces_info_overall(info_individuals) |
300 write_pickle_file(interfaces_info_filename, | 334 write_pickle_file(interfaces_info_filename, |
301 interfaces_info, | 335 interfaces_info, |
302 options.write_file_only_if_changed) | 336 options.write_file_only_if_changed) |
303 | 337 |
304 | 338 |
305 if __name__ == '__main__': | 339 if __name__ == '__main__': |
306 sys.exit(main()) | 340 sys.exit(main()) |
OLD | NEW |