| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 # [PrimaryGlobal] and [Global] | 207 # [PrimaryGlobal] and [Global] |
| 208 is_global = ('PrimaryGlobal' in extended_attributes or | 208 is_global = ('PrimaryGlobal' in extended_attributes or |
| 209 'Global' in extended_attributes) | 209 'Global' in extended_attributes) |
| 210 | 210 |
| 211 # [ImmutablePrototype] | 211 # [ImmutablePrototype] |
| 212 # TODO(littledan): Is it possible to deduce this based on inheritance, | 212 # TODO(littledan): Is it possible to deduce this based on inheritance, |
| 213 # as in the WebIDL spec? | 213 # as in the WebIDL spec? |
| 214 is_immutable_prototype = is_global or 'ImmutablePrototype' in extended_attri
butes | 214 is_immutable_prototype = is_global or 'ImmutablePrototype' in extended_attri
butes |
| 215 | 215 |
| 216 # [SetWrapperReferenceFrom] | |
| 217 set_wrapper_reference_from = extended_attributes.get('SetWrapperReferenceFro
m') | |
| 218 if set_wrapper_reference_from: | |
| 219 includes.update(['bindings/core/v8/V8GCController.h', | |
| 220 'core/dom/Element.h']) | |
| 221 | |
| 222 # [SetWrapperReferenceTo] | |
| 223 set_wrapper_reference_to_argument = extended_attributes.get('SetWrapperRefer
enceTo') | |
| 224 set_wrapper_reference_to = None | |
| 225 if set_wrapper_reference_to_argument: | |
| 226 set_wrapper_reference_to = { | |
| 227 'name': set_wrapper_reference_to_argument.name, | |
| 228 # FIXME: properly should be: | |
| 229 # 'cpp_type': set_wrapper_reference_to_argument.idl_type.cpp_type_ar
gs(raw_type=True), | |
| 230 # (if type is non-wrapper type like NodeFilter, normally RefPtr) | |
| 231 # Raw pointers faster though, and NodeFilter hacky anyway. | |
| 232 'cpp_type': set_wrapper_reference_to_argument.idl_type.implemented_a
s + '*', | |
| 233 'idl_type': set_wrapper_reference_to_argument.idl_type, | |
| 234 'v8_type': v8_types.v8_type(set_wrapper_reference_to_argument.idl_ty
pe.name), | |
| 235 } | |
| 236 set_wrapper_reference_to['idl_type'].add_includes_for_type() | |
| 237 | |
| 238 has_visit_dom_wrapper = (set_wrapper_reference_from or set_wrapper_reference
_to) | |
| 239 | |
| 240 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') | 216 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') |
| 241 | 217 |
| 242 # [ActiveScriptWrappable] must be accompanied with [DependentLifetime]. | 218 # [ActiveScriptWrappable] must be accompanied with [DependentLifetime]. |
| 243 if active_scriptwrappable and not is_dependent_lifetime: | 219 if active_scriptwrappable and not is_dependent_lifetime: |
| 244 raise Exception('[ActiveScriptWrappable] interface must also specify ' | 220 raise Exception('[ActiveScriptWrappable] interface must also specify ' |
| 245 '[DependentLifetime]: %s' % interface.name) | 221 '[DependentLifetime]: %s' % interface.name) |
| 246 | 222 |
| 247 v8_class_name = v8_utilities.v8_class_name(interface) | 223 v8_class_name = v8_utilities.v8_class_name(interface) |
| 248 cpp_class_name = cpp_name(interface) | 224 cpp_class_name = cpp_name(interface) |
| 249 cpp_class_name_or_partial = cpp_name_or_partial(interface) | 225 cpp_class_name_or_partial = cpp_name_or_partial(interface) |
| 250 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) | 226 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) |
| 251 | 227 |
| 252 # TODO(peria): Generate the target list from 'Window' and 'HTMLDocument'. | 228 # TODO(peria): Generate the target list from 'Window' and 'HTMLDocument'. |
| 253 needs_runtime_enabled_installer = v8_class_name in [ | 229 needs_runtime_enabled_installer = v8_class_name in [ |
| 254 'V8Window', 'V8HTMLDocument', 'V8Document', 'V8Node', 'V8EventTarget'] | 230 'V8Window', 'V8HTMLDocument', 'V8Document', 'V8Node', 'V8EventTarget'] |
| 255 | 231 |
| 256 context = { | 232 context = { |
| 257 'cpp_class': cpp_class_name, | 233 'cpp_class': cpp_class_name, |
| 258 'cpp_class_or_partial': cpp_class_name_or_partial, | 234 'cpp_class_or_partial': cpp_class_name_or_partial, |
| 259 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', | 235 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', |
| 260 'is_gc_type': True, | 236 'is_gc_type': True, |
| 261 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 | 237 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 |
| 262 'has_access_check_callbacks': (is_check_security and | 238 'has_access_check_callbacks': (is_check_security and |
| 263 interface.name != 'EventTarget'), | 239 interface.name != 'EventTarget'), |
| 264 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] | 240 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] |
| 265 'has_partial_interface': len(interface.partial_interfaces) > 0, | 241 'has_partial_interface': len(interface.partial_interfaces) > 0, |
| 266 'has_visit_dom_wrapper': has_visit_dom_wrapper, | |
| 267 'header_includes': header_includes, | 242 'header_includes': header_includes, |
| 268 'interface_name': interface.name, | 243 'interface_name': interface.name, |
| 269 'is_array_buffer_or_view': is_array_buffer_or_view, | 244 'is_array_buffer_or_view': is_array_buffer_or_view, |
| 270 'is_check_security': is_check_security, | 245 'is_check_security': is_check_security, |
| 271 'is_event_target': is_event_target, | 246 'is_event_target': is_event_target, |
| 272 'is_exception': interface.is_exception, | 247 'is_exception': interface.is_exception, |
| 273 'is_global': is_global, | 248 'is_global': is_global, |
| 274 'is_immutable_prototype': is_immutable_prototype, | 249 'is_immutable_prototype': is_immutable_prototype, |
| 275 'is_node': inherits_interface(interface.name, 'Node'), | 250 'is_node': inherits_interface(interface.name, 'Node'), |
| 276 'is_partial': interface.is_partial, | 251 'is_partial': interface.is_partial, |
| 277 'is_typed_array_type': is_typed_array_type, | 252 'is_typed_array_type': is_typed_array_type, |
| 278 'lifetime': 'Dependent' if (has_visit_dom_wrapper or is_dependent_lifeti
me) else 'Independent', | 253 'lifetime': 'Dependent' if is_dependent_lifetime else 'Independent', |
| 279 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs] | 254 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs] |
| 280 'needs_runtime_enabled_installer': needs_runtime_enabled_installer, | 255 'needs_runtime_enabled_installer': needs_runtime_enabled_installer, |
| 281 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(interface), | 256 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(interface), |
| 282 'parent_interface': parent_interface, | 257 'parent_interface': parent_interface, |
| 283 'pass_cpp_type': cpp_name(interface) + '*', | 258 'pass_cpp_type': cpp_name(interface) + '*', |
| 284 'active_scriptwrappable': active_scriptwrappable, | 259 'active_scriptwrappable': active_scriptwrappable, |
| 285 'runtime_enabled_feature_name': runtime_enabled_feature_name(interface),
# [RuntimeEnabled] | 260 'runtime_enabled_feature_name': runtime_enabled_feature_name(interface),
# [RuntimeEnabled] |
| 286 'set_wrapper_reference_from': set_wrapper_reference_from, | |
| 287 'set_wrapper_reference_to': set_wrapper_reference_to, | |
| 288 'v8_class': v8_class_name, | 261 'v8_class': v8_class_name, |
| 289 'v8_class_or_partial': v8_class_name_or_partial, | 262 'v8_class_or_partial': v8_class_name_or_partial, |
| 290 'wrapper_class_id': wrapper_class_id, | 263 'wrapper_class_id': wrapper_class_id, |
| 291 } | 264 } |
| 292 | 265 |
| 293 # Constructors | 266 # Constructors |
| 294 constructors = [constructor_context(interface, constructor) | 267 constructors = [constructor_context(interface, constructor) |
| 295 for constructor in interface.constructors | 268 for constructor in interface.constructors |
| 296 # FIXME: shouldn't put named constructors with constructors | 269 # FIXME: shouldn't put named constructors with constructors |
| 297 # (currently needed for Perl compatibility) | 270 # (currently needed for Perl compatibility) |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 extended_attributes = deleter.extended_attributes | 1468 extended_attributes = deleter.extended_attributes |
| 1496 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1469 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
| 1497 is_ce_reactions = 'CEReactions' in extended_attributes | 1470 is_ce_reactions = 'CEReactions' in extended_attributes |
| 1498 return { | 1471 return { |
| 1499 'is_call_with_script_state': is_call_with_script_state, | 1472 'is_call_with_script_state': is_call_with_script_state, |
| 1500 'is_ce_reactions': is_ce_reactions, | 1473 'is_ce_reactions': is_ce_reactions, |
| 1501 'is_custom': 'Custom' in extended_attributes, | 1474 'is_custom': 'Custom' in extended_attributes, |
| 1502 'is_raises_exception': 'RaisesException' in extended_attributes, | 1475 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1503 'name': cpp_name(deleter), | 1476 'name': cpp_name(deleter), |
| 1504 } | 1477 } |
| OLD | NEW |