| 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 20 matching lines...) Expand all Loading... |
| 31 Extends IdlType with property |constructor_type_name|. | 31 Extends IdlType with property |constructor_type_name|. |
| 32 | 32 |
| 33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler | 33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler |
| 34 """ | 34 """ |
| 35 | 35 |
| 36 import idl_types | 36 import idl_types |
| 37 from idl_types import inherits_interface | 37 from idl_types import inherits_interface |
| 38 from v8_globals import includes, interfaces | 38 from v8_globals import includes, interfaces |
| 39 import v8_types | 39 import v8_types |
| 40 import v8_utilities | 40 import v8_utilities |
| 41 from v8_utilities import capitalize, cpp_name, has_extended_attribute, has_exten
ded_attribute_value, scoped_name, strip_suffix, uncapitalize | 41 from v8_utilities import (capitalize, cpp_name, has_extended_attribute, |
| 42 has_extended_attribute_value, scoped_name, strip_suffi
x, |
| 43 uncapitalize, extended_attribute_value_as_list) |
| 42 | 44 |
| 43 | 45 |
| 44 def attribute_context(interface, attribute): | 46 def attribute_context(interface, attribute): |
| 45 idl_type = attribute.idl_type | 47 idl_type = attribute.idl_type |
| 46 base_idl_type = idl_type.base_type | 48 base_idl_type = idl_type.base_type |
| 47 extended_attributes = attribute.extended_attributes | 49 extended_attributes = attribute.extended_attributes |
| 48 | 50 |
| 49 idl_type.add_includes_for_type() | 51 idl_type.add_includes_for_type() |
| 50 | 52 |
| 51 # [CheckSecurity] | 53 # [CheckSecurity] |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 'name': attribute.name, | 130 'name': attribute.name, |
| 129 'only_exposed_to_private_script': is_only_exposed_to_private_script, | 131 'only_exposed_to_private_script': is_only_exposed_to_private_script, |
| 130 'per_context_enabled_function': v8_utilities.per_context_enabled_functio
n_name(attribute), # [PerContextEnabled] | 132 'per_context_enabled_function': v8_utilities.per_context_enabled_functio
n_name(attribute), # [PerContextEnabled] |
| 131 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( | 133 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( |
| 132 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is
olate()', used_in_private_script=True), | 134 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is
olate()', used_in_private_script=True), |
| 133 'property_attributes': property_attributes(attribute), | 135 'property_attributes': property_attributes(attribute), |
| 134 'put_forwards': 'PutForwards' in extended_attributes, | 136 'put_forwards': 'PutForwards' in extended_attributes, |
| 135 'reflect_empty': extended_attributes.get('ReflectEmpty'), | 137 'reflect_empty': extended_attributes.get('ReflectEmpty'), |
| 136 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), | 138 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), |
| 137 'reflect_missing': extended_attributes.get('ReflectMissing'), | 139 'reflect_missing': extended_attributes.get('ReflectMissing'), |
| 138 'reflect_only': extended_attributes['ReflectOnly'].split('|') | 140 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), |
| 139 if 'ReflectOnly' in extended_attributes else None, | |
| 140 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] | 141 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] |
| 141 'setter_callback': setter_callback_name(interface, attribute), | 142 'setter_callback': setter_callback_name(interface, attribute), |
| 142 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), | 143 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), |
| 143 'world_suffixes': ['', 'ForMainWorld'] | 144 'world_suffixes': ['', 'ForMainWorld'] |
| 144 if 'PerWorldBindings' in extended_attributes | 145 if 'PerWorldBindings' in extended_attributes |
| 145 else [''], # [PerWorldBindings] | 146 else [''], # [PerWorldBindings] |
| 146 } | 147 } |
| 147 | 148 |
| 148 if is_constructor_attribute(attribute): | 149 if is_constructor_attribute(attribute): |
| 149 constructor_getter_context(interface, attribute, context) | 150 constructor_getter_context(interface, attribute, context) |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 lambda self: strip_suffix(self.base_type, 'Constructor')) | 494 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 494 | 495 |
| 495 | 496 |
| 496 def is_constructor_attribute(attribute): | 497 def is_constructor_attribute(attribute): |
| 497 # FIXME: replace this with [ConstructorAttribute] extended attribute | 498 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 498 return attribute.idl_type.name.endswith('Constructor') | 499 return attribute.idl_type.name.endswith('Constructor') |
| 499 | 500 |
| 500 | 501 |
| 501 def constructor_getter_context(interface, attribute, context): | 502 def constructor_getter_context(interface, attribute, context): |
| 502 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 503 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
| OLD | NEW |