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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended
_attributes | 80 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended
_attributes |
81 # [PerWorldBindings] | 81 # [PerWorldBindings] |
82 if 'PerWorldBindings' in extended_attributes: | 82 if 'PerWorldBindings' in extended_attributes: |
83 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes,
'[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface
.name, attribute.name) | 83 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes,
'[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface
.name, attribute.name) |
84 | 84 |
85 if (base_idl_type == 'EventHandler' and | 85 if (base_idl_type == 'EventHandler' and |
86 interface.name in ['Window', 'WorkerGlobalScope'] and | 86 interface.name in ['Window', 'WorkerGlobalScope'] and |
87 attribute.name == 'onerror'): | 87 attribute.name == 'onerror'): |
88 includes.add('bindings/core/v8/V8ErrorHandler.h') | 88 includes.add('bindings/core/v8/V8ErrorHandler.h') |
89 | 89 |
| 90 cached_attribute_validation_method = extended_attributes.get('CachedAttribut
e') |
| 91 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute) |
| 92 if cached_attribute_validation_method or keep_alive_for_gc: |
| 93 includes.add('bindings/core/v8/V8HiddenValue.h') |
| 94 |
90 context = { | 95 context = { |
91 'access_control_list': access_control_list(interface, attribute), | 96 'access_control_list': access_control_list(interface, attribute), |
92 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] | 97 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] |
93 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] | 98 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] |
94 'activity_logging_world_check': v8_utilities.activity_logging_world_chec
k(attribute), # [ActivityLogging] | 99 'activity_logging_world_check': v8_utilities.activity_logging_world_chec
k(attribute), # [ActivityLogging] |
95 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 100 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
96 'cached_attribute_validation_method': extended_attributes.get('CachedAtt
ribute'), | 101 'cached_attribute_validation_method': cached_attribute_validation_method
, |
97 'conditional_string': v8_utilities.conditional_string(attribute), | 102 'conditional_string': v8_utilities.conditional_string(attribute), |
98 'constructor_type': idl_type.constructor_type_name | 103 'constructor_type': idl_type.constructor_type_name |
99 if is_constructor_attribute(attribute) else None, | 104 if is_constructor_attribute(attribute) else None, |
100 'cpp_name': cpp_name(attribute), | 105 'cpp_name': cpp_name(attribute), |
101 'cpp_type': idl_type.cpp_type, | 106 'cpp_type': idl_type.cpp_type, |
102 'cpp_type_initializer': idl_type.cpp_type_initializer, | 107 'cpp_type_initializer': idl_type.cpp_type_initializer, |
103 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] | 108 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] |
104 'enum_validation_expression': idl_type.enum_validation_expression, | 109 'enum_validation_expression': idl_type.enum_validation_expression, |
105 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] | 110 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] |
106 'has_custom_getter': has_custom_getter(attribute), | 111 'has_custom_getter': has_custom_getter(attribute), |
107 'has_custom_setter': has_custom_setter(attribute), | 112 'has_custom_setter': has_custom_setter(attribute), |
108 'has_setter': has_setter(attribute), | 113 'has_setter': has_setter(attribute), |
109 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 114 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType |
110 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), | 115 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), |
111 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), | 116 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), |
112 'is_check_security_for_frame': is_check_security_for_frame, | 117 'is_check_security_for_frame': is_check_security_for_frame, |
113 'is_check_security_for_node': is_check_security_for_node, | 118 'is_check_security_for_node': is_check_security_for_node, |
114 'is_check_security_for_window': is_check_security_for_window, | 119 'is_check_security_for_window': is_check_security_for_window, |
115 'is_custom_element_callbacks': is_custom_element_callbacks, | 120 'is_custom_element_callbacks': is_custom_element_callbacks, |
116 'is_expose_js_accessors': is_expose_js_accessors(interface, attribute), | 121 'is_expose_js_accessors': is_expose_js_accessors(interface, attribute), |
117 'is_getter_raises_exception': # [RaisesException] | 122 'is_getter_raises_exception': # [RaisesException] |
118 'RaisesException' in extended_attributes and | 123 'RaisesException' in extended_attributes and |
119 extended_attributes['RaisesException'] in (None, 'Getter'), | 124 extended_attributes['RaisesException'] in (None, 'Getter'), |
120 'is_implemented_in_private_script': is_implemented_in_private_script, | 125 'is_implemented_in_private_script': is_implemented_in_private_script, |
121 'is_initialized_by_event_constructor': | 126 'is_initialized_by_event_constructor': |
122 'InitializedByEventConstructor' in extended_attributes, | 127 'InitializedByEventConstructor' in extended_attributes, |
123 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), | 128 'is_keep_alive_for_gc': keep_alive_for_gc, |
124 'is_nullable': idl_type.is_nullable, | 129 'is_nullable': idl_type.is_nullable, |
125 'is_explicit_nullable': idl_type.is_explicit_nullable, | 130 'is_explicit_nullable': idl_type.is_explicit_nullable, |
126 'is_partial_interface_member': | 131 'is_partial_interface_member': |
127 'PartialInterfaceImplementedAs' in extended_attributes, | 132 'PartialInterfaceImplementedAs' in extended_attributes, |
128 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, | 133 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, |
129 'is_put_forwards': 'PutForwards' in extended_attributes, | 134 'is_put_forwards': 'PutForwards' in extended_attributes, |
130 'is_read_only': attribute.is_read_only, | 135 'is_read_only': attribute.is_read_only, |
131 'is_reflect': is_reflect, | 136 'is_reflect': is_reflect, |
132 'is_replaceable': 'Replaceable' in attribute.extended_attributes, | 137 'is_replaceable': 'Replaceable' in attribute.extended_attributes, |
133 'is_static': attribute.is_static, | 138 'is_static': attribute.is_static, |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 return attribute.idl_type.name.endswith('Constructor') | 534 return attribute.idl_type.name.endswith('Constructor') |
530 | 535 |
531 | 536 |
532 def update_constructor_attribute_context(interface, attribute, context): | 537 def update_constructor_attribute_context(interface, attribute, context): |
533 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 538 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
534 # When the attribute name is the same as the interface name, do not generate | 539 # When the attribute name is the same as the interface name, do not generate |
535 # callback functions for each attribute and use | 540 # callback functions for each attribute and use |
536 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate | 541 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
537 # a callback function in order to hard-code the attribute name. | 542 # a callback function in order to hard-code the attribute name. |
538 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] | 543 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] |
OLD | NEW |