| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 'is_read_only': attribute.is_read_only, | 135 'is_read_only': attribute.is_read_only, |
| 136 'is_reflect': is_reflect, | 136 'is_reflect': is_reflect, |
| 137 'is_replaceable': 'Replaceable' in attribute.extended_attributes, | 137 'is_replaceable': 'Replaceable' in attribute.extended_attributes, |
| 138 'is_static': attribute.is_static, | 138 'is_static': attribute.is_static, |
| 139 'is_url': 'URL' in extended_attributes, | 139 'is_url': 'URL' in extended_attributes, |
| 140 'is_unforgeable': is_unforgeable(interface, attribute), | 140 'is_unforgeable': is_unforgeable(interface, attribute), |
| 141 'on_instance': v8_utilities.on_instance(interface, attribute), | 141 'on_instance': v8_utilities.on_instance(interface, attribute), |
| 142 'on_interface': v8_utilities.on_interface(interface, attribute), | 142 'on_interface': v8_utilities.on_interface(interface, attribute), |
| 143 'on_prototype': v8_utilities.on_prototype(interface, attribute), | 143 'on_prototype': v8_utilities.on_prototype(interface, attribute), |
| 144 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(attribute), # [OriginTrialEnabled] | 144 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(attribute), # [OriginTrialEnabled] |
| 145 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(attr
ibute), # [OriginTrialEnabled] |
| 145 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, | 146 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, |
| 146 'measure_as': v8_utilities.measure_as(attribute, interface), # [Measure
As] | 147 'measure_as': v8_utilities.measure_as(attribute, interface), # [Measure
As] |
| 147 'name': attribute.name, | 148 'name': attribute.name, |
| 148 'only_exposed_to_private_script': is_only_exposed_to_private_script, | 149 'only_exposed_to_private_script': is_only_exposed_to_private_script, |
| 149 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( | 150 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( |
| 150 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa
lse', isolate='scriptState->isolate()'), | 151 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa
lse', isolate='scriptState->isolate()'), |
| 151 'property_attributes': property_attributes(interface, attribute), | 152 'property_attributes': property_attributes(interface, attribute), |
| 152 'reflect_empty': extended_attributes.get('ReflectEmpty'), | 153 'reflect_empty': extended_attributes.get('ReflectEmpty'), |
| 153 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), | 154 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), |
| 154 'reflect_missing': extended_attributes.get('ReflectMissing'), | 155 'reflect_missing': extended_attributes.get('ReflectMissing'), |
| 155 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), | 156 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), |
| 156 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] | 157 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] |
| 157 'runtime_feature_name': v8_utilities.runtime_feature_name(attribute), #
[RuntimeEnabled] | 158 'runtime_feature_name': v8_utilities.runtime_feature_name(attribute), #
[RuntimeEnabled] |
| 158 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), | 159 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), |
| 159 'world_suffixes': ( | 160 'world_suffixes': ( |
| 160 ['', 'ForMainWorld'] | 161 ['', 'ForMainWorld'] |
| 161 if 'PerWorldBindings' in extended_attributes | 162 if 'PerWorldBindings' in extended_attributes |
| 162 else ['']), # [PerWorldBindings] | 163 else ['']), # [PerWorldBindings] |
| 163 } | 164 } |
| 164 | 165 |
| 165 if is_constructor_attribute(attribute): | 166 if is_constructor_attribute(attribute): |
| 166 update_constructor_attribute_context(interface, attribute, context) | 167 update_constructor_attribute_context(interface, attribute, context) |
| 167 if not has_custom_getter(attribute): | 168 if not has_custom_getter(attribute): |
| 168 getter_context(interface, attribute, context) | 169 getter_context(interface, attribute, context) |
| 169 if not has_custom_setter(attribute) and has_setter(interface, attribute): | 170 if not has_custom_setter(attribute) and has_setter(interface, attribute): |
| 170 setter_context(interface, attribute, context) | 171 setter_context(interface, attribute, context) |
| 171 | 172 |
| 173 # [OriginTrialEnabled] |
| 174 # TODO(iclelland): Allow origin trials on static interfaces |
| 175 # (crbug.com/614352) |
| 176 if context['origin_trial_feature_name'] and context['on_interface']: |
| 177 raise Exception('[OriginTrialEnabled] cannot be specified on static ' |
| 178 'attributes: %s.%s' % (interface.name, attribute.name)) |
| 179 |
| 172 return context | 180 return context |
| 173 | 181 |
| 174 | 182 |
| 175 def filter_has_accessor_configuration(attributes): | 183 def filter_has_accessor_configuration(attributes): |
| 176 return [attribute for attribute in attributes if | 184 return [attribute for attribute in attributes if |
| 177 not (attribute['exposed_test'] or | 185 not (attribute['exposed_test'] or |
| 186 attribute['origin_trial_enabled_function'] or |
| 178 attribute['runtime_enabled_function']) and | 187 attribute['runtime_enabled_function']) and |
| 179 not attribute['is_data_type_property'] and | 188 not attribute['is_data_type_property'] and |
| 180 attribute['should_be_exposed_to_script']] | 189 attribute['should_be_exposed_to_script']] |
| 181 | 190 |
| 182 | 191 |
| 183 def filter_has_attribute_configuration(attributes): | 192 def filter_has_attribute_configuration(attributes): |
| 184 return [attribute for attribute in attributes if | 193 return [attribute for attribute in attributes if |
| 185 not (attribute['exposed_test'] or | 194 not (attribute['exposed_test'] or |
| 195 attribute['origin_trial_enabled_function'] or |
| 186 attribute['runtime_enabled_function']) and | 196 attribute['runtime_enabled_function']) and |
| 187 attribute['is_data_type_property'] and | 197 attribute['is_data_type_property'] and |
| 188 attribute['should_be_exposed_to_script']] | 198 attribute['should_be_exposed_to_script']] |
| 189 | 199 |
| 190 | 200 |
| 201 def filter_origin_trial_enabled(attributes): |
| 202 return [attribute for attribute in attributes if |
| 203 attribute['origin_trial_feature_name'] and |
| 204 not attribute['exposed_test']] |
| 205 |
| 206 |
| 191 def filter_runtime_enabled(attributes): | 207 def filter_runtime_enabled(attributes): |
| 192 return [attribute for attribute in attributes if | 208 return [attribute for attribute in attributes if |
| 193 attribute['runtime_feature_name'] and | 209 attribute['runtime_feature_name'] and |
| 194 not attribute['exposed_test']] | 210 not attribute['exposed_test']] |
| 195 | 211 |
| 196 | 212 |
| 197 def attribute_filters(): | 213 def attribute_filters(): |
| 198 return {'has_accessor_configuration': filter_has_accessor_configuration, | 214 return {'has_accessor_configuration': filter_has_accessor_configuration, |
| 199 'has_attribute_configuration': filter_has_attribute_configuration, | 215 'has_attribute_configuration': filter_has_attribute_configuration, |
| 216 'origin_trial_enabled_attributes': filter_origin_trial_enabled, |
| 200 'runtime_enabled_attributes': filter_runtime_enabled, | 217 'runtime_enabled_attributes': filter_runtime_enabled, |
| 201 } | 218 } |
| 202 | 219 |
| 203 | 220 |
| 204 ################################################################################ | 221 ################################################################################ |
| 205 # Getter | 222 # Getter |
| 206 ################################################################################ | 223 ################################################################################ |
| 207 | 224 |
| 208 def getter_context(interface, attribute, context): | 225 def getter_context(interface, attribute, context): |
| 209 idl_type = attribute.idl_type | 226 idl_type = attribute.idl_type |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 lambda self: strip_suffix(self.base_type, 'Constructor')) | 560 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 544 | 561 |
| 545 | 562 |
| 546 def is_constructor_attribute(attribute): | 563 def is_constructor_attribute(attribute): |
| 547 # FIXME: replace this with [ConstructorAttribute] extended attribute | 564 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 548 return attribute.idl_type.name.endswith('Constructor') | 565 return attribute.idl_type.name.endswith('Constructor') |
| 549 | 566 |
| 550 | 567 |
| 551 def update_constructor_attribute_context(interface, attribute, context): | 568 def update_constructor_attribute_context(interface, attribute, context): |
| 552 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] or context['origin_trial_enabled_function'] # TODO(chasej):
Should/can this be true when OriginTrialEnabled is inherited from containing in
terface? | 569 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] or context['origin_trial_enabled_function'] # TODO(chasej):
Should/can this be true when OriginTrialEnabled is inherited from containing in
terface? |
| OLD | NEW |