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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 'name': attribute.name, | 148 'name': attribute.name, |
149 'only_exposed_to_private_script': is_only_exposed_to_private_script, | 149 'only_exposed_to_private_script': is_only_exposed_to_private_script, |
150 '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( |
151 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()'), |
152 'property_attributes': property_attributes(interface, attribute), | 152 'property_attributes': property_attributes(interface, attribute), |
153 'reflect_empty': extended_attributes.get('ReflectEmpty'), | 153 'reflect_empty': extended_attributes.get('ReflectEmpty'), |
154 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), | 154 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), |
155 'reflect_missing': extended_attributes.get('ReflectMissing'), | 155 'reflect_missing': extended_attributes.get('ReflectMissing'), |
156 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), | 156 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), |
157 '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] |
| 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 |
172 return context | 173 return context |
173 | 174 |
174 | 175 |
| 176 def filter_has_accessor_configuration(attributes): |
| 177 return [attribute for attribute in attributes if |
| 178 not (attribute['exposed_test'] or |
| 179 attribute['runtime_enabled_function']) and |
| 180 not attribute['is_data_type_property'] and |
| 181 attribute['should_be_exposed_to_script']] |
| 182 |
| 183 |
| 184 def filter_has_attribute_configuration(attributes): |
| 185 return [attribute for attribute in attributes if |
| 186 not (attribute['exposed_test'] or |
| 187 attribute['runtime_enabled_function']) and |
| 188 attribute['is_data_type_property'] and |
| 189 attribute['should_be_exposed_to_script']] |
| 190 |
| 191 |
| 192 def filter_runtime_enabled(attributes): |
| 193 return [attribute for attribute in attributes if |
| 194 attribute['runtime_feature_name'] and |
| 195 not attribute['exposed_test']] |
| 196 |
| 197 |
| 198 def attribute_filters(): |
| 199 return {'has_accessor_configuration': filter_has_accessor_configuration, |
| 200 'has_attribute_configuration': filter_has_attribute_configuration, |
| 201 'runtime_enabled_attributes': filter_runtime_enabled, |
| 202 } |
| 203 |
| 204 |
175 ################################################################################ | 205 ################################################################################ |
176 # Getter | 206 # Getter |
177 ################################################################################ | 207 ################################################################################ |
178 | 208 |
179 def getter_context(interface, attribute, context): | 209 def getter_context(interface, attribute, context): |
180 idl_type = attribute.idl_type | 210 idl_type = attribute.idl_type |
181 base_idl_type = idl_type.base_type | 211 base_idl_type = idl_type.base_type |
182 extended_attributes = attribute.extended_attributes | 212 extended_attributes = attribute.extended_attributes |
183 | 213 |
184 cpp_value = getter_expression(interface, attribute, context) | 214 cpp_value = getter_expression(interface, attribute, context) |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 lambda self: strip_suffix(self.base_type, 'Constructor')) | 544 lambda self: strip_suffix(self.base_type, 'Constructor')) |
515 | 545 |
516 | 546 |
517 def is_constructor_attribute(attribute): | 547 def is_constructor_attribute(attribute): |
518 # FIXME: replace this with [ConstructorAttribute] extended attribute | 548 # FIXME: replace this with [ConstructorAttribute] extended attribute |
519 return attribute.idl_type.name.endswith('Constructor') | 549 return attribute.idl_type.name.endswith('Constructor') |
520 | 550 |
521 | 551 |
522 def update_constructor_attribute_context(interface, attribute, context): | 552 def update_constructor_attribute_context(interface, attribute, context): |
523 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? | 553 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 |