| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if parent_interface: | 67 if parent_interface: |
| 68 header_includes.update(v8_types.includes_for_type(parent_interface)) | 68 header_includes.update(v8_types.includes_for_type(parent_interface)) |
| 69 extended_attributes = interface.extended_attributes | 69 extended_attributes = interface.extended_attributes |
| 70 | 70 |
| 71 # [CheckSecurity] | 71 # [CheckSecurity] |
| 72 is_check_security = 'CheckSecurity' in extended_attributes | 72 is_check_security = 'CheckSecurity' in extended_attributes |
| 73 if is_check_security: | 73 if is_check_security: |
| 74 includes.add('bindings/v8/BindingSecurity.h') | 74 includes.add('bindings/v8/BindingSecurity.h') |
| 75 | 75 |
| 76 # [GenerateVisitDOMWrapper] | 76 # [GenerateVisitDOMWrapper] |
| 77 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit
DOMWrapper') | 77 reachable_node_function = extended_attributes.get('GenerateVisitDOMWrapper') |
| 78 if generate_visit_dom_wrapper_function: | 78 if reachable_node_function: |
| 79 includes.update(['bindings/v8/V8GCController.h', | 79 includes.update(['bindings/v8/V8GCController.h', |
| 80 'core/dom/Element.h']) | 80 'core/dom/Element.h']) |
| 81 | 81 |
| 82 # [MeasureAs] | 82 # [MeasureAs] |
| 83 is_measure_as = 'MeasureAs' in extended_attributes | 83 is_measure_as = 'MeasureAs' in extended_attributes |
| 84 if is_measure_as: | 84 if is_measure_as: |
| 85 includes.add('core/frame/UseCounter.h') | 85 includes.add('core/frame/UseCounter.h') |
| 86 | 86 |
| 87 # [SetReference] |
| 88 set_reference_list = [{ |
| 89 'name': argument.name, |
| 90 'idl_type': argument.idl_type, |
| 91 'v8_type': v8_types.v8_type(argument.idl_type), |
| 92 } for argument in extended_attributes.get('SetReference', [])] |
| 93 for set_reference in set_reference_list: |
| 94 v8_types.add_includes_for_type(set_reference['idl_type']) |
| 95 |
| 87 # [SpecialWrapFor] | 96 # [SpecialWrapFor] |
| 88 if 'SpecialWrapFor' in extended_attributes: | 97 if 'SpecialWrapFor' in extended_attributes: |
| 89 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') | 98 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') |
| 90 else: | 99 else: |
| 91 special_wrap_for = [] | 100 special_wrap_for = [] |
| 92 for special_wrap_interface in special_wrap_for: | 101 for special_wrap_interface in special_wrap_for: |
| 93 v8_types.add_includes_for_type(special_wrap_interface) | 102 v8_types.add_includes_for_type(special_wrap_interface) |
| 94 | 103 |
| 95 # Constructors | 104 # Constructors |
| 96 constructors = [generate_constructor(interface, constructor) | 105 constructors = [generate_constructor(interface, constructor) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 121 | 130 |
| 122 if (constructors or custom_constructors or has_event_constructor or | 131 if (constructors or custom_constructors or has_event_constructor or |
| 123 named_constructor): | 132 named_constructor): |
| 124 includes.add('bindings/v8/V8ObjectConstructor.h') | 133 includes.add('bindings/v8/V8ObjectConstructor.h') |
| 125 | 134 |
| 126 template_contents = { | 135 template_contents = { |
| 127 'any_type_attributes': any_type_attributes, | 136 'any_type_attributes': any_type_attributes, |
| 128 'conditional_string': conditional_string(interface), # [Conditional] | 137 'conditional_string': conditional_string(interface), # [Conditional] |
| 129 'constructors': constructors, | 138 'constructors': constructors, |
| 130 'cpp_class': cpp_name(interface), | 139 'cpp_class': cpp_name(interface), |
| 131 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi
on, | |
| 132 'has_custom_constructor': bool(custom_constructors), | 140 'has_custom_constructor': bool(custom_constructors), |
| 133 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] | 141 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] |
| 134 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'T
oV8'), # [Custom=ToV8] | 142 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'T
oV8'), # [Custom=ToV8] |
| 135 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wr
ap'), # [Custom=Wrap] | 143 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wr
ap'), # [Custom=Wrap] |
| 136 'has_event_constructor': has_event_constructor, | 144 'has_event_constructor': has_event_constructor, |
| 137 'has_visit_dom_wrapper': ( | 145 'has_visit_dom_wrapper': ( |
| 138 # [Custom=Wrap], [GenerateVisitDOMWrapper] | 146 # [Custom=Wrap], [GenerateVisitDOMWrapper] |
| 139 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper')
or | 147 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper')
or |
| 140 'GenerateVisitDOMWrapper' in extended_attributes), | 148 reachable_node_function or set_reference_list), |
| 141 'header_includes': header_includes, | 149 'header_includes': header_includes, |
| 142 'interface_length': | 150 'interface_length': |
| 143 interface_length(interface, constructors + custom_constructors), | 151 interface_length(interface, constructors + custom_constructors), |
| 144 'interface_name': interface.name, | 152 'interface_name': interface.name, |
| 145 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac
tiveDOMObject] | 153 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac
tiveDOMObject] |
| 146 'is_check_security': is_check_security, | 154 'is_check_security': is_check_security, |
| 147 'is_constructor_call_with_document': has_extended_attribute_value( | 155 'is_constructor_call_with_document': has_extended_attribute_value( |
| 148 interface, 'ConstructorCallWith', 'Document'), # [ConstructorCallWi
th=Document] | 156 interface, 'ConstructorCallWith', 'Document'), # [ConstructorCallWi
th=Document] |
| 149 'is_constructor_call_with_execution_context': has_extended_attribute_val
ue( | 157 'is_constructor_call_with_execution_context': has_extended_attribute_val
ue( |
| 150 interface, 'ConstructorCallWith', 'ExecutionContext'), # [Construct
orCallWith=ExeuctionContext] | 158 interface, 'ConstructorCallWith', 'ExecutionContext'), # [Construct
orCallWith=ExeuctionContext] |
| 151 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept
ion') == 'Constructor', # [RaisesException=Constructor] | 159 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept
ion') == 'Constructor', # [RaisesException=Constructor] |
| 152 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, #
[DependentLifetime] | 160 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, #
[DependentLifetime] |
| 153 'is_event_target': inherits_interface(interface, 'EventTarget'), | 161 'is_event_target': inherits_interface(interface, 'EventTarget'), |
| 154 'is_node': inherits_interface(interface, 'Node'), | 162 'is_node': inherits_interface(interface, 'Node'), |
| 155 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] | 163 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] |
| 156 'named_constructor': named_constructor, | 164 'named_constructor': named_constructor, |
| 157 'parent_interface': parent_interface, | 165 'parent_interface': parent_interface, |
| 166 'reachable_node_function': reachable_node_function, |
| 158 'runtime_enabled_function': runtime_enabled_function_name(interface), #
[RuntimeEnabled] | 167 'runtime_enabled_function': runtime_enabled_function_name(interface), #
[RuntimeEnabled] |
| 168 'set_reference_list': set_reference_list, |
| 159 'special_wrap_for': special_wrap_for, | 169 'special_wrap_for': special_wrap_for, |
| 160 'v8_class': v8_utilities.v8_class_name(interface), | 170 'v8_class': v8_utilities.v8_class_name(interface), |
| 161 } | 171 } |
| 162 | 172 |
| 163 template_contents.update({ | 173 template_contents.update({ |
| 164 'constants': [generate_constant(constant) for constant in interface.cons
tants], | 174 'constants': [generate_constant(constant) for constant in interface.cons
tants], |
| 165 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, | 175 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, |
| 166 }) | 176 }) |
| 167 | 177 |
| 168 attributes = [v8_attributes.generate_attribute(interface, attribute) | 178 attributes = [v8_attributes.generate_attribute(interface, attribute) |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 return min(constructor['number_of_required_arguments'] | 429 return min(constructor['number_of_required_arguments'] |
| 420 for constructor in constructors) | 430 for constructor in constructors) |
| 421 | 431 |
| 422 | 432 |
| 423 # Interface dependencies | 433 # Interface dependencies |
| 424 | 434 |
| 425 def inherits_interface(interface, ancestor): | 435 def inherits_interface(interface, ancestor): |
| 426 # FIXME: support distant ancestors (but don't parse all ancestors!) | 436 # FIXME: support distant ancestors (but don't parse all ancestors!) |
| 427 # Do by computing ancestor chain in compute_dependencies.py | 437 # Do by computing ancestor chain in compute_dependencies.py |
| 428 return ancestor in [interface.name, interface.parent] | 438 return ancestor in [interface.name, interface.parent] |
| OLD | NEW |