Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 if is_custom_element_callbacks or is_reflect: | 64 if is_custom_element_callbacks or is_reflect: |
| 65 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') | 65 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') |
| 66 # [PerWorldBindings] | 66 # [PerWorldBindings] |
| 67 if 'PerWorldBindings' in extended_attributes: | 67 if 'PerWorldBindings' in extended_attributes: |
| 68 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface .name, attribute.name) | 68 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface .name, attribute.name) |
| 69 # [TypeChecking] | 69 # [TypeChecking] |
| 70 has_type_checking_unrestricted = ( | 70 has_type_checking_unrestricted = ( |
| 71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or | 71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or |
| 72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted') ) and | 72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted') ) and |
| 73 idl_type.name in ('Float', 'Double')) | 73 idl_type.name in ('Float', 'Double')) |
| 74 # [ImplementedInPrivateScript] | |
| 75 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes | |
| 76 if is_implemented_in_private_script: | |
| 77 includes.add('bindings/core/v8/PrivateScriptRunner.h') | |
| 78 includes.add('core/frame/LocalFrame.h') | |
| 74 | 79 |
| 75 if (base_idl_type == 'EventHandler' and | 80 if (base_idl_type == 'EventHandler' and |
| 76 interface.name in ['Window', 'WorkerGlobalScope'] and | 81 interface.name in ['Window', 'WorkerGlobalScope'] and |
| 77 attribute.name == 'onerror'): | 82 attribute.name == 'onerror'): |
| 78 includes.add('bindings/core/v8/V8ErrorHandler.h') | 83 includes.add('bindings/core/v8/V8ErrorHandler.h') |
| 79 | 84 |
| 80 # Nullable type where the corresponding C++ type supports a null value. | 85 # Nullable type where the corresponding C++ type supports a null value. |
| 81 is_nullable_simple = idl_type.is_nullable and ( | 86 is_nullable_simple = idl_type.is_nullable and ( |
| 82 (idl_type.is_string_type or idl_type.is_wrapper_type) and | 87 (idl_type.is_string_type or idl_type.is_wrapper_type) and |
| 83 not idl_type.array_or_sequence_type) | 88 not idl_type.array_or_sequence_type) |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 101 'has_type_checking_unrestricted': has_type_checking_unrestricted, | 106 'has_type_checking_unrestricted': has_type_checking_unrestricted, |
| 102 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType | 107 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType |
| 103 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va lue(attribute, 'CallWith', 'ExecutionContext'), | 108 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va lue(attribute, 'CallWith', 'ExecutionContext'), |
| 104 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a ttribute, 'CallWith', 'ScriptState'), | 109 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a ttribute, 'CallWith', 'ScriptState'), |
| 105 'is_check_security_for_node': is_check_security_for_node, | 110 'is_check_security_for_node': is_check_security_for_node, |
| 106 'is_custom_element_callbacks': is_custom_element_callbacks, | 111 'is_custom_element_callbacks': is_custom_element_callbacks, |
| 107 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, | 112 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, |
| 108 'is_getter_raises_exception': # [RaisesException] | 113 'is_getter_raises_exception': # [RaisesException] |
| 109 'RaisesException' in extended_attributes and | 114 'RaisesException' in extended_attributes and |
| 110 extended_attributes['RaisesException'] in (None, 'Getter'), | 115 extended_attributes['RaisesException'] in (None, 'Getter'), |
| 116 'is_implemented_in_private_script': is_implemented_in_private_script, | |
| 111 'is_initialized_by_event_constructor': | 117 'is_initialized_by_event_constructor': |
| 112 'InitializedByEventConstructor' in extended_attributes, | 118 'InitializedByEventConstructor' in extended_attributes, |
| 113 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), | 119 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), |
| 114 'is_nullable': idl_type.is_nullable, | 120 'is_nullable': idl_type.is_nullable, |
| 115 'is_nullable_simple': is_nullable_simple, | 121 'is_nullable_simple': is_nullable_simple, |
| 116 'is_partial_interface_member': | 122 'is_partial_interface_member': |
| 117 'PartialInterfaceImplementedAs' in extended_attributes, | 123 'PartialInterfaceImplementedAs' in extended_attributes, |
| 118 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, | 124 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, |
| 119 'is_read_only': attribute.is_read_only, | 125 'is_read_only': attribute.is_read_only, |
| 120 'is_reflect': is_reflect, | 126 'is_reflect': is_reflect, |
| 121 'is_replaceable': 'Replaceable' in attribute.extended_attributes, | 127 'is_replaceable': 'Replaceable' in attribute.extended_attributes, |
| 122 'is_static': attribute.is_static, | 128 'is_static': attribute.is_static, |
| 123 'is_url': 'URL' in extended_attributes, | 129 'is_url': 'URL' in extended_attributes, |
| 124 'is_unforgeable': 'Unforgeable' in extended_attributes, | 130 'is_unforgeable': 'Unforgeable' in extended_attributes, |
| 125 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] | 131 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] |
| 126 'name': attribute.name, | 132 'name': attribute.name, |
| 127 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled] | 133 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled] |
| 134 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( | |
| 135 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', used_in_private_script=True), | |
| 128 'property_attributes': property_attributes(attribute), | 136 'property_attributes': property_attributes(attribute), |
| 129 'put_forwards': 'PutForwards' in extended_attributes, | 137 'put_forwards': 'PutForwards' in extended_attributes, |
| 138 'argument_cpp_type': idl_type.cpp_type_args(used_as_argument=True), | |
|
Jens Widell
2014/07/03 11:33:14
Alphabetical order. :-)
haraken
2014/07/03 11:56:09
Done.
| |
| 130 'reflect_empty': extended_attributes.get('ReflectEmpty'), | 139 'reflect_empty': extended_attributes.get('ReflectEmpty'), |
| 131 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), | 140 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), |
| 132 'reflect_missing': extended_attributes.get('ReflectMissing'), | 141 'reflect_missing': extended_attributes.get('ReflectMissing'), |
| 133 'reflect_only': extended_attributes['ReflectOnly'].split('|') | 142 'reflect_only': extended_attributes['ReflectOnly'].split('|') |
| 134 if 'ReflectOnly' in extended_attributes else None, | 143 if 'ReflectOnly' in extended_attributes else None, |
| 144 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled] | |
| 135 'setter_callback': setter_callback_name(interface, attribute), | 145 'setter_callback': setter_callback_name(interface, attribute), |
| 136 'v8_type': v8_types.v8_type(base_idl_type), | 146 'v8_type': v8_types.v8_type(base_idl_type), |
| 137 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled] | |
| 138 'world_suffixes': ['', 'ForMainWorld'] | 147 'world_suffixes': ['', 'ForMainWorld'] |
| 139 if 'PerWorldBindings' in extended_attributes | 148 if 'PerWorldBindings' in extended_attributes |
| 140 else [''], # [PerWorldBindings] | 149 else [''], # [PerWorldBindings] |
| 141 } | 150 } |
| 142 | 151 |
| 143 if is_constructor_attribute(attribute): | 152 if is_constructor_attribute(attribute): |
| 144 constructor_getter_context(interface, attribute, context) | 153 constructor_getter_context(interface, attribute, context) |
| 145 return context | 154 return context |
| 146 if not has_custom_getter: | 155 if not has_custom_getter: |
| 147 getter_context(interface, attribute, context) | 156 getter_context(interface, attribute, context) |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 172 if ((idl_type.is_nullable and not context['is_nullable_simple']) or | 181 if ((idl_type.is_nullable and not context['is_nullable_simple']) or |
| 173 base_idl_type == 'EventHandler' or | 182 base_idl_type == 'EventHandler' or |
| 174 'CachedAttribute' in extended_attributes or | 183 'CachedAttribute' in extended_attributes or |
| 175 'LogPreviousValue' in extended_attributes or | 184 'LogPreviousValue' in extended_attributes or |
| 176 'ReflectOnly' in extended_attributes or | 185 'ReflectOnly' in extended_attributes or |
| 177 context['is_keep_alive_for_gc'] or | 186 context['is_keep_alive_for_gc'] or |
| 178 context['is_getter_raises_exception']): | 187 context['is_getter_raises_exception']): |
| 179 context['cpp_value_original'] = cpp_value | 188 context['cpp_value_original'] = cpp_value |
| 180 cpp_value = 'cppValue' | 189 cpp_value = 'cppValue' |
| 181 # EventHandler has special handling | 190 # EventHandler has special handling |
| 182 if base_idl_type != 'EventHandler' and idl_type.is_interface_type: | 191 if base_idl_type != 'EventHandler': |
| 183 release = True | 192 release = idl_type.release |
| 193 | |
| 194 if 'ImplementedInPrivateScript' in extended_attributes: | |
|
Jens Widell
2014/07/03 11:33:14
Both this branch and the one before it pushes cpp_
haraken
2014/07/03 11:56:09
Yes, changed it to elif.
| |
| 195 if (not idl_type.is_wrapper_type and | |
| 196 not idl_type.is_basic_type): | |
| 197 raise Exception('Private scripts supports only primitive types and D OM wrappers.') | |
| 198 | |
| 199 context['cpp_value_original'] = cpp_value | |
| 200 cpp_value = 'result' | |
| 201 # EventHandler has special handling | |
| 202 if base_idl_type != 'EventHandler': | |
| 203 release = idl_type.release | |
| 184 | 204 |
| 185 def v8_set_return_value_statement(for_main_world=False): | 205 def v8_set_return_value_statement(for_main_world=False): |
| 186 if context['is_keep_alive_for_gc']: | 206 if context['is_keep_alive_for_gc']: |
| 187 return 'v8SetReturnValue(info, wrapper)' | 207 return 'v8SetReturnValue(info, wrapper)' |
| 188 return idl_type.v8_set_return_value(cpp_value, extended_attributes=exten ded_attributes, script_wrappable='impl', release=release, for_main_world=for_mai n_world) | 208 return idl_type.v8_set_return_value(cpp_value, extended_attributes=exten ded_attributes, script_wrappable='impl', release=release, for_main_world=for_mai n_world) |
| 189 | 209 |
| 190 context.update({ | 210 context.update({ |
| 191 'cpp_value': cpp_value, | 211 'cpp_value': cpp_value, |
| 192 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 212 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
| 193 cpp_value=cpp_value, creation_context='info.Holder()', | 213 cpp_value=cpp_value, creation_context='info.Holder()', |
| 194 extended_attributes=extended_attributes), | 214 extended_attributes=extended_attributes), |
| 195 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_ main_world=True), | 215 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_ main_world=True), |
| 196 'v8_set_return_value': v8_set_return_value_statement(), | 216 'v8_set_return_value': v8_set_return_value_statement(), |
| 197 }) | 217 }) |
| 198 | 218 |
| 199 | 219 |
| 200 def getter_expression(interface, attribute, context): | 220 def getter_expression(interface, attribute, context): |
| 201 arguments = [] | 221 arguments = [] |
| 202 this_getter_base_name = getter_base_name(interface, attribute, arguments) | 222 this_getter_base_name = getter_base_name(interface, attribute, arguments) |
| 203 getter_name = scoped_name(interface, attribute, this_getter_base_name) | 223 getter_name = scoped_name(interface, attribute, this_getter_base_name) |
| 204 | 224 |
| 225 if 'ImplementedInPrivateScript' in attribute.extended_attributes: | |
| 226 arguments.append('toFrameIfNotDetached(info.GetIsolate()->GetCurrentCont ext())') | |
| 227 arguments.append('impl') | |
| 228 arguments.append('&result') | |
| 205 arguments.extend(v8_utilities.call_with_arguments( | 229 arguments.extend(v8_utilities.call_with_arguments( |
| 206 attribute.extended_attributes.get('CallWith'))) | 230 attribute.extended_attributes.get('CallWith'))) |
| 207 # Members of IDL partial interface definitions are implemented in C++ as | 231 # Members of IDL partial interface definitions are implemented in C++ as |
| 208 # static member functions, which for instance members (non-static members) | 232 # static member functions, which for instance members (non-static members) |
| 209 # take *impl as their first argument | 233 # take *impl as their first argument |
| 210 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and | 234 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and |
| 211 not attribute.is_static): | 235 not attribute.is_static): |
| 212 arguments.append('*impl') | 236 arguments.append('*impl') |
| 213 if attribute.idl_type.is_nullable and not context['is_nullable_simple']: | 237 if attribute.idl_type.is_nullable and not context['is_nullable_simple']: |
| 214 arguments.append('isNull') | 238 arguments.append('isNull') |
| 215 if context['is_getter_raises_exception']: | 239 if context['is_getter_raises_exception']: |
| 216 arguments.append('exceptionState') | 240 arguments.append('exceptionState') |
| 217 return '%s(%s)' % (getter_name, ', '.join(arguments)) | 241 return '%s(%s)' % (getter_name, ', '.join(arguments)) |
| 218 | 242 |
| 219 | 243 |
| 220 CONTENT_ATTRIBUTE_GETTER_NAMES = { | 244 CONTENT_ATTRIBUTE_GETTER_NAMES = { |
| 221 'boolean': 'fastHasAttribute', | 245 'boolean': 'fastHasAttribute', |
| 222 'long': 'getIntegralAttribute', | 246 'long': 'getIntegralAttribute', |
| 223 'unsigned long': 'getUnsignedIntegralAttribute', | 247 'unsigned long': 'getUnsignedIntegralAttribute', |
| 224 } | 248 } |
| 225 | 249 |
| 226 | 250 |
| 227 def getter_base_name(interface, attribute, arguments): | 251 def getter_base_name(interface, attribute, arguments): |
| 228 extended_attributes = attribute.extended_attributes | 252 extended_attributes = attribute.extended_attributes |
| 253 | |
| 254 if 'ImplementedInPrivateScript' in extended_attributes: | |
| 255 return '%sAttributeGetterImplementedInPrivateScript' % uncapitalize(cpp_ name(attribute)) | |
| 256 | |
| 229 if 'Reflect' not in extended_attributes: | 257 if 'Reflect' not in extended_attributes: |
| 230 return uncapitalize(cpp_name(attribute)) | 258 return uncapitalize(cpp_name(attribute)) |
| 231 | 259 |
| 232 content_attribute_name = extended_attributes['Reflect'] or attribute.name.lo wer() | 260 content_attribute_name = extended_attributes['Reflect'] or attribute.name.lo wer() |
| 233 if content_attribute_name in ['class', 'id', 'name']: | 261 if content_attribute_name in ['class', 'id', 'name']: |
| 234 # Special-case for performance optimization. | 262 # Special-case for performance optimization. |
| 235 return 'get%sAttribute' % content_attribute_name.capitalize() | 263 return 'get%sAttribute' % content_attribute_name.capitalize() |
| 236 | 264 |
| 237 arguments.append(scoped_content_attribute_name(interface, attribute)) | 265 arguments.append(scoped_content_attribute_name(interface, attribute)) |
| 238 | 266 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 'has_setter_exception_state': | 331 'has_setter_exception_state': |
| 304 is_setter_raises_exception or has_type_checking_interface or | 332 is_setter_raises_exception or has_type_checking_interface or |
| 305 context['has_type_checking_unrestricted'] or | 333 context['has_type_checking_unrestricted'] or |
| 306 idl_type.may_raise_exception_on_conversion, | 334 idl_type.may_raise_exception_on_conversion, |
| 307 'has_type_checking_interface': has_type_checking_interface, | 335 'has_type_checking_interface': has_type_checking_interface, |
| 308 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri bute_value( | 336 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri bute_value( |
| 309 attribute, 'SetterCallWith', 'ExecutionContext'), | 337 attribute, 'SetterCallWith', 'ExecutionContext'), |
| 310 'is_setter_raises_exception': is_setter_raises_exception, | 338 'is_setter_raises_exception': is_setter_raises_exception, |
| 311 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( | 339 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( |
| 312 extended_attributes, 'v8Value', 'cppValue'), | 340 extended_attributes, 'v8Value', 'cppValue'), |
| 341 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | |
|
Jens Widell
2014/07/03 11:33:14
This is set to a different value in getter_context
haraken
2014/07/03 11:56:09
Nice catch, renamed it to private_script_cpp_value
| |
| 342 'cppValue', isolate='scriptState->isolate()', | |
| 343 creation_context='scriptState->context()->Global()'), | |
| 313 }) | 344 }) |
| 314 | 345 |
| 315 # setter_expression() depends on context values we set above. | 346 # setter_expression() depends on context values we set above. |
| 316 context['cpp_setter'] = setter_expression(interface, attribute, context) | 347 context['cpp_setter'] = setter_expression(interface, attribute, context) |
| 317 | 348 |
| 318 | 349 |
| 319 def setter_expression(interface, attribute, context): | 350 def setter_expression(interface, attribute, context): |
| 320 extended_attributes = attribute.extended_attributes | 351 extended_attributes = attribute.extended_attributes |
| 321 arguments = v8_utilities.call_with_arguments( | 352 arguments = v8_utilities.call_with_arguments( |
| 322 extended_attributes.get('SetterCallWith') or | 353 extended_attributes.get('SetterCallWith') or |
| 323 extended_attributes.get('CallWith')) | 354 extended_attributes.get('CallWith')) |
| 324 | 355 |
| 325 this_setter_base_name = setter_base_name(interface, attribute, arguments) | 356 this_setter_base_name = setter_base_name(interface, attribute, arguments) |
| 326 setter_name = scoped_name(interface, attribute, this_setter_base_name) | 357 setter_name = scoped_name(interface, attribute, this_setter_base_name) |
| 327 | 358 |
| 328 # Members of IDL partial interface definitions are implemented in C++ as | 359 # Members of IDL partial interface definitions are implemented in C++ as |
| 329 # static member functions, which for instance members (non-static members) | 360 # static member functions, which for instance members (non-static members) |
| 330 # take *impl as their first argument | 361 # take *impl as their first argument |
| 331 if ('PartialInterfaceImplementedAs' in extended_attributes and | 362 if ('PartialInterfaceImplementedAs' in extended_attributes and |
| 332 not attribute.is_static): | 363 not attribute.is_static): |
| 333 arguments.append('*impl') | 364 arguments.append('*impl') |
| 334 idl_type = attribute.idl_type | 365 idl_type = attribute.idl_type |
| 335 if idl_type.base_type == 'EventHandler': | 366 if 'ImplementedInPrivateScript' in extended_attributes: |
| 367 arguments.append('toFrameIfNotDetached(info.GetIsolate()->GetCurrentCont ext())') | |
| 368 arguments.append('impl') | |
| 369 arguments.append('cppValue') | |
| 370 elif idl_type.base_type == 'EventHandler': | |
| 336 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) | 371 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) |
| 337 context['event_handler_getter_expression'] = '%s(%s)' % ( | 372 context['event_handler_getter_expression'] = '%s(%s)' % ( |
| 338 getter_name, ', '.join(arguments)) | 373 getter_name, ', '.join(arguments)) |
| 339 if (interface.name in ['Window', 'WorkerGlobalScope'] and | 374 if (interface.name in ['Window', 'WorkerGlobalScope'] and |
| 340 attribute.name == 'onerror'): | 375 attribute.name == 'onerror'): |
| 341 includes.add('bindings/core/v8/V8ErrorHandler.h') | 376 includes.add('bindings/core/v8/V8ErrorHandler.h') |
| 342 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))') | 377 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))') |
| 343 else: | 378 else: |
| 344 arguments.append('V8EventListenerList::getEventListener(ScriptState: :current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') | 379 arguments.append('V8EventListenerList::getEventListener(ScriptState: :current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') |
| 345 elif idl_type.is_interface_type and not idl_type.array_type: | 380 elif idl_type.is_interface_type and not idl_type.array_type: |
| 346 # FIXME: should be able to eliminate WTF::getPtr in most or all cases | 381 # FIXME: should be able to eliminate WTF::getPtr in most or all cases |
| 347 arguments.append('WTF::getPtr(cppValue)') | 382 arguments.append('WTF::getPtr(cppValue)') |
| 348 else: | 383 else: |
| 349 arguments.append('cppValue') | 384 arguments.append('cppValue') |
| 350 if context['is_setter_raises_exception']: | 385 if context['is_setter_raises_exception']: |
| 351 arguments.append('exceptionState') | 386 arguments.append('exceptionState') |
| 352 | 387 |
| 353 return '%s(%s)' % (setter_name, ', '.join(arguments)) | 388 return '%s(%s)' % (setter_name, ', '.join(arguments)) |
| 354 | 389 |
| 355 | 390 |
| 356 CONTENT_ATTRIBUTE_SETTER_NAMES = { | 391 CONTENT_ATTRIBUTE_SETTER_NAMES = { |
| 357 'boolean': 'setBooleanAttribute', | 392 'boolean': 'setBooleanAttribute', |
| 358 'long': 'setIntegralAttribute', | 393 'long': 'setIntegralAttribute', |
| 359 'unsigned long': 'setUnsignedIntegralAttribute', | 394 'unsigned long': 'setUnsignedIntegralAttribute', |
| 360 } | 395 } |
| 361 | 396 |
| 362 | 397 |
| 363 def setter_base_name(interface, attribute, arguments): | 398 def setter_base_name(interface, attribute, arguments): |
| 399 if 'ImplementedInPrivateScript' in attribute.extended_attributes: | |
| 400 return '%sAttributeSetterImplementedInPrivateScript' % uncapitalize(cpp_ name(attribute)) | |
| 401 | |
| 364 if 'Reflect' not in attribute.extended_attributes: | 402 if 'Reflect' not in attribute.extended_attributes: |
| 365 return 'set%s' % capitalize(cpp_name(attribute)) | 403 return 'set%s' % capitalize(cpp_name(attribute)) |
| 366 arguments.append(scoped_content_attribute_name(interface, attribute)) | 404 arguments.append(scoped_content_attribute_name(interface, attribute)) |
| 367 | 405 |
| 368 base_idl_type = attribute.idl_type.base_type | 406 base_idl_type = attribute.idl_type.base_type |
| 369 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: | 407 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: |
| 370 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] | 408 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] |
| 371 return 'setAttribute' | 409 return 'setAttribute' |
| 372 | 410 |
| 373 | 411 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 lambda self: strip_suffix(self.base_type, 'Constructor')) | 472 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 435 | 473 |
| 436 | 474 |
| 437 def is_constructor_attribute(attribute): | 475 def is_constructor_attribute(attribute): |
| 438 # FIXME: replace this with [ConstructorAttribute] extended attribute | 476 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 439 return attribute.idl_type.base_type.endswith('Constructor') | 477 return attribute.idl_type.base_type.endswith('Constructor') |
| 440 | 478 |
| 441 | 479 |
| 442 def constructor_getter_context(interface, attribute, context): | 480 def constructor_getter_context(interface, attribute, context): |
| 443 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] | 481 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] |
| OLD | NEW |