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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 # [DependentLifetime] | 121 # [DependentLifetime] |
122 is_dependent_lifetime = 'DependentLifetime' in extended_attributes | 122 is_dependent_lifetime = 'DependentLifetime' in extended_attributes |
123 | 123 |
124 # [MeasureAs] | 124 # [MeasureAs] |
125 is_measure_as = 'MeasureAs' in extended_attributes | 125 is_measure_as = 'MeasureAs' in extended_attributes |
126 if is_measure_as: | 126 if is_measure_as: |
127 includes.add('core/frame/UseCounter.h') | 127 includes.add('core/frame/UseCounter.h') |
128 | 128 |
129 # [SetWrapperReferenceFrom] | 129 # [SetWrapperReferenceFrom] |
130 reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom') | 130 set_wrapper_reference_from = extended_attributes.get('SetWrapperReferenceFro
m') |
131 if reachable_node_function: | 131 if set_wrapper_reference_from: |
132 includes.update(['bindings/core/v8/V8GCController.h', | 132 includes.update(['bindings/core/v8/V8GCController.h', |
133 'core/dom/Element.h']) | 133 'core/dom/Element.h']) |
134 | 134 |
135 # [SetWrapperReferenceTo] | 135 # [SetWrapperReferenceTo] |
136 set_wrapper_reference_to_list = [{ | 136 set_wrapper_reference_to_argument = extended_attributes.get('SetWrapperRefer
enceTo') |
137 'name': argument.name, | 137 set_wrapper_reference_to = None |
138 # FIXME: properly should be: | 138 if set_wrapper_reference_to_argument: |
139 # 'cpp_type': argument.idl_type.cpp_type_args(raw_type=True), | 139 set_wrapper_reference_to = { |
140 # (if type is non-wrapper type like NodeFilter, normally RefPtr) | 140 'name': set_wrapper_reference_to_argument.name, |
141 # Raw pointers faster though, and NodeFilter hacky anyway. | 141 # FIXME: properly should be: |
142 'cpp_type': argument.idl_type.implemented_as + '*', | 142 # 'cpp_type': set_wrapper_reference_to_argument.idl_type.cpp_type_ar
gs(raw_type=True), |
143 'idl_type': argument.idl_type, | 143 # (if type is non-wrapper type like NodeFilter, normally RefPtr) |
144 'v8_type': v8_types.v8_type(argument.idl_type.name), | 144 # Raw pointers faster though, and NodeFilter hacky anyway. |
145 } for argument in extended_attributes.get('SetWrapperReferenceTo', [])] | 145 'cpp_type': set_wrapper_reference_to_argument.idl_type.implemented_a
s + '*', |
146 for set_wrapper_reference_to in set_wrapper_reference_to_list: | 146 'idl_type': set_wrapper_reference_to_argument.idl_type, |
| 147 'v8_type': v8_types.v8_type(set_wrapper_reference_to_argument.idl_ty
pe.name), |
| 148 } |
147 set_wrapper_reference_to['idl_type'].add_includes_for_type() | 149 set_wrapper_reference_to['idl_type'].add_includes_for_type() |
148 | 150 |
149 # [SetWrapperReferenceFrom] | 151 # [SetWrapperReferenceFrom] |
150 has_visit_dom_wrapper = ( | 152 has_visit_dom_wrapper = ( |
151 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or | 153 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or |
152 reachable_node_function or | 154 set_wrapper_reference_from or set_wrapper_reference_to) |
153 set_wrapper_reference_to_list) | |
154 | 155 |
155 this_gc_type = gc_type(interface) | 156 this_gc_type = gc_type(interface) |
156 | 157 |
157 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') | 158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') |
158 | 159 |
159 v8_class_name = v8_utilities.v8_class_name(interface) | 160 v8_class_name = v8_utilities.v8_class_name(interface) |
160 cpp_class_name = cpp_name(interface) | 161 cpp_class_name = cpp_name(interface) |
161 cpp_class_name_or_partial = cpp_name_or_partial(interface) | 162 cpp_class_name_or_partial = cpp_name_or_partial(interface) |
162 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) | 163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) |
163 | 164 |
(...skipping 23 matching lines...) Expand all Loading... |
187 'lifetime': 'Dependent' | 188 'lifetime': 'Dependent' |
188 if (has_visit_dom_wrapper or | 189 if (has_visit_dom_wrapper or |
189 is_active_dom_object or | 190 is_active_dom_object or |
190 is_dependent_lifetime) | 191 is_dependent_lifetime) |
191 else 'Independent', | 192 else 'Independent', |
192 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs] | 193 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs] |
193 'parent_interface': parent_interface, | 194 'parent_interface': parent_interface, |
194 'pass_cpp_type': cpp_template_type( | 195 'pass_cpp_type': cpp_template_type( |
195 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), | 196 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), |
196 cpp_name(interface)), | 197 cpp_name(interface)), |
197 'reachable_node_function': reachable_node_function, | |
198 'runtime_enabled_function': runtime_enabled_function_name(interface), #
[RuntimeEnabled] | 198 'runtime_enabled_function': runtime_enabled_function_name(interface), #
[RuntimeEnabled] |
199 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, | 199 'set_wrapper_reference_from': set_wrapper_reference_from, |
| 200 'set_wrapper_reference_to': set_wrapper_reference_to, |
200 'v8_class': v8_class_name, | 201 'v8_class': v8_class_name, |
201 'v8_class_or_partial': v8_class_name_or_partial, | 202 'v8_class_or_partial': v8_class_name_or_partial, |
202 'wrapper_class_id': wrapper_class_id, | 203 'wrapper_class_id': wrapper_class_id, |
203 } | 204 } |
204 | 205 |
205 # Constructors | 206 # Constructors |
206 constructors = [constructor_context(interface, constructor) | 207 constructors = [constructor_context(interface, constructor) |
207 for constructor in interface.constructors | 208 for constructor in interface.constructors |
208 # FIXME: shouldn't put named constructors with constructors | 209 # FIXME: shouldn't put named constructors with constructors |
209 # (currently needed for Perl compatibility) | 210 # (currently needed for Perl compatibility) |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 | 1356 |
1356 extended_attributes = deleter.extended_attributes | 1357 extended_attributes = deleter.extended_attributes |
1357 idl_type = deleter.idl_type | 1358 idl_type = deleter.idl_type |
1358 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1359 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
1359 return { | 1360 return { |
1360 'is_call_with_script_state': is_call_with_script_state, | 1361 'is_call_with_script_state': is_call_with_script_state, |
1361 'is_custom': 'Custom' in extended_attributes, | 1362 'is_custom': 'Custom' in extended_attributes, |
1362 'is_raises_exception': 'RaisesException' in extended_attributes, | 1363 'is_raises_exception': 'RaisesException' in extended_attributes, |
1363 'name': cpp_name(deleter), | 1364 'name': cpp_name(deleter), |
1364 } | 1365 } |
OLD | NEW |