def setter_expression(interface, attribute, contents): arguments = v8_utilities.call_with_arguments( attribute, attribute.extended_attributes.get('SetterCallWith')) this_setter_base_name = setter_base_name(attribute, arguments) setter_name = v8_utilities.scoped_name(interface, attribute, this_setter_base_name) idl_type = attribute.idl_type if idl_type == 'EventHandler': # FIXME: pass the isolate instead of the isolated world isolated_world = 'isolatedWorldForIsolate(info.GetIsolate())' arguments.extend([ 'V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)', isolated_world ]) contents['event_handler_getter_expression'] = 'imp->%s(%s)' % ( cpp_name(attribute), isolated_world) elif v8_types.is_interface_type( idl_type) and not v8_types.array_type(idl_type): # FIXME: should be able to eliminate WTF::getPtr in most or all cases arguments.append('WTF::getPtr(cppValue)') else: arguments.append('cppValue') if contents['is_setter_raises_exception']: arguments.append('exceptionState') return '%s(%s)' % (setter_name, ', '.join(arguments))
def setter_expression(interface, attribute, contents): extended_attributes = attribute.extended_attributes arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith')) this_setter_base_name = setter_base_name(attribute, arguments) setter_name = v8_utilities.scoped_name(interface, attribute, this_setter_base_name) if ('ImplementedBy' in extended_attributes and not attribute.is_static): arguments.append('imp') idl_type = attribute.idl_type if idl_type == 'EventHandler': getter_name = v8_utilities.scoped_name(interface, attribute, cpp_name(attribute)) contents['event_handler_getter_expression'] = '%s(%s)' % ( getter_name, ', '.join(arguments)) if (interface.name in ['Window', 'WorkerGlobalScope'] and attribute.name == 'onerror'): includes.add('bindings/v8/V8ErrorHandler.h') arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(jsValue, true, info.GetIsolate())') else: arguments.append('V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)') elif v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_type): # FIXME: should be able to eliminate WTF::getPtr in most or all cases arguments.append('WTF::getPtr(cppValue)') else: arguments.append('cppValue') if contents['is_setter_raises_exception']: arguments.append('exceptionState') return '%s(%s)' % (setter_name, ', '.join(arguments))
def generate_setter(interface, attribute, contents): idl_type = attribute.idl_type extended_attributes = attribute.extended_attributes if v8_types.is_interface_type( idl_type) and not v8_types.array_type(idl_type): cpp_value = 'WTF::getPtr(cppValue)' else: cpp_value = 'cppValue' is_reflect = 'Reflect' in extended_attributes if is_reflect: includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') contents.update({ 'cpp_setter': setter_expression(interface, attribute, contents), 'enum_validation_expression': v8_utilities.enum_validation_expression(idl_type), 'has_strict_type_checking': 'StrictTypeChecking' in extended_attributes and v8_types.is_interface_type(idl_type), 'is_reflect': is_reflect, 'v8_value_to_local_cpp_value': v8_types.v8_value_to_local_cpp_value(idl_type, extended_attributes, 'jsValue', 'cppValue'), })
def setter_expression(interface, attribute, contents): extended_attributes = attribute.extended_attributes arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith')) this_setter_base_name = setter_base_name(attribute, arguments) setter_name = v8_utilities.scoped_name(interface, attribute, this_setter_base_name) if ('ImplementedBy' in extended_attributes and not attribute.is_static): arguments.append('imp') idl_type = attribute.idl_type if idl_type == 'EventHandler': # FIXME: pass the isolate instead of the isolated world isolated_world = 'isolatedWorldForIsolate(info.GetIsolate())' getter_name = v8_utilities.scoped_name(interface, attribute, cpp_name(attribute)) getter_arguments = arguments + [isolated_world] contents['event_handler_getter_expression'] = '%s(%s)' % ( getter_name, ', '.join(getter_arguments)) arguments.extend(['V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)', isolated_world]) elif v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_type): # FIXME: should be able to eliminate WTF::getPtr in most or all cases arguments.append('WTF::getPtr(cppValue)') else: arguments.append('cppValue') if contents['is_setter_raises_exception']: arguments.append('exceptionState') return '%s(%s)' % (setter_name, ', '.join(arguments))
def generate_setter(interface, attribute, contents): idl_type = attribute.idl_type extended_attributes = attribute.extended_attributes if v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_type): cpp_value = 'WTF::getPtr(cppValue)' else: cpp_value = 'cppValue' is_reflect = 'Reflect' in extended_attributes if is_reflect: includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') contents.update({ 'cpp_setter': setter_expression(interface, attribute, contents), 'enum_validation_expression': v8_utilities.enum_validation_expression(idl_type), 'has_strict_type_checking': 'StrictTypeChecking' in extended_attributes and v8_types.is_interface_type(idl_type), 'is_reflect': is_reflect, 'v8_value_to_local_cpp_value': v8_types.v8_value_to_local_cpp_value( idl_type, extended_attributes, 'jsValue', 'cppValue'), })
def setter_expression(interface, attribute, contents): arguments = v8_utilities.call_with_arguments(attribute, attribute.extended_attributes.get('SetterCallWith')) this_setter_base_name = setter_base_name(attribute, arguments) setter_name = v8_utilities.scoped_name(interface, attribute, this_setter_base_name) idl_type = attribute.idl_type if idl_type == 'EventHandler': # FIXME: move V8EventListenerList.h to INCLUDES_FOR_TYPE includes.add('bindings/v8/V8EventListenerList.h') # FIXME: pass the isolate instead of the isolated world isolated_world = 'isolatedWorldForIsolate(info.GetIsolate())' arguments.extend(['V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)', isolated_world]) contents['event_handler_getter_expression'] = 'imp->%s(%s)' % (cpp_name(attribute), isolated_world) elif v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_type): # FIXME: should be able to eliminate WTF::getPtr in most or all cases arguments.append('WTF::getPtr(cppValue)') else: arguments.append('cppValue') if contents['is_setter_raises_exception']: arguments.append('es') return '%s(%s)' % (setter_name, ', '.join(arguments))
def setter_expression(interface, attribute, contents): extended_attributes = attribute.extended_attributes arguments = v8_utilities.call_with_arguments( attribute, extended_attributes.get('SetterCallWith')) this_setter_base_name = setter_base_name(attribute, arguments) setter_name = v8_utilities.scoped_name(interface, attribute, this_setter_base_name) if ('ImplementedBy' in extended_attributes and not attribute.is_static): arguments.append('imp') idl_type = attribute.idl_type if idl_type == 'EventHandler': getter_name = v8_utilities.scoped_name(interface, attribute, cpp_name(attribute)) contents['event_handler_getter_expression'] = '%s(%s)' % ( getter_name, ', '.join(arguments)) if (interface.name in ['Window', 'WorkerGlobalScope'] and attribute.name == 'onerror'): includes.add('bindings/v8/V8ErrorHandler.h') arguments.append( 'V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(jsValue, true, info.GetIsolate())' ) else: arguments.append( 'V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)' ) elif v8_types.is_interface_type( idl_type) and not v8_types.array_type(idl_type): # FIXME: should be able to eliminate WTF::getPtr in most or all cases arguments.append('WTF::getPtr(cppValue)') else: arguments.append('cppValue') if contents['is_setter_raises_exception']: arguments.append('exceptionState') return '%s(%s)' % (setter_name, ', '.join(arguments))