| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 v8_types.set_enums((enum.name, enum.values) | 97 v8_types.set_enums((enum.name, enum.values) |
| 98 for enum in definitions.enumerations.values()) | 98 for enum in definitions.enumerations.values()) |
| 99 v8_types.set_ancestors(dict( | 99 v8_types.set_ancestors(dict( |
| 100 (interface_name, interface_info['ancestors']) | 100 (interface_name, interface_info['ancestors']) |
| 101 for interface_name, interface_info in interfaces_info.iteritems() | 101 for interface_name, interface_info in interfaces_info.iteritems() |
| 102 if 'ancestors' in interface_info)) | 102 if 'ancestors' in interface_info)) |
| 103 v8_types.set_callback_interfaces(set( | 103 v8_types.set_callback_interfaces(set( |
| 104 interface_name | 104 interface_name |
| 105 for interface_name, interface_info in interfaces_info.iteritems() | 105 for interface_name, interface_info in interfaces_info.iteritems() |
| 106 if interface_info['is_callback_interface'])) | 106 if interface_info['is_callback_interface'])) |
| 107 v8_types.set_garbage_collected_types(set( | |
| 108 interface_name | |
| 109 for interface_name, interface_info in interfaces_info.iteritems() | |
| 110 if 'inherited_extended_attributes' in interface_info and | |
| 111 'GarbageCollected' in interface_info['inherited_extended_attributes'
])) | |
| 112 v8_types.set_implemented_as_interfaces(dict( | 107 v8_types.set_implemented_as_interfaces(dict( |
| 113 (interface_name, interface_info['implemented_as']) | 108 (interface_name, interface_info['implemented_as']) |
| 114 for interface_name, interface_info in interfaces_info.iteritems() | 109 for interface_name, interface_info in interfaces_info.iteritems() |
| 115 if 'implemented_as' in interface_info)) | 110 if 'implemented_as' in interface_info)) |
| 111 v8_types.set_will_be_garbage_collected_types(set( |
| 112 interface_name |
| 113 for interface_name, interface_info in interfaces_info.iteritems() |
| 114 if 'inherited_extended_attributes' in interface_info and |
| 115 'WillBeGarbageCollected' in interface_info['inherited_extended_attri
butes'])) |
| 116 | 116 |
| 117 # Generate contents (input parameters for Jinja) | 117 # Generate contents (input parameters for Jinja) |
| 118 template_contents = generate_contents(interface) | 118 template_contents = generate_contents(interface) |
| 119 template_contents['header_includes'].add(interface_info['include_path']) | 119 template_contents['header_includes'].add(interface_info['include_path']) |
| 120 template_contents['header_includes'] = sorted(template_contents['header_incl
udes']) | 120 template_contents['header_includes'] = sorted(template_contents['header_incl
udes']) |
| 121 includes.update(interface_info.get('dependencies_include_paths', [])) | 121 includes.update(interface_info.get('dependencies_include_paths', [])) |
| 122 template_contents['cpp_includes'] = sorted(includes) | 122 template_contents['cpp_includes'] = sorted(includes) |
| 123 | 123 |
| 124 # Render Jinja templates and write files | 124 # Render Jinja templates and write files |
| 125 def write_file(basename, file_text): | 125 def write_file(basename, file_text): |
| (...skipping 21 matching lines...) Expand all Loading... |
| 147 | 147 |
| 148 | 148 |
| 149 # [RuntimeEnabled] | 149 # [RuntimeEnabled] |
| 150 def runtime_enabled_if(code, runtime_enabled_function_name): | 150 def runtime_enabled_if(code, runtime_enabled_function_name): |
| 151 if not runtime_enabled_function_name: | 151 if not runtime_enabled_function_name: |
| 152 return code | 152 return code |
| 153 # Indent if statement to level of original code | 153 # Indent if statement to level of original code |
| 154 indent = re.match(' *', code).group(0) | 154 indent = re.match(' *', code).group(0) |
| 155 return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) + | 155 return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) + |
| 156 ' %s' % code) | 156 ' %s' % code) |
| OLD | NEW |