| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 lstrip_blocks=True, # so can indent control flow tags | 87 lstrip_blocks=True, # so can indent control flow tags |
| 88 trim_blocks=True) | 88 trim_blocks=True) |
| 89 jinja_env.filters.update({ | 89 jinja_env.filters.update({ |
| 90 'blink_capitalize': capitalize, | 90 'blink_capitalize': capitalize, |
| 91 'conditional': conditional_if_endif, | 91 'conditional': conditional_if_endif, |
| 92 'runtime_enabled': runtime_enabled_if, | 92 'runtime_enabled': runtime_enabled_if, |
| 93 }) | 93 }) |
| 94 self.header_template = jinja_env.get_template(header_template_filename) | 94 self.header_template = jinja_env.get_template(header_template_filename) |
| 95 self.cpp_template = jinja_env.get_template(cpp_template_filename) | 95 self.cpp_template = jinja_env.get_template(cpp_template_filename) |
| 96 | 96 |
| 97 class_name = cpp_name(self.interface) | 97 interface_info = interfaces_info[interface_name] |
| 98 self.include_for_cpp_class = posixpath.join(relative_dir_posix, class_na
me + '.h') | 98 self.include_for_cpp_class = interface_info['include_path'] |
| 99 | 99 |
| 100 v8_types.set_callback_functions(definitions.callback_functions.keys()) | 100 v8_types.set_callback_functions(definitions.callback_functions.keys()) |
| 101 v8_types.set_enums((enum.name, enum.values) | 101 v8_types.set_enums((enum.name, enum.values) |
| 102 for enum in definitions.enumerations.values()) | 102 for enum in definitions.enumerations.values()) |
| 103 v8_types.set_ancestors(dict( | 103 v8_types.set_ancestors(dict( |
| 104 (interface_name, interface_info['ancestors']) | 104 (interface_name, interface_info['ancestors']) |
| 105 for interface_name, interface_info in interfaces_info.iteritems() | 105 for interface_name, interface_info in interfaces_info.iteritems() |
| 106 if 'ancestors' in interface_info)) | 106 if 'ancestors' in interface_info)) |
| 107 v8_types.set_callback_interfaces(set( | 107 v8_types.set_callback_interfaces(set( |
| 108 interface_name | 108 interface_name |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 | 161 |
| 162 # [RuntimeEnabled] | 162 # [RuntimeEnabled] |
| 163 def runtime_enabled_if(code, runtime_enabled_function_name): | 163 def runtime_enabled_if(code, runtime_enabled_function_name): |
| 164 if not runtime_enabled_function_name: | 164 if not runtime_enabled_function_name: |
| 165 return code | 165 return code |
| 166 # Indent if statement to level of original code | 166 # Indent if statement to level of original code |
| 167 indent = re.match(' *', code).group(0) | 167 indent = re.match(' *', code).group(0) |
| 168 return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) + | 168 return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) + |
| 169 ' %s' % code) | 169 ' %s' % code) |
| OLD | NEW |