| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 features = [{'name': name, | 125 features = [{'name': name, |
| 126 'needs_instance': reduce(or_, (member.get('on_instance', False) | 126 'needs_instance': reduce(or_, (member.get('on_instance', False) |
| 127 for member in members))} | 127 for member in members))} |
| 128 for name, members in members_by_name] | 128 for name, members in members_by_name] |
| 129 if features: | 129 if features: |
| 130 includes.add('bindings/core/v8/ScriptState.h') | 130 includes.add('bindings/core/v8/ScriptState.h') |
| 131 includes.add('core/origin_trials/OriginTrials.h') | 131 includes.add('core/origin_trials/OriginTrials.h') |
| 132 return sorted(features) | 132 return sorted(features) |
| 133 | 133 |
| 134 | 134 |
| 135 def interface_context(interface): | 135 def interface_context(interface, interfaces): |
| 136 """Creates a Jinja template context for an interface. |
| 137 |
| 138 Args: |
| 139 interface: An interface to create the context for |
| 140 interfaces: A dict which maps an interface name to the definition |
| 141 which can be referred if needed |
| 142 |
| 143 Returns: |
| 144 A Jinja template context for |interface| |
| 145 """ |
| 146 |
| 136 includes.clear() | 147 includes.clear() |
| 137 includes.update(INTERFACE_CPP_INCLUDES) | 148 includes.update(INTERFACE_CPP_INCLUDES) |
| 138 header_includes = set(INTERFACE_H_INCLUDES) | 149 header_includes = set(INTERFACE_H_INCLUDES) |
| 139 | 150 |
| 140 if interface.is_partial: | 151 if interface.is_partial: |
| 141 # A partial interface definition cannot specify that the interface | 152 # A partial interface definition cannot specify that the interface |
| 142 # inherits from another interface. Inheritance must be specified on | 153 # inherits from another interface. Inheritance must be specified on |
| 143 # the original interface definition. | 154 # the original interface definition. |
| 144 parent_interface = None | 155 parent_interface = None |
| 145 is_event_target = False | 156 is_event_target = False |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 'unscopables': sorted(unscopables), | 337 'unscopables': sorted(unscopables), |
| 327 }) | 338 }) |
| 328 | 339 |
| 329 # Constants | 340 # Constants |
| 330 context.update({ | 341 context.update({ |
| 331 'constants': [constant_context(constant, interface) for constant in inte
rface.constants], | 342 'constants': [constant_context(constant, interface) for constant in inte
rface.constants], |
| 332 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, | 343 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, |
| 333 }) | 344 }) |
| 334 | 345 |
| 335 # Attributes | 346 # Attributes |
| 336 attributes = [v8_attributes.attribute_context(interface, attribute) | 347 attributes = [v8_attributes.attribute_context(interface, attribute, interfac
es) |
| 337 for attribute in interface.attributes] | 348 for attribute in interface.attributes] |
| 338 | 349 |
| 339 has_conditional_attributes = any(attribute['exposed_test'] for attribute in
attributes) | 350 has_conditional_attributes = any(attribute['exposed_test'] for attribute in
attributes) |
| 340 if has_conditional_attributes and interface.is_partial: | 351 if has_conditional_attributes and interface.is_partial: |
| 341 raise Exception('Conditional attributes between partial interfaces in mo
dules and the original interfaces(%s) in core are not allowed.' % interface.name
) | 352 raise Exception('Conditional attributes between partial interfaces in mo
dules and the original interfaces(%s) in core are not allowed.' % interface.name
) |
| 342 | 353 |
| 343 context.update({ | 354 context.update({ |
| 344 'attributes': attributes, | 355 'attributes': attributes, |
| 345 }) | 356 }) |
| 346 | 357 |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 extended_attributes = deleter.extended_attributes | 1419 extended_attributes = deleter.extended_attributes |
| 1409 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1420 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
| 1410 is_ce_reactions = 'CEReactions' in extended_attributes | 1421 is_ce_reactions = 'CEReactions' in extended_attributes |
| 1411 return { | 1422 return { |
| 1412 'is_call_with_script_state': is_call_with_script_state, | 1423 'is_call_with_script_state': is_call_with_script_state, |
| 1413 'is_ce_reactions': is_ce_reactions, | 1424 'is_ce_reactions': is_ce_reactions, |
| 1414 'is_custom': 'Custom' in extended_attributes, | 1425 'is_custom': 'Custom' in extended_attributes, |
| 1415 'is_raises_exception': 'RaisesException' in extended_attributes, | 1426 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1416 'name': cpp_name(deleter), | 1427 'name': cpp_name(deleter), |
| 1417 } | 1428 } |
| OLD | NEW |