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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (base_idl_type == 'EventHandler' and | 87 if (base_idl_type == 'EventHandler' and |
88 interface.name in ['Window', 'WorkerGlobalScope'] and | 88 interface.name in ['Window', 'WorkerGlobalScope'] and |
89 attribute.name == 'onerror'): | 89 attribute.name == 'onerror'): |
90 includes.add('bindings/core/v8/V8ErrorHandler.h') | 90 includes.add('bindings/core/v8/V8ErrorHandler.h') |
91 | 91 |
92 cached_attribute_validation_method = extended_attributes.get('CachedAttribut
e') | 92 cached_attribute_validation_method = extended_attributes.get('CachedAttribut
e') |
93 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute) | 93 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute) |
94 if cached_attribute_validation_method or keep_alive_for_gc: | 94 if cached_attribute_validation_method or keep_alive_for_gc: |
95 includes.add('bindings/core/v8/V8HiddenValue.h') | 95 includes.add('bindings/core/v8/V8HiddenValue.h') |
96 | 96 |
97 if 'APIExperimentEnabled' in extended_attributes: | 97 if 'OriginTrialEnabled' in extended_attributes: |
98 includes.add('core/inspector/ConsoleMessage.h') | 98 includes.add('core/inspector/ConsoleMessage.h') |
99 includes.add('core/origin_trials/OriginTrials.h') | 99 includes.add('core/origin_trials/OriginTrials.h') |
100 | 100 |
101 context = { | 101 context = { |
102 'access_control_list': access_control_list(interface, attribute), | 102 'access_control_list': access_control_list(interface, attribute), |
103 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] | 103 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] |
104 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] | 104 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] |
105 'activity_logging_world_check': v8_utilities.activity_logging_world_chec
k(attribute), # [ActivityLogging] | 105 'activity_logging_world_check': v8_utilities.activity_logging_world_chec
k(attribute), # [ActivityLogging] |
106 'api_experiment_enabled': v8_utilities.api_experiment_enabled_function(a
ttribute), # [APIExperimentEnabled] | |
107 'api_experiment_enabled_per_interface': v8_utilities.api_experiment_enab
led_function(interface), # [APIExperimentEnabled] | |
108 'api_experiment_name': extended_attributes.get('APIExperimentEnabled'),
# [APIExperimentEnabled] | |
109 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 106 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
110 'cached_attribute_validation_method': cached_attribute_validation_method
, | 107 'cached_attribute_validation_method': cached_attribute_validation_method
, |
111 'constructor_type': constructor_type, | 108 'constructor_type': constructor_type, |
112 'cpp_name': cpp_name(attribute), | 109 'cpp_name': cpp_name(attribute), |
113 'cpp_type': idl_type.cpp_type, | 110 'cpp_type': idl_type.cpp_type, |
114 'cpp_type_initializer': idl_type.cpp_type_initializer, | 111 'cpp_type_initializer': idl_type.cpp_type_initializer, |
115 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] | 112 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] |
116 'enum_type': idl_type.enum_type, | 113 'enum_type': idl_type.enum_type, |
117 'enum_values': idl_type.enum_values, | 114 'enum_values': idl_type.enum_values, |
118 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] | 115 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] |
119 'has_custom_getter': has_custom_getter(attribute), | 116 'has_custom_getter': has_custom_getter(attribute), |
120 'has_custom_setter': has_custom_setter(attribute), | 117 'has_custom_setter': has_custom_setter(attribute), |
121 'has_setter': has_setter(attribute), | 118 'has_setter': has_setter(attribute), |
122 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 119 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType |
123 'is_api_experiment_enabled': v8_utilities.api_experiment_enabled_functio
n(attribute) or v8_utilities.api_experiment_enabled_function(interface), # [API
ExperimentEnabled] | 120 'is_origin_trial_enabled': v8_utilities.origin_trial_enabled_function(at
tribute) or v8_utilities.origin_trial_enabled_function(interface), # [OriginTri
alEnabled] |
124 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), | 121 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), |
125 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), | 122 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), |
126 'is_check_security_for_receiver': is_check_security_for_receiver, | 123 'is_check_security_for_receiver': is_check_security_for_receiver, |
127 'is_check_security_for_return_value': is_check_security_for_return_value
, | 124 'is_check_security_for_return_value': is_check_security_for_return_value
, |
128 'is_custom_element_callbacks': is_custom_element_callbacks, | 125 'is_custom_element_callbacks': is_custom_element_callbacks, |
129 # TODO(yukishiino): Make all DOM attributes accessor-type properties. | 126 # TODO(yukishiino): Make all DOM attributes accessor-type properties. |
130 'is_data_type_property': constructor_type or interface.name == 'Window'
or interface.name == 'Location', | 127 'is_data_type_property': constructor_type or interface.name == 'Window'
or interface.name == 'Location', |
131 'is_getter_raises_exception': # [RaisesException] | 128 'is_getter_raises_exception': # [RaisesException] |
132 'RaisesException' in extended_attributes and | 129 'RaisesException' in extended_attributes and |
133 extended_attributes['RaisesException'] in (None, 'Getter'), | 130 extended_attributes['RaisesException'] in (None, 'Getter'), |
134 'is_implemented_in_private_script': is_implemented_in_private_script, | 131 'is_implemented_in_private_script': is_implemented_in_private_script, |
135 'is_keep_alive_for_gc': keep_alive_for_gc, | 132 'is_keep_alive_for_gc': keep_alive_for_gc, |
136 'is_lenient_this': 'LenientThis' in extended_attributes, | 133 'is_lenient_this': 'LenientThis' in extended_attributes, |
137 'is_nullable': idl_type.is_nullable, | 134 'is_nullable': idl_type.is_nullable, |
138 'is_explicit_nullable': idl_type.is_explicit_nullable, | 135 'is_explicit_nullable': idl_type.is_explicit_nullable, |
139 'is_partial_interface_member': | 136 'is_partial_interface_member': |
140 'PartialInterfaceImplementedAs' in extended_attributes, | 137 'PartialInterfaceImplementedAs' in extended_attributes, |
141 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, | 138 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, |
142 'is_put_forwards': 'PutForwards' in extended_attributes, | 139 'is_put_forwards': 'PutForwards' in extended_attributes, |
143 'is_read_only': attribute.is_read_only, | 140 'is_read_only': attribute.is_read_only, |
144 'is_reflect': is_reflect, | 141 'is_reflect': is_reflect, |
145 'is_replaceable': 'Replaceable' in attribute.extended_attributes, | 142 'is_replaceable': 'Replaceable' in attribute.extended_attributes, |
146 'is_static': attribute.is_static, | 143 'is_static': attribute.is_static, |
147 'is_url': 'URL' in extended_attributes, | 144 'is_url': 'URL' in extended_attributes, |
148 'is_unforgeable': is_unforgeable(interface, attribute), | 145 'is_unforgeable': is_unforgeable(interface, attribute), |
149 'on_instance': v8_utilities.on_instance(interface, attribute), | 146 'on_instance': v8_utilities.on_instance(interface, attribute), |
150 'on_interface': v8_utilities.on_interface(interface, attribute), | 147 'on_interface': v8_utilities.on_interface(interface, attribute), |
151 'on_prototype': v8_utilities.on_prototype(interface, attribute), | 148 'on_prototype': v8_utilities.on_prototype(interface, attribute), |
| 149 'origin_trial_enabled': v8_utilities.origin_trial_enabled_function(attri
bute), # [OriginTrialEnabled] |
| 150 'origin_trial_enabled_per_interface': v8_utilities.origin_trial_enabled_
function(interface), # [OriginTrialEnabled] |
| 151 'origin_trial_name': extended_attributes.get('OriginTrialEnabled'), # [
OriginTrialEnabled] |
152 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, | 152 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, |
153 'measure_as': v8_utilities.measure_as(attribute, interface), # [Measure
As] | 153 'measure_as': v8_utilities.measure_as(attribute, interface), # [Measure
As] |
154 'name': attribute.name, | 154 'name': attribute.name, |
155 'only_exposed_to_private_script': is_only_exposed_to_private_script, | 155 'only_exposed_to_private_script': is_only_exposed_to_private_script, |
156 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( | 156 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( |
157 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa
lse', isolate='scriptState->isolate()'), | 157 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa
lse', isolate='scriptState->isolate()'), |
158 'property_attributes': property_attributes(interface, attribute), | 158 'property_attributes': property_attributes(interface, attribute), |
159 'reflect_empty': extended_attributes.get('ReflectEmpty'), | 159 'reflect_empty': extended_attributes.get('ReflectEmpty'), |
160 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), | 160 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), |
161 'reflect_missing': extended_attributes.get('ReflectMissing'), | 161 'reflect_missing': extended_attributes.get('ReflectMissing'), |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 505 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
506 lambda self: strip_suffix(self.base_type, 'Constructor')) | 506 lambda self: strip_suffix(self.base_type, 'Constructor')) |
507 | 507 |
508 | 508 |
509 def is_constructor_attribute(attribute): | 509 def is_constructor_attribute(attribute): |
510 # FIXME: replace this with [ConstructorAttribute] extended attribute | 510 # FIXME: replace this with [ConstructorAttribute] extended attribute |
511 return attribute.idl_type.name.endswith('Constructor') | 511 return attribute.idl_type.name.endswith('Constructor') |
512 | 512 |
513 | 513 |
514 def update_constructor_attribute_context(interface, attribute, context): | 514 def update_constructor_attribute_context(interface, attribute, context): |
515 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] or context['api_experiment_name'] | 515 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] or context['origin_trial_name'] |
516 # When the attribute name is the same as the interface name, do not generate | 516 # When the attribute name is the same as the interface name, do not generate |
517 # callback functions for each attribute and use | 517 # callback functions for each attribute and use |
518 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate | 518 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
519 # a callback function in order to hard-code the attribute name. | 519 # a callback function in order to hard-code the attribute name. |
520 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] | 520 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] |
OLD | NEW |