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