| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 'is_custom_element_callbacks': is_custom_element_callbacks, | 107 'is_custom_element_callbacks': is_custom_element_callbacks, |
| 108 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, | 108 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, |
| 109 'is_getter_raises_exception': # [RaisesException] | 109 'is_getter_raises_exception': # [RaisesException] |
| 110 'RaisesException' in extended_attributes and | 110 'RaisesException' in extended_attributes and |
| 111 extended_attributes['RaisesException'] in (None, 'Getter'), | 111 extended_attributes['RaisesException'] in (None, 'Getter'), |
| 112 'is_implemented_in_private_script': is_implemented_in_private_script, | 112 'is_implemented_in_private_script': is_implemented_in_private_script, |
| 113 'is_initialized_by_event_constructor': | 113 'is_initialized_by_event_constructor': |
| 114 'InitializedByEventConstructor' in extended_attributes, | 114 'InitializedByEventConstructor' in extended_attributes, |
| 115 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), | 115 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), |
| 116 'is_nullable': idl_type.is_nullable, | 116 'is_nullable': idl_type.is_nullable, |
| 117 'is_nullable_simple': idl_type.is_nullable_simple, | 117 'is_explicit_nullable': idl_type.is_explicit_nullable, |
| 118 'is_partial_interface_member': | 118 'is_partial_interface_member': |
| 119 'PartialInterfaceImplementedAs' in extended_attributes, | 119 'PartialInterfaceImplementedAs' in extended_attributes, |
| 120 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, | 120 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, |
| 121 'is_read_only': attribute.is_read_only, | 121 'is_read_only': attribute.is_read_only, |
| 122 'is_reflect': is_reflect, | 122 'is_reflect': is_reflect, |
| 123 'is_replaceable': 'Replaceable' in attribute.extended_attributes, | 123 'is_replaceable': 'Replaceable' in attribute.extended_attributes, |
| 124 'is_static': attribute.is_static, | 124 'is_static': attribute.is_static, |
| 125 'is_url': 'URL' in extended_attributes, | 125 'is_url': 'URL' in extended_attributes, |
| 126 'is_unforgeable': 'Unforgeable' in extended_attributes, | 126 'is_unforgeable': 'Unforgeable' in extended_attributes, |
| 127 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] | 127 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if 'ImplementedInPrivateScript' in extended_attributes: | 176 if 'ImplementedInPrivateScript' in extended_attributes: |
| 177 if (not idl_type.is_wrapper_type and | 177 if (not idl_type.is_wrapper_type and |
| 178 not idl_type.is_basic_type): | 178 not idl_type.is_basic_type): |
| 179 raise Exception('Private scripts supports only primitive types and D
OM wrappers.') | 179 raise Exception('Private scripts supports only primitive types and D
OM wrappers.') |
| 180 | 180 |
| 181 context['cpp_value_original'] = cpp_value | 181 context['cpp_value_original'] = cpp_value |
| 182 cpp_value = 'result' | 182 cpp_value = 'result' |
| 183 # EventHandler has special handling | 183 # EventHandler has special handling |
| 184 if base_idl_type != 'EventHandler': | 184 if base_idl_type != 'EventHandler': |
| 185 release = idl_type.release | 185 release = idl_type.release |
| 186 elif ((idl_type.is_nullable and not context['is_nullable_simple']) or | 186 elif (idl_type.is_explicit_nullable or |
| 187 base_idl_type == 'EventHandler' or | 187 base_idl_type == 'EventHandler' or |
| 188 'CachedAttribute' in extended_attributes or | 188 'CachedAttribute' in extended_attributes or |
| 189 'LogPreviousValue' in extended_attributes or | 189 'LogPreviousValue' in extended_attributes or |
| 190 'ReflectOnly' in extended_attributes or | 190 'ReflectOnly' in extended_attributes or |
| 191 context['is_keep_alive_for_gc'] or | 191 context['is_keep_alive_for_gc'] or |
| 192 context['is_getter_raises_exception']): | 192 context['is_getter_raises_exception']): |
| 193 context['cpp_value_original'] = cpp_value | 193 context['cpp_value_original'] = cpp_value |
| 194 cpp_value = 'cppValue' | 194 cpp_value = 'cppValue' |
| 195 # EventHandler has special handling | 195 # EventHandler has special handling |
| 196 if base_idl_type != 'EventHandler': | 196 if base_idl_type != 'EventHandler': |
| (...skipping 24 matching lines...) Expand all Loading... |
| 221 arguments.append('impl') | 221 arguments.append('impl') |
| 222 arguments.append('&result') | 222 arguments.append('&result') |
| 223 arguments.extend(v8_utilities.call_with_arguments( | 223 arguments.extend(v8_utilities.call_with_arguments( |
| 224 attribute.extended_attributes.get('CallWith'))) | 224 attribute.extended_attributes.get('CallWith'))) |
| 225 # Members of IDL partial interface definitions are implemented in C++ as | 225 # Members of IDL partial interface definitions are implemented in C++ as |
| 226 # static member functions, which for instance members (non-static members) | 226 # static member functions, which for instance members (non-static members) |
| 227 # take *impl as their first argument | 227 # take *impl as their first argument |
| 228 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and | 228 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and |
| 229 not attribute.is_static): | 229 not attribute.is_static): |
| 230 arguments.append('*impl') | 230 arguments.append('*impl') |
| 231 if attribute.idl_type.is_nullable and not context['is_nullable_simple']: | 231 if attribute.idl_type.is_explicit_nullable: |
| 232 arguments.append('isNull') | 232 arguments.append('isNull') |
| 233 if context['is_getter_raises_exception']: | 233 if context['is_getter_raises_exception']: |
| 234 arguments.append('exceptionState') | 234 arguments.append('exceptionState') |
| 235 return '%s(%s)' % (getter_name, ', '.join(arguments)) | 235 return '%s(%s)' % (getter_name, ', '.join(arguments)) |
| 236 | 236 |
| 237 | 237 |
| 238 CONTENT_ATTRIBUTE_GETTER_NAMES = { | 238 CONTENT_ATTRIBUTE_GETTER_NAMES = { |
| 239 'boolean': 'fastHasAttribute', | 239 'boolean': 'fastHasAttribute', |
| 240 'long': 'getIntegralAttribute', | 240 'long': 'getIntegralAttribute', |
| 241 'unsigned long': 'getUnsignedIntegralAttribute', | 241 'unsigned long': 'getUnsignedIntegralAttribute', |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 lambda self: strip_suffix(self.base_type, 'Constructor')) | 466 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 467 | 467 |
| 468 | 468 |
| 469 def is_constructor_attribute(attribute): | 469 def is_constructor_attribute(attribute): |
| 470 # FIXME: replace this with [ConstructorAttribute] extended attribute | 470 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 471 return attribute.idl_type.base_type.endswith('Constructor') | 471 return attribute.idl_type.base_type.endswith('Constructor') |
| 472 | 472 |
| 473 | 473 |
| 474 def constructor_getter_context(interface, attribute, context): | 474 def constructor_getter_context(interface, attribute, context): |
| 475 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 475 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
| OLD | NEW |